[eigen] sleep() compile error on Windows: TensorDeviceCuda.h

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

 

In unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h, there is a call to “sleep(1)”, based on unistd.h. This (obviously) doesn’t compile in Windows, but can be fixed trivially by a conditional call to sleep() or Sleep(). I don’t have access to Bugzilla to file this as a bug, can someone create a bug or simply modify the code? You could follow the example in unsupported/test/cxx11_tensor_notification.cpp

 

#if EIGEN_OS_WIN || EIGEN_OS_WIN64

#include <windows.h>

void sleep(int seconds) {

Sleep(seconds*1000);

}

#else

#include <unistd.h>

#endif

 

Or, I made the following change which works fine also (I’m not sure why I didn’t need to include windows.h):

 

#ifdef _WIN32

        Sleep(1000);

#else

        sleep(1);

#endif

 

Or perhaps this belongs in some cross-platform-utils..h to be included in both files?

 

Thanks!
Matt



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/