diff --git a/.gitignore b/.gitignore index cf9bc3b1..2c315a33 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build -.vs \ No newline at end of file +.vs +.clangd diff --git a/Samples/0_Introduction/simpleTexture/CMakeLists.txt b/Samples/0_Introduction/simpleTexture/CMakeLists.txt index 7b886211..d200e6a8 100644 --- a/Samples/0_Introduction/simpleTexture/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTexture/CMakeLists.txt @@ -25,3 +25,17 @@ target_compile_options(simpleTexture PRIVATE $<$:--extend target_compile_features(simpleTexture PRIVATE cxx_std_17 cuda_std_17) set_target_properties(simpleTexture PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + +# Copy data files to output directory +add_custom_command(TARGET simpleTexture POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/teapot512.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET simpleTexture POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_rotated.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) diff --git a/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt b/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt index 2f4571be..73b21adc 100644 --- a/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt +++ b/Samples/0_Introduction/simpleTextureDrv/CMakeLists.txt @@ -43,6 +43,20 @@ add_custom_command( COMMENT "Building CUDA fatbin: ${CUDA_FATBIN_FILE}" ) +# Copy data files to output directory +add_custom_command(TARGET simpleTextureDrv POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/teapot512.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET simpleTextureDrv POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_rotated.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + # Create a dummy target for fatbin generation add_custom_target(generate_fatbin_textureDrv ALL DEPENDS ${CUDA_FATBIN_FILE}) diff --git a/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt index b2c3ecbd..db955c66 100644 --- a/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/boxFilter/CMakeLists.txt @@ -47,3 +47,24 @@ target_compile_features(boxFilter PRIVATE cxx_std_17 cuda_std_17) else() message(STATUS "OpenGL not found - will not build sample 'boxFilter'") endif() + +# Copy data files to output directory +add_custom_command(TARGET boxFilter POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/teapot1024.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET boxFilter POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_14.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET boxFilter POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_22.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt index 230b5077..7b17c6d9 100644 --- a/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/dct8x8/CMakeLists.txt @@ -36,3 +36,17 @@ add_custom_command(TARGET dct8x8 POST_BUILD ${REF_DATA} ${CMAKE_CURRENT_BINARY_DIR} ) + +# Copy data files to output directory +add_custom_command(TARGET dct8x8 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/teapot512.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET dct8x8 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/teapot512.bmp + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt index 337ddbd3..f7c967d0 100644 --- a/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/eigenvalues/CMakeLists.txt @@ -25,3 +25,24 @@ target_compile_options(eigenvalues PRIVATE $<$:--extended target_compile_features(eigenvalues PRIVATE cxx_std_17 cuda_std_17) set_target_properties(eigenvalues PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + +# Copy data files to output directory +add_custom_command(TARGET eigenvalues POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/diagonal.dat + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET eigenvalues POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/superdiagonal.dat + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET eigenvalues POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/reference.dat + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt b/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt index 47f55584..f256f6ac 100644 --- a/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt +++ b/Samples/2_Concepts_and_Techniques/segmentationTreeThrust/CMakeLists.txt @@ -25,3 +25,24 @@ target_compile_options(segmentationTreeThrust PRIVATE $<$ target_compile_features(segmentationTreeThrust PRIVATE cxx_std_17 cuda_std_17) set_target_properties(segmentationTreeThrust PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + +# Copy data files to output directory +add_custom_command(TARGET segmentationTreeThrust POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/test.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET segmentationTreeThrust POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_00.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET segmentationTreeThrust POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/data/ref_09.ppm + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt index 0ec14721..4b77a5e5 100644 --- a/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/freeImageInteropNPP/CMakeLists.txt @@ -47,3 +47,10 @@ target_compile_features(freeImageInteropNPP PRIVATE cxx_std_17 cuda_std_17) else() message(STATUS "FreeImage not found - will not build sample 'freeImageInteropNPP'") endif() + +# Copy data files to output directory +add_custom_command(TARGET freeImageInteropNPP POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/data/teapot512.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt index 9984a2a7..a3b4fd06 100644 --- a/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/histEqualizationNPP/CMakeLists.txt @@ -48,3 +48,10 @@ target_compile_features(histEqualizationNPP PRIVATE cxx_std_17 cuda_std_17) else() message(STATUS "FreeImage not found - will not build sample 'histEqualizationNPP'") endif() + +# Copy data files to output directory +add_custom_command(TARGET histEqualizationNPP POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/data/teapot512.pgm + ${CMAKE_CURRENT_BINARY_DIR}/ +) diff --git a/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt b/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt index 849105dc..c34d0c37 100644 --- a/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt +++ b/Samples/4_CUDA_Libraries/watershedSegmentationNPP/CMakeLists.txt @@ -35,3 +35,24 @@ target_link_libraries(watershedSegmentationNPP PRIVATE CUDA::nppif CUDA::cudart ) + +# Copy data files to output directory +add_custom_command(TARGET watershedSegmentationNPP POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/data/teapot_512x512_8u_Gray.raw + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET watershedSegmentationNPP POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/data/CT_skull_512x512_8u_Gray.raw + ${CMAKE_CURRENT_BINARY_DIR}/ +) + +# Copy data files to output directory +add_custom_command(TARGET watershedSegmentationNPP POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/../../../Common/data/Rocks_512x512_8u_Gray.raw + ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/README.md b/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/README.md index c704d6a8..3e1f3597 100644 --- a/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/README.md +++ b/Samples/8_Platform_Specific/Tegra/cudaNvSciBufMultiplanar/README.md @@ -33,32 +33,5 @@ cudaDeviceGetAttribute, cudaNvSciBufMultiplanar, cudaDestroyExternalMemory, cuDr Download and install the [CUDA Toolkit 12.8](https://developer.nvidia.com/cuda-downloads) for your corresponding platform. Make sure the dependencies mentioned in [Dependencies]() section above are installed. -## Build and Run - -### Linux -The Linux samples are built using makefiles. To use the makefiles, change the current directory to the sample directory you wish to build, and run make: -``` -$ cd -$ make -``` -The samples makefiles can take advantage of certain options: -* **TARGET_ARCH=** - cross-compile targeting a specific architecture. Allowed architectures are aarch64. - By default, TARGET_ARCH is set to HOST_ARCH. On a x86_64 machine, not setting TARGET_ARCH is the equivalent of setting TARGET_ARCH=x86_64.
-`$ make TARGET_ARCH=aarch64`
- See [here](http://docs.nvidia.com/cuda/cuda-samples/index.html#cross-samples) for more details. -* **dbg=1** - build with debug symbols - ``` - $ make dbg=1 - ``` -* **SMS="A B ..."** - override the SM architectures for which the sample will be built, where `"A B ..."` is a space-delimited list of SM architectures. For example, to generate SASS for SM 50 and SM 60, use `SMS="50 60"`. - ``` - $ make SMS="50 60" - ``` - -* **HOST_COMPILER=** - override the default g++ host compiler. See the [Linux Installation Guide](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements) for a list of supported host compilers. -``` - $ make HOST_COMPILER=g++ -``` - ## References (for more details) diff --git a/cmake/toolchains/toolchain-aarch64-qnx.cmake b/cmake/toolchains/toolchain-aarch64-qnx.cmake new file mode 100644 index 00000000..98e6f3d0 --- /dev/null +++ b/cmake/toolchains/toolchain-aarch64-qnx.cmake @@ -0,0 +1,80 @@ +#============================================================================== +# Toolchain file for cross-compiling to aarch64 QNX +#============================================================================== + +# Cross-compiling, so tell CMake that we are not building for the host system +set(CMAKE_SYSTEM_NAME QNX) + +# Target processor architecture +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +#------------------------------------------------------------------------------ +# QNX host and target come from environment +# Adjust these or hard-code paths as needed: +# +# set(QNX_HOST "/path/to/qnx/host") # e.g. /qnx/qnx710/host/linux/x86_64 +# set(QNX_TARGET "/path/to/qnx/target") # e.g. /qnx/qnx710/target/qnx7 +# +# You can also pass them on the cmake command line: +# cmake -D QNX_HOST=/path/to/qnx/host \ +# -D QNX_TARGET=/path/to/qnx/target \ +# -DCMAKE_TOOLCHAIN_FILE=toolchain-aarch64-qnx.cmake .. +#------------------------------------------------------------------------------ + +#---------------------------------------------------------------------------- +# C/C++ Compilers from QNX +#---------------------------------------------------------------------------- +find_program(QNX_QCC NAMES qcc PATHS "${QNX_HOST}/usr/bin") +find_program(QNX_QPLUS NAMES q++ PATHS "${QNX_HOST}/usr/bin") + +if(NOT QNX_QCC OR NOT QNX_QPLUS) + message(FATAL_ERROR "Could not find qcc or q++ in QNX_HOST=${QNX_HOST}/usr/bin") +endif() + +set(CMAKE_C_COMPILER "${QNX_QCC}") +set(CMAKE_CXX_COMPILER "${QNX_QPLUS}") + +#---------------------------------------------------------------------------- +# Sysroot (if you want CMake to know the default sysroot) +#---------------------------------------------------------------------------- +# This is optional, but convenient if the QNX headers/libraries must be found: +#---------------------------------------------------------------------------- +if(DEFINED QNX_TARGET) + set(CMAKE_SYSROOT "${QNX_TARGET}") +endif() + +#---------------------------------------------------------------------------- +# Additional preprocessor definitions & include paths +#---------------------------------------------------------------------------- +add_compile_options( + -D_QNX_SOURCE + -DWIN_INTERFACE_CUSTOM +) + +# Add an include path to /usr/include/aarch64-qnx-gnu: +include_directories("/usr/include/aarch64-qnx-gnu") + +#---------------------------------------------------------------------------- +# Linker flags +#---------------------------------------------------------------------------- +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/lib/aarch64-qnx-gnu") + +# Because the Makefile also adds -Wl,-rpath-link,/usr/lib/aarch64-qnx-gnu: +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,/usr/lib/aarch64-qnx-gnu") + +# If you have a “target filesystem” (TARGET_FS) to link with: +# -L$(TARGET_FS)/usr/lib +# -L$(TARGET_FS)/usr/libnvidia +# etc., you can optionally extend the link flags. For example: +# +# if(DEFINED TARGET_FS) +# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \ +# -L${TARGET_FS}/usr/lib -Wl,-rpath-link,${TARGET_FS}/usr/lib \ +# -L${TARGET_FS}/usr/libnvidia -Wl,-rpath-link,${TARGET_FS}/usr/libnvidia") +# include_directories("${TARGET_FS}/../include") +# endif() + +# If you need to link additional libraries, e.g. -lslog2 under certain conditions: +# list(APPEND EXTRA_LIBS "slog2") +# ... +#----------------------------------------------------------------------------