CEA-LIST / N2D2

N2D2 is an open source CAD framework for Deep Neural Network simulation and full DNN-based applications building.
Other
146 stars 35 forks source link

Fix compil for VS-2017 #37

Closed sylvain-bougnoux closed 5 years ago

sylvain-bougnoux commented 5 years ago

Here is a fix for compiling with Visual Studio 2017. Actually there was several issues (not all are solved)

1/ the cmakelist must add _DEBUG to cuda library because otherwise the linker fails due to _HAS_ITERATOR_DEBUGGING incoherence (0 & 2).

2/ Actually there is a compiler bug preventing the automatic initialization of the class Interface<T> . Hereafter I add a temporary trivial fix (using explicit instantiation), I've committed a bug report to microsoft. https://developercommunity.visualstudio.com/content/problem/649717/compiler-issue-with-initializer-list-and-template.html

Normally it won't interfere with other compilers, but I can add #if _WIN32 .... #endif

3/ The file tests/controler/class_Interface.cpp crashes the compiler, I could not fix it, and I've simply bypassed it (commenting out its content). No bug report to MS were send.

Regards

sylvain-bougnoux commented 5 years ago

Can someone help to fix the test set. Currently it fails due to cuda. Cuda failure: CUDA driver version is insufficient for CUDA runtime version (35) in C:\projects\n2d2\include\containers/CudaTensor.hpp:400 But I have not changed anything on cuda! I am wondering how the test can pass before. Can someone update the CUDA drivers for the test.

olivierbichler-cea commented 5 years ago

Hi, I am currently fixing the CUDA issues, then if AppVeyor passes with your patch, we will be ready to merge! Thanks

olivierbichler-cea commented 5 years ago

Hi, We added a new constructor in the Interface class in the latest commit, in order to avoid having to specify the default arguments everywhere. Also, the CUDA unit tests should be fixed. Normally the latest version should compile on VS-2017 and VS-2019, but there might still be an issue with the _DEBUG and class_Interface unit test. Could you check and tell us if there is still some part of your changes that are necessary?

sylvain-bougnoux commented 5 years ago

Thanks for the new ctor, it is a much better solution than mine, I feel very stupid not to have used it :-)

The latest version compiles for VS-2017 but only in release. I have not tested VS-2019. The _DEBUG flags is mandatory for the debug version (as long as CUDA is used).

The class_interfaceis now working as well (for unknown reason). I have updated several time recently my vc compiler (I have exactly version 15.9.15). It might be the reason?

Therefore my PR boils down to almost nothing. As I would like to fix many other issues in the CMakeList.txt we can close this PR and I will formulate a new one.

Thanks again.

olivierbichler-cea commented 5 years ago

Ok, lets do that! Thanks.