Skip to content

Instantly share code, notes, and snippets.

@songyuc
Created November 27, 2022 09:06
Show Gist options
  • Save songyuc/440ee96894867b104db4833a9e0d1a9a to your computer and use it in GitHub Desktop.
Save songyuc/440ee96894867b104db4833a9e0d1a9a to your computer and use it in GitHub Desktop.
CUDA
cmake_minimum_required(VERSION 3.23)
set(CMAKE_CUDA_COMPILER "/usr/local/cuda/bin/nvcc")
# NECESSARY: because we need to specify the CUDA_COMPILER explicitly.
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "75;80;86") # native is supported in version 3.24
endif ()
# Note: This variable is used to initialize the CUDA_ARCHITECTURES property on all targets.
project(Cuda_notes LANGUAGES CUDA CXX C)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
include_directories(SYSTEM "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
include_directories("${CMAKE_SOURCE_DIR}/cuda-samples/Common")
include_directories(.)
add_executable(Cuda_notes deviceQuery.cu)
target_link_libraries(Cuda_notes cudart)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment