Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use externally installed RAJA suite in CMake? #1559

Closed
pranav-sivaraman opened this issue Oct 20, 2023 · 1 comment
Closed

How to use externally installed RAJA suite in CMake? #1559

pranav-sivaraman opened this issue Oct 20, 2023 · 1 comment

Comments

@pranav-sivaraman
Copy link

pranav-sivaraman commented Oct 20, 2023

I am struggling to find any examples or documentation on how to use the RAJA suite if its externally installed. All the examples I find either use BLT or build RAJA while building the application.

Here is a simple CMake file.

cmake_minimum_required(VERSION 3.21)

project(saxpy VERSION 1.0 LANGUAGES CXX CUDA)

set(CMAKE_CXX_STANDARD 17)

find_package(RAJA REQUIRED)
find_package(Chai REQUIRED)
find_package(Umpire REQUIRED)

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -std=c++17 -forward-unknown-to-host-compiler -arch=sm_70 -extended-lambda -restrict -keep ${CUDA_EXTRA_FLAGS}")

add_executable(saxpy saxpy.cpp)
target_link_libraries(saxpy RAJA chai umpire)

set_source_files_properties(saxpy.cpp PROPERTIES
                                  	LANGUAGE CUDA)

set_target_properties(saxpy PROPERTIES
                        	CUDA_SEPERABLE_COMPILATION ON
                        	CUDA_STANDARD 17
                        	CUDA_STANDARD_REQUIRED ON)

However, I am getting the following error
/usr/bin/ld: cannot find -lcuda_runtime

These are the package specs I installed with Spack on Summit with CUDA 11.7

[email protected] ~openmp +cuda cuda_arch=70
[email protected] ~openmp +cuda cuda_arch=70
[email protected] ~openmp +cuda cuda_arch=70
[email protected] ~openmp +raja +cuda cuda_arch=70

Would greatly appreciate if I could get some help in the form of a minimal example CMake file for the CUDA/HIP backends.

@pranav-sivaraman
Copy link
Author

pranav-sivaraman commented Oct 27, 2023

Closing. Upon investigating the issue seems to be related to CHAI not RAJA or Umpire.

I am going to assume this is fixed for newer versions of CHAI, but if you are on older versions the following issue seems to fix the -lcuda_runtime issue.

get_target_property(chai_interface_libs chai INTERFACE_LINK_LIBRARIES)
list(REMOVE_ITEM chai_interface_libs cuda_runtime)
set_target_properties(chai PROPERTIES INTERFACE_LINK_LIBRARIES ${chai_interface_libs})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant