Giter Site home page Giter Site logo

CMAKE with RAJA CUDA backend about raja HOT 4 CLOSED

yencal avatar yencal commented on August 25, 2024
CMAKE with RAJA CUDA backend

from raja.

Comments (4)

yencal avatar yencal commented on August 25, 2024 1

@davidbeckingsale. Thanks for the suggestions. I had to add set(CMAKE_CUDA_HOST_COMPILER gcc) and set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda") in addition to your suggestions to get it working.

Here is the final CMakeLists.txt that worked for me.

cmake_minimum_required(VERSION 3.17)
set(CMAKE_CXX_STANDARD 17) 
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

set(THIS raja-example)

project(${THIS})
enable_language(CUDA)
set(CMAKE_CUDA_HOST_COMPILER gcc)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")

if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)

find_package(RAJA REQUIRED)

set(SOURCE main.cpp)
set_source_files_properties(${SOURCE} PROPERTIES LANGUAGE CUDA)
add_executable(${THIS} ${SOURCE})

target_link_libraries(${THIS} PRIVATE RAJA)

I used cmake ../ and found that -DENABLE_CUDA=ON did nothing.

from raja.

rhornung67 avatar rhornung67 commented on August 25, 2024

How did you run CMake to configure the build for your project? Did you pass -DENABLE_CUDA=On?

from raja.

yencal avatar yencal commented on August 25, 2024

@rhornung67 thanks for the suggestion. However when I do cmake -DENABLE_CUDA=On ../, I get this warning from cmake

CMake Warning:
  Manually-specified variables were not used by the project:

    ENABLE_CUDA

If I go ahead and run make anyway, I get the same error:

/home/cyenusah/Project/hpc-heterogeneous-computing/src/daxpy/raja/raja_example/main.cpp: In function ‘int main(int, char**)’:
/home/cyenusah/Project/hpc-heterogeneous-computing/src/daxpy/raja/raja_example/main.cpp:37:24: error: ‘cuda_exec’ in namespace ‘RAJA’ does not name a template type
   37 |   using policy = RAJA::cuda_exec<256>;

from raja.

davidbeckingsale avatar davidbeckingsale commented on August 25, 2024

It looks like your example is using CUDA, so you will need to tell CMake to compile your main.cpp file with CUDA, e.g.:

set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA)

You will also need to add enable_language(CUDA) to your CMakeLists

from raja.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.