compute-sanitizer --tool memcheck my_cuda_program is what I am trying to do.
I am trying this because I got
Thread 1 my_cuda_program received signal CUDA_EXCEPTION_5, Warp Out-of-range Address. when I ran my program via cuda-gdb.
However, I get
========= COMPUTE-SANITIZER
========= Unable to find injection library libsanitizer-collection.so
this as a output. However, libsanitizer-collection.so exists in my /usr/lib/nvidia-cuda-toolkit.
My nvcc version is 12.4, which is why I am using compute sanitizer. I compile my program using cmake, which looks like this
cmake_minimum_required(VERSION 3.29.2)
project(nnbody VERSION 0.1.0 LANGUAGES CUDA CXX)
include(CTest)
enable_testing()
add_subdirectory(third-party/yaml-cpp)
enable_language(CUDA)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_60")
# check openmp
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else ()
message (FATAL_ERROR "The compiler does not support OpenMP.")
endif()
# check BLAS and LAPACK
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
find_package(FFTW3 REQUIRED)
set(VTK_DIR "/usr/local/include/vtk-9.3/")
find_package(VTK REQUIRED)
file(GLOB ALL_FILES_SRC
"src/*.cuh"
"src/*.cu"
"src/*.h"
"src/*.hpp"
"src/*.c"
"src/*.cpp"
)
set_source_files_properties(ALL_FILES_SRC LANGUAGE CUDA)
add_executable(nnbody ${ALL_FILES_SRC})
target_link_libraries(nnbody PRIVATE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${FFTW3_LIBRARIES} ${VTK_LIBRARIES} yaml-cpp)
set_property(TARGET nnbody PROPERTY CUDA_ARCHITECTURES 60 86)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
I don't know what to try..
/usr/lib/nvidia-cuda-toolkittoLD_LIBRARY_PATH?bin, where thecompute-sanitizertool would be found. Another subdirectory is, you guessed it,compute-sanitizer. In that subdirectory is where the compute sanitizer tool will look for the libraries it needs. If you have those libraries in/usr/lib/nvidia-cuda-toolkit(presumably perhaps your CUDA root directory) that is not the right place.libsanitizer-collection.sodirectly under that path or is it in something like/usr/lib/nvidia-cuda-toolkit/lib? How did you install the Toolkit?