A-New-BellHope / bellhopcuda

CUDA and C++ port of BELLHOP / BELLHOP3D underwater acoustics simulator
GNU General Public License v3.0
64 stars 8 forks source link

The Laptop GPU compilation error #40

Open RookieLinux opened 3 weeks ago

RookieLinux commented 3 weeks ago

I got an error using the laptop gpu compiler.

My system specs are: CPU: i7-12700H GPU: NVIDIA GeForce RTX 3060 Laptop GPU RAM: 32Gb ddr5 OS:Ubuntu22.04 Motherboard vendor: HP

The relevant information is as follows:

rookie@rookie-pc:~$ nvidia-smi -L GPU 0: NVIDIA GeForce RTX 3060 Laptop GPU (UUID: GPU-717149fd-8945-1447-c076-4812534cb1f7) rookie@rookie-pc:~$ nvidia-smi Thu Oct 17 10:33:05 2024
+-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.90.12 Driver Version: 550.90.12 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | 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 3060 ... Off | 00000000:01:00.0 On | N/A | | N/A 37C P8 14W / 30W | 59MiB / 6144MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | 0 N/A N/A 2300 G /usr/lib/xorg/Xorg 55MiB | +-----------------------------------------------------------------------------------------+

The compilation error message is as follows:

CMake Warning at config/CMakeLists.txt:21 (message): clang-format pre-commit hook not found, installing -- The CXX compiler identification is GNU 12.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- GCC detected, adding compile flags -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- The CUDA compiler identification is NVIDIA 12.4.131 -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- GCC detected, adding compile flags -- CUDA extra flags: -Xcudafe --diag_warning=local_variable_hidden -Xcudafe --diag_warning=decl_hides_catch_parameter -Xcudafe --diag_warning=decl_hides_function_parameter -Xcudafe --diag_warning=decl_hides_template_parameter -Xcudafe --diag_warning=for_init_hides_declaration -Xcudafe --diag_warning=declaration_hides_for_init -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored -ftz=true --expt-relaxed-constexpr CMake Error at config/cuda/SetupCUDA.cmake:72 (message): CUDA compute capability of GPU RTX 3060 Laptop GPU unknown! Call Stack (most recent call first): config/cuda/SetupCUDA.cmake:106 (get_compute_for_gpu) config/cuda/SetupCUDA.cmake:140 (get_gencode_args) config/cuda/CMakeLists.txt:22 (include)

-- GPU found: RTX 3060 Laptop GPU, compute Unknown -- Using gencode args: -gencode arch=compute_Unknown,code=sm_Unknown -- Full CUDA flags: -gencode arch=compute_Unknown,code=sm_Unknown -Xcompiler=-Wall -Xcompiler=-Wextra -Xcompiler=-Wno-class-memaccess -Xcudafe --diag_warning=local_variable_hidden -Xcudafe --diag_warning=decl_hides_catch_parameter -Xcudafe --diag_warning=decl_hides_function_parameter -Xcudafe --diag_warning=decl_hides_template_parameter -Xcudafe --diag_warning=for_init_hides_declaration -Xcudafe --diag_warning=declaration_hides_for_init -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored -ftz=true --expt-relaxed-constexpr -- GCC detected, adding compile flags -- Configuring incomplete, errors occurred! See also "/home/rookie/bellhopcuda/build/CMakeFiles/CMakeOutput.log".

So I read the SetupCUDA.cmake file and added Laptop GPU support, as follows: foreach(GPU_LINE ${__out}) string(REGEX REPLACE "GPU [0-9]: (.) \(UUID: ." "\1" GPU_NAME ${GPU_LINE}) string(REGEX REPLACE "GeForce " "" GPU_NAME ${GPU_NAME}) string(REGEX REPLACE "N[Vv][Ii][Dd][Ii][Aa] " "" GPU_NAME ${GPU_NAME}) string(REGEX REPLACE " Laptop GPU" "" GPU_NAME ${GPU_NAME}) # Added support for Laptop Gpus get_compute_for_gpu(GPU_COMPUTE ${GPU_NAME}) message(STATUS "GPU found: " ${GPU_NAME} ", compute " ${GPU_COMPUTE}) if(CUDA_ALL_ARCHES) if(NOT GPU_COMPUTE IN_LIST ALLCOMPUTES) set(TEMP "${TEMP} -gencode arch=compute${GPUCOMPUTE},code=sm${GPU_COMPUTE}") list(APPEND ALL_COMPUTES "${GPU_COMPUTE}") endif() else() if(ALL_COMPUTES) set(WARN_MULTI_ARCH 1) if(NOT GPU_COMPUTE GREATER ALLCOMPUTES) continue() endif() endif() set(TEMP "-gencode arch=compute${GPUCOMPUTE},code=sm${GPU_COMPUTE}") set(ALL_COMPUTES "${GPU_COMPUTE}") endif() endforeach()

I do not know if there is a better way, looking forward to your reply

oldstylejoe commented 3 weeks ago

Thanks for sharing that (and sorry to be a little slow). It looks like you've resolved the issue for your setup. Are you recommending a change to the cmake file to support all GPUs? That's been an outstanding issue for quite some time. Please feel free to propose a PR or send a diff.