CMake issueshttps://gitlab.kitware.com/cmake/cmake/-/issues2018-10-25T10:47:21-04:00https://gitlab.kitware.com/cmake/cmake/-/issues/18502`FindMPI` issues with `nvcc` due to `-Wl` flag2018-10-25T10:47:21-04:00Teodor Nikolov`FindMPI` issues with `nvcc` due to `-Wl` flagWith `cmake 3.12.3`, the `FindMPI` module passes `-Wl` flags to `nvcc` which are not supported by the compiler and cause linking to fail. Would it be possible to use `-Xlinker` instead? The flag is supported by both `nvcc` and host compi...With `cmake 3.12.3`, the `FindMPI` module passes `-Wl` flags to `nvcc` which are not supported by the compiler and cause linking to fail. Would it be possible to use `-Xlinker` instead? The flag is supported by both `nvcc` and host compilers (`gcc`, `clang`).3.13.0Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/18440cuda 10 causes /Fd overwritting warning to be emiited in visual studio2022-06-03T10:24:22-04:00Scott Smithcuda 10 causes /Fd overwritting warning to be emiited in visual studioI have recently upgraded to cuda 10 (version 10.0.130) and visual studio is now emitting warnings like:
cl : Command line warning D9025: overriding '/Fd..\bin\vc141\x64_release\whatever.pdb' with '/FdD:\Projects\workspace\Project\bin\vc...I have recently upgraded to cuda 10 (version 10.0.130) and visual studio is now emitting warnings like:
cl : Command line warning D9025: overriding '/Fd..\bin\vc141\x64_release\whatever.pdb' with '/FdD:\Projects\workspace\Project\bin\vc141\x64_release\whatever.pdb'
related to #176473.13.0Brad KingBrad Kinghttps://gitlab.kitware.com/cmake/cmake/-/issues/18008CUDA: Wrap `-pthread` flags into `-Xcompiler -pthread` for nvcc invocations2020-01-20T09:39:42-05:00Alexander KorsunskyCUDA: Wrap `-pthread` flags into `-Xcompiler -pthread` for nvcc invocationsUsing the finder module for [Threads](https://cmake.org/cmake/help/v3.11/module/FindThreads.html) with `CMAKE_THREAD_PREFER_PTHREAD=ON` causes compilation of cuda objects to fail with the message:
`nvcc fatal : Unknown option 'pthread...Using the finder module for [Threads](https://cmake.org/cmake/help/v3.11/module/FindThreads.html) with `CMAKE_THREAD_PREFER_PTHREAD=ON` causes compilation of cuda objects to fail with the message:
`nvcc fatal : Unknown option 'pthread'`
This is because nvcc does not understand the option `pthread`. This should be able to be made to work by wrapping it in an `-Xcompiler` option.
As a user-side workaround this is a bit unsatisfactory, because dealing with `-pthread` flags is platform dependent, whereas the whole point of the the FindThreads module is to abstract away the platform dependency.
What would be great is if the native CUDA support in CMake could handle interactions with `-pthread` natively.
Related to #17929.
Maybe @robertmaynard is involved, maybe the maintainer of the FindThreads module3.13.0Robert MaynardRobert Maynardhttps://gitlab.kitware.com/cmake/cmake/-/issues/17929FindMPI: doesn't work with nvcc (CUDA) because of the -pthread flag2019-02-08T13:08:54-05:00Teodor NikolovFindMPI: doesn't work with nvcc (CUDA) because of the -pthread flagThe following
```cmake
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(sandox LANGUAGES CXX CUDA)
find_package(MPI REQUIRED)
add_executable(mytest mytest.cu)
target_link_libraries(mytest PRIVATE MPI::MPI_CXX)
```
fails with
...The following
```cmake
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(sandox LANGUAGES CXX CUDA)
find_package(MPI REQUIRED)
add_executable(mytest mytest.cu)
target_link_libraries(mytest PRIVATE MPI::MPI_CXX)
```
fails with
```shell
make VERBOSE=1 mytest
/usr/bin/cmake -H/home/teonnik/downloads/sandbox -B/home/teonnik/downloads/sandbox/build --check-build-system CMakeFiles/Makefile.cmake 0
make -f CMakeFiles/Makefile2 mytest
make[1]: Entering directory '/home/teonnik/downloads/sandbox/build'
/usr/bin/cmake -H/home/teonnik/downloads/sandbox -B/home/teonnik/downloads/sandbox/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/teonnik/downloads/sandbox/build/CMakeFiles 3
make -f CMakeFiles/Makefile2 CMakeFiles/mytest.dir/all
make[2]: Entering directory '/home/teonnik/downloads/sandbox/build'
make -f CMakeFiles/mytest.dir/build.make CMakeFiles/mytest.dir/depend
make[3]: Entering directory '/home/teonnik/downloads/sandbox/build'
cd /home/teonnik/downloads/sandbox/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/teonnik/downloads/sandbox /home/teonnik/downloads/sandbox /home/teonnik/downloads/sandbox/build /home/teonnik/downloads/sandbox/build /home/teonnik/downloads/sandbox/build/CMakeFiles/mytest.dir/DependInfo.cmake --color=
make[3]: Leaving directory '/home/teonnik/downloads/sandbox/build'
make -f CMakeFiles/mytest.dir/build.make CMakeFiles/mytest.dir/build
make[3]: Entering directory '/home/teonnik/downloads/sandbox/build'
[ 33%] Building CUDA object CMakeFiles/mytest.dir/mytest.cu.o
/opt/cuda/bin/nvcc -pthread -x cu -c /home/teonnik/downloads/sandbox/mytest.cu -o CMakeFiles/mytest.dir/mytest.cu.o
nvcc fatal : Unknown option 'pthread'
make[3]: *** [CMakeFiles/mytest.dir/build.make:63: CMakeFiles/mytest.dir/mytest.cu.o] Error 1
make[3]: Leaving directory '/home/teonnik/downloads/sandbox/build'
make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/mytest.dir/all] Error 2
make[2]: Leaving directory '/home/teonnik/downloads/sandbox/build'
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/mytest.dir/rule] Error 2
make[1]: Leaving directory '/home/teonnik/downloads/sandbox/build'
make: *** [Makefile:118: mytest] Error 2
```
where the problem seems to be that `-pthread` is passed to `nvcc` via `MPI::MPI_CXX`.
There were no problems in `CMake 3.9`. What can I do to fix the issue?
------------------
My system:
```shell
Linux teonnik 4.15.15-1-ARCH #1 SMP PREEMPT Sat Mar 31 23:59:25 UTC 2018 x86_64 GNU/Linux
```
CMake version: `3.10.3`
MPI: `Open MPI v3.0.1`3.13.0Brad KingBrad King