NVIDIA / cuCollections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: cmake in README failed in CMakeCUDACompilerId.cu

stormouse opened this issue · comments

Is this a duplicate?

Type of Bug

Silent Failure

Describe the bug

Following the CMake guide in README I got

CMake Error at /usr/local/cmake-3.27.7-linux-x86_64/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:753 (message):Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.

Compiler: /usr/bin/nvcc

Build flags:

Id flags: --keep;--keep-dir;tmp -v

How to Reproduce

cmake_minimum_required(VERSION 3.23.1 FATAL_ERROR)

project(myproject)

include(cmake/CPM.cmake)

CPMAddPackage(
  NAME cuco
  GITHUB_REPOSITORY NVIDIA/cuCollections
  GIT_TAG dev
  OPTIONS
     "BUILD_TESTS OFF"
     "BUILD_BENCHMARKS OFF"
     "BUILD_EXAMPLES OFF"
)

add_executable(myproject main.cpp)

target_link_libraries(myproject cuco)

Expected behavior

[cmake]   /usr/include/c++/11/bits/stl_pair.h(460): error: argument list for class
[cmake]   template "std::pair" is missing
[cmake] 
[cmake] 
[cmake] 
[cmake]   /usr/include/c++/11/bits/stl_pair.h(460): error: expected a ")"
[cmake] 
[cmake] 
[cmake] 
[cmake]   /usr/include/c++/11/bits/stl_pair.h(460): error: template parameter "_T1"
[cmake]   may not be redeclared in this scope
[cmake] 
[cmake] 
[cmake] 
[cmake]   /usr/include/c++/11/bits/stl_pair.h(460): error: expected a ";"
[cmake] 
[cmake] 
[cmake] 
[cmake]   4 errors detected in the compilation of "CMakeCUDACompilerId.cu".
[cmake] 
[cmake]   # --error 0x1 --

Reproduction link

No response

Operating System

Linux VENGEANCE 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

nvidia-smi output

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.29.01 Driver Version: 546.01 CUDA Version: 12.3 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 4090 On | 00000000:01:00.0 On | Off |
| 0% 38C P8 22W / 450W | 857MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 24 G /Xwayland N/A |
+---------------------------------------------------------------------------------------+

NVCC version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_Sep_13_19:13:29_PDT_2021
Cuda compilation tools, release 11.5, V11.5.50
Build cuda_11.5.r11.5/compiler.30411180_0

Thanks for opening this issue!

My initial thought is that the host compiler version isn't compatible with the CUDA CTK.
Can you please add you host compiler version so we can verify?
Also, nvcc 11.5 is pretty old. I would advise to switch to a newer version, e.g., 12.3 if possible.

The culprit should be your host compiler (or gcc) version.

cuco is a C++17 project while I've seen build errors with C++11 headers. @stormouse Can you please update your gcc version to 8 or plus?

Hi @sleeepyjack and @PointKernel , thanks for the prompt response!

I've tried cmaking with gcc 9, 10, 11, and 12 - while 12 is not supported explicitly, all other versions give me the same error message.

I've also tried upgrading nvcc to 12.3.

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Sep__8_19:17:24_PDT_2023
Cuda compilation tools, release 12.3, V12.3.52
Build cuda_12.3.r12.3/compiler.33281558_0

This time it gives me another error message.

...
  #$ ptxas -arch=sm_52 -m64 "tmp/CMakeCUDACompilerId.ptx" -o
  "tmp/CMakeCUDACompilerId.sm_52.cubin"

  ptxas tmp/CMakeCUDACompilerId.ptx, line 9; fatal : Unsupported .version
  8.3; current version is '7.5'

  ptxas fatal : Ptx assembly aborted due to errors

  # --error 0xff --

Call Stack (most recent call first):
  /usr/local/cmake-3.27.7-linux-x86_64/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  /usr/local/cmake-3.27.7-linux-x86_64/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
  /usr/local/cmake-3.27.7-linux-x86_64/share/cmake-3.27/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID)

But I think I can try navigate it through. Will let you know.

After cleaning up remaining links to older cuda toolkit and use everything 12.3 instead, I got a successful build. Thanks again for the help!