berenger-eu / tbfmm

Task-based fast multipole method, parallelized using OpenMP and StarPU. With StarPU it supports multiple GPUs (CUDA).
Other
9 stars 3 forks source link

Command-Line Error D8021 #3

Open Danil482 opened 1 year ago

Danil482 commented 1 year ago

I am trying to compile the library under VS C++ 2019. However, I get the following error. Would you be so kind to help me fix it? Do you have any ideas? I am new in CMake.

berenger-eu commented 1 year ago

Sorry, I just saw your email this morning (I had issue with email coming from github). In case you are still interested to solve this, please feel free to copy and paste the error here.

ArturSalamatin commented 1 year ago

Thank you for your kind response! Is there any way of communication which is more convenient for you?

@Danil482 is my student and we would like to adapt your FMM code implementation to be used in our project. The issue was under the MS Visual Studio 2022 IDE... And mainly comes from the difference in compilers and compiler options.

berenger-eu commented 1 year ago

Ok, I will try to fix the Windows error asap. I am fine with exchanging on github.

ArturSalamatin commented 1 year ago

These days I was trying to build the library with CygWin https://cygwin.com/packages/summary/gcc-core.html

But unfortunately I have to give up, since I was not able to overcome this error Unhandled exception: Unhandled Promise rejection: build Error: No usable generator found. {}

For some reason VS Code does not find cmake generator. However, I have one installed one from https://cmake.org/ as well as a VS Code extension from Microsoft

ArturSalamatin commented 1 year ago

Compiling with MSVC using Visual Studio C++ kit Visual Studio Community 2022 Relase - amd64 is intricate as well, due to the following lines in CMakeLists.txt (I suppose)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set(TBFMM_EXTRA_FLAG "-m64 -march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual  -Wall -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wno-error" CACHE STRING "Additional flags"  )
else()
    set(TBFMM_EXTRA_FLAG "-m64 -march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wconversion  -Wall -Wno-sign-conversion -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wconversion -Wno-error" CACHE STRING "Additional flags"  )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBFMM_EXTRA_FLAG}")

Obviously, MSVC compiler does not know anything about the Command Line options provided under else() operator. Removing these commands makes it impossible to compile with the error

[build] .\tbfmm\examples\testRotationKernel.cpp(196,1): error C3493: 'NbRhsValuesPerParticle' cannot be implicitly captured because no default capture mode has been specified 

and some issues with OpenMP... Which are not reproducible now for me.

This is the detailed explanation of the current state of our research team effort to compile your library. Any advices from you are highly appreciated.

Please take your time, and thank you for keeping in contact!

berenger-eu commented 1 year ago

I pushed a tiny change on master, could you give it a try? It should remove the error you showed me with MSVC. Thanks.

ArturSalamatin commented 1 year ago

Thank you for your help! It seems that the error mentioned earlier in this discussion and related to NbRhsValuesPerParticle is fixed now.

Compiling with MSVC using Visual Studio C++ kit Visual Studio Community 2022 Relase - amd64 is intricate as well, due to the following lines in CMakeLists.txt (I suppose)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set(TBFMM_EXTRA_FLAG "-m64 -march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual  -Wall -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wno-error" CACHE STRING "Additional flags"  )
else()
    set(TBFMM_EXTRA_FLAG "-m64 -march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wconversion  -Wall -Wno-sign-conversion -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wconversion -Wno-error" CACHE STRING "Additional flags"  )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBFMM_EXTRA_FLAG}")

Obviously, MSVC compiler does not know anything about the Command Line options provided under else() operator. Removing these commands makes it impossible to compile with the error

[build] .\tbfmm\examples\testRotationKernel.cpp(196,1): error C3493: 'NbRhsValuesPerParticle' cannot be implicitly captured because no default capture mode has been specified 

and some issues with OpenMP... Which are not reproducible now for me.

This is the detailed explanation of the current state of our research team effort to compile your library. Any advices from you are highly appreciated.

Please take your time, and thank you for keeping in contact!

But... I still have to explicitly comment the line in CMakeLists.txt, responsible for the compiler options to move on with MSVC compilation (see a hashtag below)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set(TBFMM_EXTRA_FLAG "-march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual  -Wall -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wno-error" CACHE STRING "Additional flags"  )
else()
   # set(TBFMM_EXTRA_FLAG "-march=native -Wextra -Wnon-virtual-dtor -Wshadow -Wpointer-arith -Wcast-qual -Wconversion  -Wall -Wno-sign-conversion -pedantic -Woverloaded-virtual -Wpointer-arith -Wcast-qual -Wconversion -Wno-error" CACHE STRING "Additional flags"  )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBFMM_EXTRA_FLAG}")

And a new problem is revealed, which is described in another issue #8

berenger-eu commented 1 year ago

Ok, you can avoid commenting the line by setting TBFMM_EXTRA_FLAG to an empty string. I guess the "-march=native" is the issue, but I am not sure, and most of these flags are for warnings. So when executing the cmake command, just do: cmake .. -DTBFMM_EXTRA_FLAG="" (considering the cmakelist is in ..