Merge pull request #5 from XSShawnZeng/tegra_samples_cmake_transition

Tegra samples cmake transition for cudaNvSci and cuDLA samples
This commit is contained in:
Rob Armstrong 2025-01-08 09:03:13 -08:00 committed by GitHub
commit e8492d1a78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 343 additions and 0 deletions

View File

@ -1,3 +1,10 @@
add_subdirectory(cudaNvSci)
add_subdirectory(cuDLAErrorReporting)
add_subdirectory(cuDLAHybridMode)
add_subdirectory(cuDLALayerwiseStatsHybrid)
add_subdirectory(cuDLALayerwiseStatsStandalone)
add_subdirectory(cuDLAStandaloneMode)
add_subdirectory(fluidsGLES)
add_subdirectory(nbody_opengles)
add_subdirectory(nbody_screen)
add_subdirectory(simpleGLES)

View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cuDLAErrorReporting LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CUDLA_LIB)
# Source file
# Add target for cuDLAErrorReporting
add_executable(cuDLAErrorReporting main.cu)
target_compile_options(cuDLAErrorReporting PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cuDLAErrorReporting PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cuDLAErrorReporting PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cuDLAErrorReporting PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
)
target_link_libraries(cuDLAErrorReporting
${CUDLA_LIB}
)
else()
message(STATUS "CUDLA not found - will not build sample 'cuDLAErrorReporting'")
endif()
else()
message(STATUS "Will not build sample cuDLAErrorReporting - requires Linux OS")
endif()

View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cuDLAHybridMode LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CUDLA_LIB)
# Source file
# Add target for cuDLAHybridMode
add_executable(cuDLAHybridMode main.cu)
target_compile_options(cuDLAHybridMode PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cuDLAHybridMode PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cuDLAHybridMode PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cuDLAHybridMode PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
)
target_link_libraries(cuDLAHybridMode
${CUDLA_LIB}
)
else()
message(STATUS "CUDLA not found - will not build sample 'cuDLAHybridMode'")
endif()
else()
message(STATUS "Will not build sample cuDLAHybridMode - requires Linux OS")
endif()

View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cuDLALayerwiseStatsHybrid LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CUDLA_LIB)
# Source file
# Add target for cuDLALayerwiseStatsHybrid
add_executable(cuDLALayerwiseStatsHybrid main.cu)
target_compile_options(cuDLALayerwiseStatsHybrid PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cuDLALayerwiseStatsHybrid PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cuDLALayerwiseStatsHybrid PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cuDLALayerwiseStatsHybrid PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
)
target_link_libraries(cuDLALayerwiseStatsHybrid
${CUDLA_LIB}
)
else()
message(STATUS "CUDLA not found - will not build sample 'cuDLALayerwiseStatsHybrid'")
endif()
else()
message(STATUS "Will not build sample cuDLALayerwiseStatsHybrid - requires Linux OS")
endif()

View File

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cuDLALayerwiseStatsStandalone LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CUDLA_LIB)
# Find the NVSCI libraries
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
file(GLOB_RECURSE NVSCIBUF_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscibuf.so
)
file(GLOB_RECURSE NVSCISYNC_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscisync.so
)
# Find the NVSCI header files
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
# Source file
# Add target for cuDLALayerwiseStatsStandalone
add_executable(cuDLALayerwiseStatsStandalone main.cpp)
target_compile_options(cuDLALayerwiseStatsStandalone PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cuDLALayerwiseStatsStandalone PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cuDLALayerwiseStatsStandalone PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cuDLALayerwiseStatsStandalone PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
${NVSCIBUF_INCLUDE_DIR}
${NVSCISYNC_INCLUDE_DIR}
)
target_link_libraries(cuDLALayerwiseStatsStandalone
${CUDLA_LIB}
${NVSCIBUF_LIB}
${NVSCISYNC_LIB}
)
else()
message(STATUS "NvSCI not found - will not build sample 'cuDLALayerwiseStatsStandalone'")
endif()
else()
message(STATUS "CUDLA not found - will not build sample 'cuDLALayerwiseStatsStandalone'")
endif()
else()
message(STATUS "Will not build sample cuDLALayerwiseStatsStandalone - requires Linux OS")
endif()

