1

For some reason arrayfire isn't working with my nvidia GPU. I'm trying to do this with cmake.

I have the cuda toolkit correctly installed, and followed the linux linux install instructions found here https://arrayfire.org/docs/installing.htm#gsc.tab=0.

The error:

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.

my 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 --version:

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

I suspect I may be missing something very trivial.

I've tried to run my Google CPP tests, which relies on ArrayFire for manipulating matrices. Was expecting it to just run normally, except it didn't - see the error message as above.

5
  • 2
    The version of arrayfire you have installed requires the CUDA 12.2 runtime, apparently Commented May 22, 2024 at 23:43
  • @talonmies shouldn't arrayfire support earlier versions of cuda? - I'm using arrayfire 3.9.0 which looks to be the latest. Commented May 24, 2024 at 20:38
  • No. The CUDA runtime API is versioned. You need to use the matching version. Commented May 24, 2024 at 23:30
  • Would you know where to find information on how to match my CUDA 11.3 toolkit with the appropriate Arrayfire version? - there's nothing I can find on the web. Commented Jun 2, 2024 at 8:51
  • 1
    The only likely way would be building it from source yourself. There might be instructions for that somewhere if you search around. Commented Jun 2, 2024 at 10:14

1 Answer 1

1

So, I'm pretty new to C++ (I usually use Python), and all I needed to do was build from the source.

Please see here for instructions for building ArrayFire from the source (with Linux, other platforms can also be found in the wiki).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.