Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,224
    • Issues 3,224
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 13
    • Merge Requests 13
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #17929

Closed
Open
Opened Apr 21, 2018 by Teodor Nikolov@teonnik

FindMPI: doesn't work with nvcc (CUDA) because of the -pthread flag

The following

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

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:

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

Edited Oct 25, 2018 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
3.13.0
Milestone
3.13.0 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#17929