View File

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cuDLAStandaloneMode LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
find_library(CUDLA_LIB cudla PATHS ${CUDAToolkit_LIBRARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CUDLA_LIB)
# Find the NVSCI libraries
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
file(GLOB_RECURSE NVSCIBUF_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscibuf.so
)
file(GLOB_RECURSE NVSCISYNC_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscisync.so
)
# Find the NVSCI header files
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
# Source file
# Add target for cuDLAStandaloneMode
add_executable(cuDLAStandaloneMode main.cpp)
target_compile_options(cuDLAStandaloneMode PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cuDLAStandaloneMode PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cuDLAStandaloneMode PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cuDLAStandaloneMode PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
${NVSCIBUF_INCLUDE_DIR}
${NVSCISYNC_INCLUDE_DIR}
)
target_link_libraries(cuDLAStandaloneMode
${CUDLA_LIB}
${NVSCIBUF_LIB}
${NVSCISYNC_LIB}
)
else()
message(STATUS "NvSCI not found - will not build sample 'cuDLAStandaloneMode'")
endif()
else()
message(STATUS "CUDLA not found - will not build sample 'cuDLAStandaloneMode'")
endif()
else()
message(STATUS "Will not build sample cuDLAStandaloneMode - requires Linux OS")
endif()

View File

@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(cudaNvSci LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED)
set(CMAKE_CUDA_ARCHITECTURES 53 61 70 72 75 80 86 87 90)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (expensive)
endif()
# Include directories and libraries
include_directories(../../../../Common)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Find the NVSCI libraries
# use CMAKE_LIBRARY_PATH so that users can also specify the NVSCI lib path in cmake command
set(CMAKE_LIBRARY_PATH "/usr/lib" ${CMAKE_LIBRARY_PATH})
file(GLOB_RECURSE NVSCIBUF_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscibuf.so
)
file(GLOB_RECURSE NVSCISYNC_LIB
${CMAKE_LIBRARY_PATH}/*/libnvscisync.so
)
# Find the NVSCI header files
# use CMAKE_INCLUDE_PATH so that users can also specify the NVSCI include path in cmake command
set(CMAKE_INCLUDE_PATH "/usr/include" ${CMAKE_LIBRARY_PATH})
find_path(NVSCIBUF_INCLUDE_DIR nvscibuf.h PATHS ${CMAKE_INCLUDE_PATH})
find_path(NVSCISYNC_INCLUDE_DIR nvscisync.h PATHS ${CMAKE_INCLUDE_PATH})
if(NVSCIBUF_LIB AND NVSCISYNC_LIB AND NVSCIBUF_INCLUDE_DIR AND NVSCISYNC_INCLUDE_DIR)
message(STATUS "FOUND NVSCI libs: ${NVSCIBUF_LIB} ${NVSCISYNC_LIB}")
message(STATUS "Using NVSCI headers path: ${NVSCIBUF_INCLUDE_DIR} ${NVSCIBUF_INCLUDE_DIR}")
# Source file
# Add target for cudaNvSci
add_executable(cudaNvSci imageKernels.cu cudaNvSci.cpp main.cpp)
target_compile_options(cudaNvSci PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--extended-lambda>)
target_compile_features(cudaNvSci PRIVATE cxx_std_17 cuda_std_17)
set_target_properties(cudaNvSci PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(cudaNvSci PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
${NVSCIBUF_INCLUDE_DIR}
${NVSCISYNC_INCLUDE_DIR}
)
target_link_libraries(cudaNvSci
CUDA::cuda_driver
${NVSCIBUF_LIB}
${NVSCISYNC_LIB}
)
# Copy teapot1024.ppm to the output directory
add_custom_command(TARGET cudaNvSci POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/teapot1024.ppm ${CMAKE_CURRENT_BINARY_DIR}/teapot1024.ppm
)
# Specify additional clean files
set_target_properties(cudaNvSci PROPERTIES
ADDITIONAL_CLEAN_FILES "teapot1024_out.ppm"
)
else()
message(STATUS "NvSCI not found - will not build sample 'cudaNvSci'")
endif()
else()
message(STATUS "Will not build sample cudaNvSci - requires Linux OS")
endif()