带有 CUDA 的 Arrayfire CPP“无法打开 libnvrtc-builtins.so.12.2”

问题描述 投票:0回答:1

由于某种原因,arrayfire 无法与我的 nvidia GPU 配合使用。我正在尝试用 cmake 来做到这一点。

我正确安装了 cuda 工具包,并按照此处找到的 linux 安装说明进行操作 https://arrayfire.org/docs/installing.htm#gsc.tab=0.

错误:

In function compileModule
In file src/backend/cuda/compile_module.cpp:297
NVRTC Error(7): NVRTC_ERROR_BUILTIN_OPERATION_FAILURE
Log: 
nvrtc: error: failed to open libnvrtc-builtins.so.12.2.
  Make sure that libnvrtc-builtins.so.12.2 is installed correctly.

我的cmake:

cmake_minimum_required(VERSION 3.27)
project(...)

set(CMAKE_CXX_STANDARD 17)

set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda-11.3")
find_package(CUDAToolkit 11.3 REQUIRED)

include_directories(
        ${PROJECT_SOURCE_DIR}/lib/eigen-3.4.0
        ${CUDA_TOOLKIT_ROOT_DIR}/include
        ${ArrayFire_INCLUDE_DIRS}
        ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}
)

link_directories(
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64
)

set(ArrayFire_DIR /opt/ArrayFire-3.9.0-Linux/share/ArrayFire/cmake)
find_package(ArrayFire REQUIRED)

if(ArrayFire_CUDA_FOUND)
    add_definitions(-DAF_CUDA)
elseif(ArrayFire_OpenCL_FOUND)
    add_definitions(-DAF_OPENCL)
elseif(ArrayFire_CPU_FOUND)
    add_definitions(-DAF_CPU)
endif()

add_subdirectory(lib/googletest)

add_executable(${PROJECT_NAME}
   ... my files
)

add_executable(run_gs_dbscan_tests
 ... my files
)

set(CUDA_LIBS
        libcudart.so
        libcublas.so
        libcusolver.so
)

target_link_libraries(run_gs_dbscan_tests gtest gtest_main ${CUDA_LIBS} ${ArrayFire_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${CUDA_LIBS} ${ArrayFire_LIBRARIES})

nvidia-smi:

Mon May 20 12:20:31 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15              Driver Version: 550.54.15      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 3090        Off |   00000000:01:00.0 Off |                  N/A |
|  0%   50C    P8             40W /  390W |      16MiB /  24576MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA GeForce RTX 3090        Off |   00000000:4A:00.0 Off |                  N/A |
|  0%   49C    P8             37W /  390W |     628MiB /  24576MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      1994      G   /usr/lib/xorg/Xorg                              4MiB |
|    0   N/A  N/A      2644      G   /usr/lib/xorg/Xorg                              4MiB |
|    1   N/A  N/A      1994      G   /usr/lib/xorg/Xorg                            150MiB |
|    1   N/A  N/A      2644      G   /usr/lib/xorg/Xorg                            426MiB |
|    1   N/A  N/A      2812      G   /usr/bin/gnome-shell                           24MiB |
+-----------------------------------------------------------------------------------------+

nvcc --版本:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:15:13_PDT_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0

我怀疑我可能遗漏了一些非常微不足道的东西。

我尝试运行我的 Google CPP 测试,它依赖 ArrayFire 来操作矩阵。原本希望它能正常运行,但事实并非如此 - 请参阅上面的错误消息。

c++ cmake cuda runtime-error arrayfire
1个回答
0
投票

所以,我对 C++ 还很陌生(我通常使用 Python),我所需要做的就是从源代码构建。

请参阅此处,了解从源代码构建 ArrayFire 的说明(对于 Linux,其他平台也可以在 wiki 中找到)。

© www.soinside.com 2019 - 2024. All rights reserved.