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

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


Thank you for the report and fix,

for the record Benoit pushed this fix few hours ago:
https://bitbucket.org/eigen/eigen/commits/24f871baf54e05ced274a75d53c38793804524ed

gael

On Wed, Nov 9, 2016 at 8:13 PM, Matt Richardson <mattri@xxxxxxxxxxxxx> wrote:

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/