96 Commits
v12.9 ... v13.0

Author SHA1 Message Date
Rob Armstrong
3f1c509650 Merge branch 'shawnz_bug_fix' into 'master'
Update README with removing the old auto-linux part

See merge request cuda-samples/cuda-samples!127
2025-08-05 21:22:57 -07:00
Rob Armstrong
fbc40da311 Merge branch 'dev/mattd/update-simple-cc-check' into 'master'
[nvvm] Test the compute capability minor number prior to using the result value.

See merge request cuda-samples/cuda-samples!128
2025-08-04 11:06:48 -07:00
Matt Davis
1b36fefcd5 Test the compute capability minor number prior to using the result value. 2025-08-04 18:00:26 +00:00
shawnz
13c2fd9717 Update README with removing the old auto-linux part 2025-08-01 19:02:37 +08:00
Rob Armstrong
a5267b83a5 Merge branch 'shawnz_bug_fix' into 'master'
Bug 5412815: Fix the issue of cudaTensorCoreGemm.cu

See merge request cuda-samples/cuda-samples!125
2025-07-28 10:18:27 -07:00
Rob Armstrong
2ab16e6d15 Merge branch 'dev/mattd/r13-nvvm-update-master' into 'master'
Update compute capability checks to test for >=sm75.

See merge request cuda-samples/cuda-samples!126
2025-07-28 10:17:45 -07:00
Matt Davis
903c840a8c Update the README mentioning testing requires a compatible driver. 2025-07-25 12:40:16 +00:00
Matt Davis
24e7c5b428 Update compute capability tests to look for >=sm75. 2025-07-25 10:28:53 +00:00
shawnz
b38ed29c95 Bug 5412815: Fix the issue of cudaTensorCoreGemm.cu 2025-07-25 15:16:12 +08:00
Rob Armstrong
4a631c9fd6 Merge branch 'shawnz_bug_fix' into 'master'
Bug 5314090: Update README.md for Sample build from DriveOS Docker Container

See merge request cuda-samples/cuda-samples!123
2025-07-24 16:57:29 -07:00
shawnz
98afcd6515 Bug 5314090: Update README.md for Sample build for auto-linux from DriveOS Docker Container 2025-07-21 19:04:33 +08:00
Rob Armstrong
8013610840 Merge branch 'shawnz_bug_fix' into 'master'
Fix the FindNVSCI.cmake syntax error and the typo in README.md

See merge request cuda-samples/cuda-samples!119
2025-07-10 13:44:45 -07:00
shawnz
2369d4c649 Fix the FindNVSCI.cmake syntax error and the typo in README.md 2025-07-10 17:13:31 +08:00
Rob Armstrong
8433f89993 Globally remove VSCode tasks.json referencing obsolete build steps 2025-07-07 08:31:22 -07:00
Rob Armstrong
a9a4db666f Merge branch 'shawnz_bug_fix' into 'master'
Bug 5339530: Bug 4854664: Set socket creating folder to /tmp for QNX

See merge request cuda-samples/cuda-samples!118
2025-06-26 12:07:06 -07:00
shawnz
87d03ef003 Bug 5339530: Bug 4854664: Set socket creating folder to /tmp for QNX 2025-06-26 15:49:16 +08:00
Rob Armstrong
45314d7ff8 README formatting changes 2025-06-24 12:44:08 -07:00
Rob Armstrong
2f0a55d7dc Merge branch 'shawnz_qnx_crossbuild' into 'master'
Update QNX cross build tooltrain and CMakeLists.txt

See merge request cuda-samples/cuda-samples!116
2025-06-24 12:25:55 -07:00
shawnz
0d61031846 Bug 5355361: Update README.md of 7_libNVVM for forward compatibility sample build 2025-06-24 17:04:28 +08:00
shawnz
225f84d433 Bug 5295515: Update README.md for forward compatibility sample build 2025-06-18 16:17:46 +08:00
shawnz
e674cc36fe Bug 5339530: Set socket creating folder to /tmp for QNX 2025-06-13 16:34:40 +08:00
shawnz
a47b422205 Update CHANGELOG.md and README.md for QNX cross build 2025-06-11 16:33:30 +08:00
shawnz
ce28796d6c Bug 5189457: Disable -no-pie for hpc 2025-06-11 16:25:22 +08:00
shawnz
9424c15848 Bug 5331767: Specify sm list of cdp samples for QNX 2025-06-10 15:33:07 +08:00
shawnz
9075c50a3d Bug 5323034 and 5323144: Disable .rsp for linking as qcc doesn't support lib path with double quotes in .rsp on QNX 2025-06-10 15:21:29 +08:00
shawnz
de5fa98e6e Bug 5323118: Remove the -lpthread and -lrt which are not supported on QNX 2025-06-10 15:18:04 +08:00
shawnz
6c9e9d3cd2 Bug 5323163: Get correct cuda include path for finding header files 2025-06-10 15:15:56 +08:00
shawnz
7f5390cec3 Bug 5323124: Waive simpleAWBarrier on QNX 2025-06-10 15:14:33 +08:00
shawnz
5f6d46dfea Bug 5323018: Update the CMakeLists.txt and Common/helper_multiprocess.cpp of ptxjit and memMapIPCDrv for QNX cross build 2025-06-09 19:53:25 +08:00
shawnz
49307463b5 Bug 5133216: Add QNX tooltrain and cross build support 2025-05-29 16:57:28 +08:00
Rob Armstrong
9c0d5aaae6 Merge branch 'shawnz_bug_fix' into 'master'
Bug 5305842 and 5305854: Update CMakeLists for SBSA CUDA Toolkit support on aarch64-linux platforms

See merge request cuda-samples/cuda-samples!115
2025-05-28 08:26:16 -07:00
shawnz
74a9a08887 Bug 5305854: Update aarch64 toolchain for SBSA CUDA Toolkit support 2025-05-28 12:43:16 +08:00
shawnz
0d08748ffa Bug 5305842: Update CMakeLists.txt for cdp samples for sbsa CUDA Toolkit supporting on aarch64-linux platforms 2025-05-28 11:42:49 +08:00
Rob Armstrong
27f47634a0 Merge branch 'shawnz_bug_fix' into 'master'
Bug 5300528: Add MPI_C_LIBRARIES for user defined MPI path

See merge request cuda-samples/cuda-samples!114
2025-05-23 07:57:54 -07:00
shawnz
40d297dfe7 Bug 5300528: Add MPI_C_LIBRARIES for user defined MPI path 2025-05-23 14:47:55 +08:00
Rob Armstrong
20b90b5063 Merge public 12.9 changes into 13.0 dev 2025-05-22 11:45:07 -07:00
Rob Armstrong
8a9e2c830c Update 1_Utilities/README.md to redirect bandwidthTest to NVBandwidth (#371) 2025-05-22 11:43:14 -07:00
Rob Armstrong
61225e22f0 Remove erroneous CMAKE_MODULE_PATH from top-level CMakeLists.txt 2025-05-22 11:35:00 -07:00
Rob Armstrong
f47f06f077 Merge branch 'shawnz_bug_fix' into 'master'
Update the CMAKE_CUDA_ARCHITECTURES from 50 to 75 for Samples/7_libNVVM/cuda-c-linking

See merge request cuda-samples/cuda-samples!113
2025-05-22 08:16:44 -07:00
shawnz
0c78a3e0de Update the CMAKE_CUDA_ARCHITECTURES from 50 to 75 for Samples/7_libNVVM/cuda-c-linking 2025-05-22 15:52:51 +08:00
Rob Armstrong
8219570c15 Merge branch 'shawnz_bug_fix' into 'master'
Bug fix for 5280038, 5277193, 5281036 and 5294720

See merge request cuda-samples/cuda-samples!112
2025-05-21 10:51:12 -07:00
Rob Armstrong
fc88988f23 Merge public changes to internal ToT 2025-05-21 09:28:35 -07:00
Rob Armstrong
adacf1cffd Merge pull request #368 from XSShawnZeng/master
Update the vulkan headers include sequence and the transpose code format check
2025-05-21 09:27:13 -07:00
shawnz
3e631f467a Bug 5294720: Update GpuArch Cores and Name for SM103, 110 and 121 2025-05-21 14:16:48 +08:00
shawnz
1141dd7af4 Bug 5281036: Limit the register number of debug version for cdpAdvancedQuicksort 2025-05-20 14:47:44 +08:00
shawnz
da3b7a2b3c Update the vulkanImageCUDA/vulkanImageCUDA.cu for Windows headers 2025-05-19 17:43:08 +08:00
shawnz
5987a9e9fa Update transpose for code format check 2025-05-19 17:38:42 +08:00
shawnz
107f3f537f Update the include files sequence for vulkan samples on Windows 2025-05-19 17:38:22 +08:00
shawnz
c1b03b9f81 Bug 5277193: Remove the CUFFT_LICENSE_ERROR checking as it is deprecated since CUDA13.0 2025-05-16 11:21:07 +08:00
shawnz
ee0ee417c9 Update the sample list for API changes in CHANGELOG 2025-05-14 16:02:17 +08:00
shawnz
ebc1078379 Bug 5280038: Update cuda-c-linking as per CUDA 13.0 API change 2025-05-14 15:54:41 +08:00
Rob Armstrong
2861e78272 Merge branch 'peggyt_bug_fix' into 'master'
Bug 5056055: limit register usage to 128 per thread in debug mode

See merge request cuda-samples/cuda-samples!110
2025-05-12 08:55:45 -07:00
Rob Armstrong
494d598f86 Merge branch 'shawnz_bugs_fix' into 'master'
Shawnz bugs fix

See merge request cuda-samples/cuda-samples!111
2025-05-12 08:54:40 -07:00
shawnz
c6208f5897 Bug 5263330: Update CUFFT errors as per latest changes on CUDA 13.0 2025-05-12 15:39:08 +08:00
shawnz
8f33cc6094 Bug 5274280: Enable 8_Platform_Specific/Tegra/EGLSync_CUDAEvent_Interop 2025-05-12 15:02:31 +08:00
shawnz
2ec9cf394a Bug 5272236: Update the include file copy path as path changes on 13.0 2025-05-12 15:00:52 +08:00
Peggy Tian
770e433a9e Bug 5056055: limit register usage to 128 per thread in debug mode to comply with the maximum number of 32-bit registers per SM 2025-05-12 06:04:22 +00:00
Rob Armstrong
c6af90553e Merge branch 'master' into 'master'
Bug 5236593: Increase the pending kernel launch limit to 4096

See merge request cuda-samples/cuda-samples!109
2025-05-07 09:47:51 -07:00
Rob Armstrong
7989d1fcc8 Merge branch 'shawnz_bug_fix' into 'master'
Bug 5217339: Replace SM 101 with 110 for Thor

See merge request cuda-samples/cuda-samples!108
2025-05-07 09:46:41 -07:00
Peggy Tian
611008fa86 Bug 5236593: Increase the pending kernel launch limit to 4096 2025-05-07 17:38:52 +08:00
shawnz
bf628887f1 Bug 5217339: Replace SM 101 with 110 for Thor 2025-05-07 14:10:35 +08:00
Rob Armstrong
330dd8472f Merge external PR #363 2025-05-05 08:45:01 -07:00
Francesco Rizzi
b530f1cf42 Fix bug in 6_Performance/transpose: copy sharedmem kernel (#363)
Update kernel loop bounds handling, main loop data copy to avoid incorrect reuse of output results.

---------

Authored-by: Francesco Rizzi <francesco.rizzi@ng-analytics.com>
2025-05-05 08:43:23 -07:00
Rob Armstrong
8ee551c99a Udpate README for 13.0 2025-05-01 15:23:36 -07:00
Rob Armstrong
148014e709 Merge cuda_a_dev 13.0 changes to master 2025-05-01 15:22:40 -07:00
Rob Armstrong
f2645c5df8 Final merge of 12.9 changes into cuda_a_dev 2025-05-01 09:55:03 -07:00
Rob Armstrong
9ac81370fa Update 12.9 changes from 'master' into 'cuda_a_dev' 2025-04-30 09:48:21 -07:00
Rob Armstrong
93cafa8fe9 Update 12.9 changes from 'master' into 'cuda_a_dev' 2025-04-21 09:22:29 -07:00
Rob Armstrong
1627e96677 Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Bug 5196362: Update parameters of cuCtxCreate for vectorAddMMAP

See merge request cuda-samples/cuda-samples!105
2025-04-17 09:29:53 -07:00
shawnz
7e90d36120 Bug 5196362: Update parameters of cuCtxCreate for vectorAddMMAP 2025-04-17 10:53:03 +08:00
Rob Armstrong
9e50fdc01f Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Bug 5214721: Correct the path of nvvm64_40_0.dll

See merge request cuda-samples/cuda-samples!104
2025-04-15 09:55:49 -07:00
shawnz
2c0b36a967 Bug 5214721: Correct the path of nvvm64_40_0.dll 2025-04-15 14:27:58 +08:00
Rob Armstrong
83397dc811 Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Udpate CHANGELOG.md  and nvvm64_40_0.dll for CUDA 13.0.

See merge request cuda-samples/cuda-samples!103
2025-04-14 09:48:09 -07:00
shawnz
640b566412 Bug 5214721: Update path for nvvm64_40_0.dll on CUDA 13.0 2025-04-14 16:34:24 +08:00
shawnz
da24673a9f Update CHANGELOG.md for CUDA 13.0 changes 2025-04-14 16:33:12 +08:00
Rob Armstrong
bded2585a4 Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Change for fixing Bug 5196362, 5184356, 5212196, 5214258 and 5214259

See merge request cuda-samples/cuda-samples!102
2025-04-11 07:07:55 -07:00
shawnz
5384563c57 Remove SM < 75 for cudaNvSci 2025-04-11 15:06:52 +08:00
shawnz
01a62e2bc0 Bug 5184356: Update the computeMode for remaining 3 samples 2025-04-11 10:40:35 +08:00
shawnz
02fdb070ad Bug 5196362, 5184356, 5212196, 5214258 and 5214259: Update sameples for CUDA13.0 API changes 2025-04-10 18:27:18 +08:00
Rob Armstrong
278f4adbd2 Merge branch 'master' into cuda_a_dev 2025-04-09 08:33:37 -07:00
Rob Armstrong
d00076a7c1 Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Bug 5163983: Remove SM < 75 in CMakeLists.txt of some samples

See merge request cuda-samples/cuda-samples!101
2025-04-09 08:29:42 -07:00
shawnz
4672b8ba2b Bug 5163983: Remove SM < 75 in CMakeLists.txt of some samples 2025-04-09 15:10:40 +08:00
Rob Armstrong
56e669e2e4 Merge branch 'shawnz_bugs_fix_cuda_a_dev' into 'cuda_a_dev'
Bug 5163983: Remove SM < 75 in CMakeLists.txt of some samples

See merge request cuda-samples/cuda-samples!99
2025-04-03 01:16:47 -07:00
shawnz
a1b5a6f6e3 Bug 5163983: Remove SM < 75 in CMakeLists.txt of some samples 2025-04-03 15:51:59 +08:00
Rob Armstrong
a4fba501a6 Merge branch 'master' into cuda_a_dev 2025-04-02 08:40:31 -07:00
Rob Armstrong
89789bd848 Merge branch 'master' into cuda_a_dev 2025-03-28 15:16:45 -07:00
Rob Armstrong
8f6b189dae Merge test script into 13.0 branch 2025-03-28 15:07:39 -07:00
Rob Armstrong
69522dd5b7 CUDA 13.0 removes support for Maxwell, Pascal, and Volta architecture offline compilation 2025-03-27 10:43:00 -07:00
Rob Armstrong
eddc6fd7e1 Merge branch 'master' into cuda_a_dev 2025-03-27 10:38:16 -07:00
Rob Armstrong
7ceb3122fc Merge branch 'master' into cuda_a_dev 2025-03-26 10:20:59 -07:00
Rob Armstrong
62781dc15e Merge branch 'master' into cuda_a_dev 2025-03-08 08:32:28 -08:00
Rob Armstrong
3f97ef1288 Merge branch 'master' into 'cuda_a_dev'
graphConditionalNodes: Change launch dimension initialization for better cross-platform compatibility (#346)

See merge request cuda-samples/cuda-samples!93
2025-03-05 18:25:17 -08:00
Rob Armstrong
408c9f69a8 graphConditionalNodes: Change launch dimension initialization for better cross-platform compatibility (#346) 2025-03-05 18:25:17 -08:00
Rob Armstrong
5df07f114e graphConditionalNodes: Change launch dimension initialization for better cross-platform compatibility (#346) 2025-03-05 08:38:55 -08:00
Shawn Zeng
541e9fc3f5 Update file CMakeLists.txt
(cherry picked from commit 9adce9d9f2)

Co-authored-by: Shawn Zeng <shawnz@nvidia.com>
2025-03-03 19:42:45 -08:00
Shawn Zeng
b6f3b7add9 graphConditionalNodes: Add switch, while, if/else conditional examples and minor cleanup (#344)
(cherry picked from commit bcad2c9e61)

Co-authored-by: Rob Armstrong <roarmstrong@nvidia.com>
2025-03-03 19:03:48 -08:00
436 changed files with 868 additions and 3346 deletions

View File

@@ -1,5 +1,84 @@
## Changelog ## Changelog
### CUDA 13.0
* Updated the samples using the cudaDeviceProp fields which are deprecated and removed in CUDA 13.0, replacing the fields with the equivalents in "cudaDeviceGetAttribute":
* Deprecated "cudaDeviceProp" fields
`int clockRate; // - Replaced with "cudaDevAttrClockRate"`
`int deviceOverlap; // - Replaced with "cudaDevAttrGpuOverlap */`
`int kernelExecTimeoutEnabled; // - Replaced with "cudaDevAttrKernelExecTimeout`
`int computeMode; // - Replaced with "cudaDevAttrComputeMode" */`
`int memoryClockRate; // - Replaced with "cudaDevAttrMemoryClockRate"`
`int cooperativeMultiDeviceLaunch; // - Deprecated, cudaLaunchCooperativeKernelMultiDevice is deprecated.`
* `0_Introduction`
* `UnifiedMemoryStreams`
* `simpleHyperQ`
* `simpleIPC`
* `simpleMultiCopy`
* `systemWideAtomics`
* `1_Utilitie`
* `deviceQuery`
* `2_Concepts_and_Techniques`
* `streamOrderedAllocationIPC`
* `4_CUDA_Libraries`
* `simpleCUBLASXT`
* `5_Domain_Specific`
* `simpleVulkan`
* `vulkanImageCUDA`
* Updated the samples using the CUDA driver API "cuCtxCreate" with adding the parameter "CUctxCreateParams" as "cuCtxCreate" is updated to "cuCtxCreate_v4" by default in CUDA 13.0:
* `Common`
* `nvrtc_helper.h`
* `0_Introduction`
* `UnifiedMemoryStreams`
* `matrixMulDrv`
* `simpleTextureDrv`
* `vectorAddDrv`
* `vectorAddMMAP`
* `2_Concepts_and_Techniques`
* `EGLStream_CUDA_CrossGPU`
* `EGLStream_CUDA_Interop`
* `threadMigration`
* `3_CUDA_Features`
* `graphMemoryFootprint`
* `memMapIPCDrv`
* `4_CUDA_Libraries`
* `jitLto`
* `7_libNVVM`
* `cuda-c-linking`
* `device-side-launch`
* `simple`
* `uvmlite`
* `8_Platform_Specific/Tegra`
* `EGLSync_CUDAEvent_Interop`
* Updated the sample using CUDA API "cudaGraphAddNode"/"cudaStreamGetCaptureInfo" with adding "cudaGraphEdgeData" pointer parameter as they are updated to "cudaGraphAddNode_v2"/"cudaStreamGetCaptureInfo_v3" by default in CUDA 13.0:
* `3_CUDA_Features`
* `graphConditionalNodes`
* Updated the samples using CUDA API "cudaMemAdvise"/"cudaMemPrefetchAsync" with changing the parameter "int device" to "cudaMemLocation location" as they are updated to "cudaMemAdvise_v2"/"cudaMemPrefetchAsyn_v2" by default in CUDA 13.0.
* `4_CUDA_Libraries`
* `conjugateGradientMultiDeviceCG`
* `6_Performance`
* `UnifiedMemoryPerf`
* Replaced "thrust::identity<uint>()" with "cuda::std::identity()" as it is deprecated in CUDA 13.0.
* `2_Concepts_and_Techniques`
* `segmentationTreeThrust`
* Updated the the headers file and samples for CUFFT error codes update.
* Deprecated CUFFT errors:
* `CUFFT_INCOMPLETE_PARAMETER_LIST`
* `CUFFT_PARSE_ERROR`
* `CUFFT_LICENSE_ERROR`
* New added CUFFT errors:
* `CUFFT_MISSING_DEPENDENCY`
* `CUFFT_NVRTC_FAILURE`
* `CUFFT_NVJITLINK_FAILURE`
* `CUFFT_NVSHMEM_FAILURE`
* Header files and samples that are related with this change:
* `Common/helper_cuda.h`
* `4_CUDA_Libraries`
* `simpleCUFFT`
* `simpleCUFFT_2d_MGPU`
* `simpleCUFFT_MGPU`
* `simpleCUFFT_callback`
* Updated toolchain for cross-compilation for Tegra QNX platforms.
### CUDA 12.9 ### CUDA 12.9
* Updated toolchain for cross-compilation for Tegra Linux platforms. * Updated toolchain for cross-compilation for Tegra Linux platforms.
* Added `run_tests.py` utility to exercise all samples. See README.md for details * Added `run_tests.py` utility to exercise all samples. See README.md for details

View File

@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/Modules")
project(cuda-samples LANGUAGES C CXX CUDA) project(cuda-samples LANGUAGES C CXX CUDA)
find_package(CUDAToolkit REQUIRED) find_package(CUDAToolkit REQUIRED)
@@ -14,7 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -138,26 +138,29 @@ static const char *_cudaGetErrorEnum(cufftResult error) {
case CUFFT_UNALIGNED_DATA: case CUFFT_UNALIGNED_DATA:
return "CUFFT_UNALIGNED_DATA"; return "CUFFT_UNALIGNED_DATA";
case CUFFT_INCOMPLETE_PARAMETER_LIST:
return "CUFFT_INCOMPLETE_PARAMETER_LIST";
case CUFFT_INVALID_DEVICE: case CUFFT_INVALID_DEVICE:
return "CUFFT_INVALID_DEVICE"; return "CUFFT_INVALID_DEVICE";
case CUFFT_PARSE_ERROR:
return "CUFFT_PARSE_ERROR";
case CUFFT_NO_WORKSPACE: case CUFFT_NO_WORKSPACE:
return "CUFFT_NO_WORKSPACE"; return "CUFFT_NO_WORKSPACE";
case CUFFT_NOT_IMPLEMENTED: case CUFFT_NOT_IMPLEMENTED:
return "CUFFT_NOT_IMPLEMENTED"; return "CUFFT_NOT_IMPLEMENTED";
case CUFFT_LICENSE_ERROR:
return "CUFFT_LICENSE_ERROR";
case CUFFT_NOT_SUPPORTED: case CUFFT_NOT_SUPPORTED:
return "CUFFT_NOT_SUPPORTED"; return "CUFFT_NOT_SUPPORTED";
case CUFFT_MISSING_DEPENDENCY:
return "CUFFT_MISSING_DEPENDENCY";
case CUFFT_NVRTC_FAILURE:
return "CUFFT_NVRTC_FAILURE";
case CUFFT_NVJITLINK_FAILURE:
return "CUFFT_NVJITLINK_FAILURE";
case CUFFT_NVSHMEM_FAILURE:
return "CUFFT_NVSHMEM_FAILURE";
} }
return "<unknown>"; return "<unknown>";
@@ -670,7 +673,10 @@ inline int _ConvertSMVer2Cores(int major, int minor) {
{0x90, 128}, {0x90, 128},
{0xa0, 128}, {0xa0, 128},
{0xa1, 128}, {0xa1, 128},
{0xa3, 128},
{0xb0, 128},
{0xc0, 128}, {0xc0, 128},
{0xc1, 128},
{-1, -1}}; {-1, -1}};
int index = 0; int index = 0;
@@ -722,7 +728,10 @@ inline const char* _ConvertSMVer2ArchName(int major, int minor) {
{0x90, "Hopper"}, {0x90, "Hopper"},
{0xa0, "Blackwell"}, {0xa0, "Blackwell"},
{0xa1, "Blackwell"}, {0xa1, "Blackwell"},
{0xa3, "Blackwell"},
{0xb0, "Blackwell"},
{0xc0, "Blackwell"}, {0xc0, "Blackwell"},
{0xc1, "Blackwell"},
{-1, "Graphics Device"}}; {-1, "Graphics Device"}};
int index = 0; int index = 0;

View File

@@ -118,7 +118,10 @@ inline int _ConvertSMVer2CoresDRV(int major, int minor) {
{0x90, 128}, {0x90, 128},
{0xa0, 128}, {0xa0, 128},
{0xa1, 128}, {0xa1, 128},
{0xa3, 128},
{0xb0, 128},
{0xc0, 128}, {0xc0, 128},
{0xc1, 128},
{-1, -1}}; {-1, -1}};
int index = 0; int index = 0;

View File

@@ -185,25 +185,30 @@ int ipcCreateSocket(ipcHandle *&handle, const char *name,
return -1; return -1;
} }
unlink(name); char path_name[50];
bzero(&servaddr, sizeof(servaddr));
// Create unique name for the socket with path if SOCK_FOLDER is set.
sprintf(path_name, "%s%u", SOCK_FOLDER, getpid());
unlink(path_name);
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sun_family = AF_UNIX; servaddr.sun_family = AF_UNIX;
size_t len = strlen(name); size_t len = strlen(path_name);
if (len > (sizeof(servaddr.sun_path) - 1)) { if (len > (sizeof(servaddr.sun_path) - 1)) {
perror("IPC failure: Cannot bind provided name to socket. Name too large"); perror("IPC failure: Cannot bind provided name to socket. Name too large");
return -1; return -1;
} }
strncpy(servaddr.sun_path, name, len); strncpy(servaddr.sun_path, path_name, len);
if (bind(server_fd, (struct sockaddr *)&servaddr, SUN_LEN(&servaddr)) < 0) { if (bind(server_fd, (struct sockaddr *)&servaddr, SUN_LEN(&servaddr)) < 0) {
perror("IPC failure: Binding socket failed"); perror("IPC failure: Binding socket failed");
return -1; return -1;
} }
handle->socketName = new char[strlen(name) + 1]; handle->socketName = new char[strlen(path_name) + 1];
strcpy(handle->socketName, name); strcpy(handle->socketName, path_name);
handle->socket = server_fd; handle->socket = server_fd;
return 0; return 0;
} }
@@ -220,12 +225,12 @@ int ipcOpenSocket(ipcHandle *&handle) {
return -1; return -1;
} }
bzero(&cliaddr, sizeof(cliaddr)); memset(&cliaddr, 0, sizeof(cliaddr));
cliaddr.sun_family = AF_UNIX; cliaddr.sun_family = AF_UNIX;
char temp[10]; char temp[50];
// Create unique name for the socket. // Create unique name for the socket with path if SOCK_FOLDER is set.
sprintf(temp, "%u", getpid()); sprintf(temp, "%s%u", SOCK_FOLDER, getpid());
strcpy(cliaddr.sun_path, temp); strcpy(cliaddr.sun_path, temp);
if (bind(sock, (struct sockaddr *)&cliaddr, sizeof(cliaddr)) < 0) { if (bind(sock, (struct sockaddr *)&cliaddr, sizeof(cliaddr)) < 0) {
@@ -326,7 +331,7 @@ int ipcSendDataToServer(ipcHandle *handle, const char *serverName,
ssize_t sendResult; ssize_t sendResult;
struct sockaddr_un serveraddr; struct sockaddr_un serveraddr;
bzero(&serveraddr, sizeof(serveraddr)); memset(&serveraddr, 0, sizeof(serveraddr));
serveraddr.sun_family = AF_UNIX; serveraddr.sun_family = AF_UNIX;
strncpy(serveraddr.sun_path, serverName, sizeof(serveraddr.sun_path) - 1); strncpy(serveraddr.sun_path, serverName, sizeof(serveraddr.sun_path) - 1);
@@ -359,10 +364,10 @@ int ipcSendShareableHandle(ipcHandle *handle,
socklen_t len = sizeof(cliaddr); socklen_t len = sizeof(cliaddr);
// Construct client address to send this SHareable handle to // Construct client address to send this SHareable handle to
bzero(&cliaddr, sizeof(cliaddr)); memset(&cliaddr, 0, sizeof(cliaddr));
cliaddr.sun_family = AF_UNIX; cliaddr.sun_family = AF_UNIX;
char temp[10]; char temp[20];
sprintf(temp, "%u", process); sprintf(temp, "%s%u", SOCK_FOLDER, process);
strcpy(cliaddr.sun_path, temp); strcpy(cliaddr.sun_path, temp);
len = sizeof(cliaddr); len = sizeof(cliaddr);

View File

@@ -54,6 +54,13 @@
#endif #endif
#include <vector> #include <vector>
// Define "/tmp" as socket creating folder for QNX
#if defined(__QNX__)
#define SOCK_FOLDER "/tmp/"
#else
#define SOCK_FOLDER ""
#endif
typedef struct sharedMemoryInfo_st { typedef struct sharedMemoryInfo_st {
void *addr; void *addr;
size_t size; size_t size;

View File

@@ -187,6 +187,7 @@ CUmodule loadCUBIN(char *cubin, int argc, char **argv) {
CUcontext context; CUcontext context;
int major = 0, minor = 0; int major = 0, minor = 0;
char deviceName[256]; char deviceName[256];
CUctxCreateParams ctxCreateParams = {};
// Picks the best CUDA device available // Picks the best CUDA device available
CUdevice cuDevice = findCudaDeviceDRV(argc, (const char **)argv); CUdevice cuDevice = findCudaDeviceDRV(argc, (const char **)argv);
@@ -200,7 +201,7 @@ CUmodule loadCUBIN(char *cubin, int argc, char **argv) {
printf("> GPU Device has SM %d.%d compute capability\n", major, minor); printf("> GPU Device has SM %d.%d compute capability\n", major, minor);
checkCudaErrors(cuInit(0)); checkCudaErrors(cuInit(0));
checkCudaErrors(cuCtxCreate(&context, 0, cuDevice)); checkCudaErrors(cuCtxCreate(&context, &ctxCreateParams, 0, cuDevice));
checkCudaErrors(cuModuleLoadData(&module, cubin)); checkCudaErrors(cuModuleLoadData(&module, cubin));
free(cubin); free(cubin);

View File

@@ -1,6 +1,6 @@
# CUDA Samples # CUDA Samples
Samples for CUDA Developers which demonstrates features in CUDA Toolkit. This version supports [CUDA Toolkit 12.9](https://developer.nvidia.com/cuda-downloads). Samples for CUDA Developers which demonstrates features in CUDA Toolkit. This version supports [CUDA Toolkit 13.0](https://developer.nvidia.com/cuda-downloads).
## Release Notes ## Release Notes
@@ -115,29 +115,85 @@ make -j$(nproc)
``` ```
Transfer the built binaries to the Tegra device and execute them there. Transfer the built binaries to the Tegra device and execute them there.
### Building for Automotive Linux Platforms
These platforms require additional information to be passed to CMake on the command line to ensure proper resolution of all necessary include and library files. ### Cross Building for Automotive Linux Platforms from the DriveOS Docker containers
Instead of being in the default location, `/usr/local/cuda/include` or `/usr/local/cuda/lib64`, you must point to architecture-specific paths:
`/usr/local/cuda/<ARCH>/targets/aarch64-linux/lib` To build CUDA samples to the target platform from the DriveOS Docker containers, use the following instructions.
and
`/usr/local/cuda/<ARCH>/include`
An example build might look like this: Mount the target Root Filesystem (RFS) in the container so that the CUDA cmake process has the correct paths to CUDA and other system libraries required to build the samples.
Create a temporary directory, `<temp>` is any temporary directory of your choosing, for example, you can use `/drive/temp`:
```
$ mkdir /drive/<temp>
```
Mount the filesystem by running the following command:
```
$ mount /drive/drive-linux/filesystem/targetfs-images/dev_nsr_desktop_ubuntu-24.04_thor_rfs.img /drive/temp
```
Configure the project by running the following cmake command:
```
$ mkdir build && cd build
$ cmake .. -DBUILD_TEGRA=True \
-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/toolchain-aarch64-linux.cmake \
-DTARGET_FS=/drive/temp \
-DCMAKE_LIBRARY_PATH=/drive/temp/usr/local/cuda-13.0/thor/lib64/ \
-DCMAKE_INCLUDE_PATH=/drive/temp/usr/local/cuda-13.0/thor/include/
```
Please note that the following libraries are not pre-installed in the DriveOS dev-nsr target filesystem:
* libdrm-dev
* Vulkan
This causes the cmake command to throw errors related to the missing files, and as a result, the related samples will not build in later steps. This issue will be addressed in a future DriveOS release.
To build the samples with ignore the error mentioned above, you can use `--ignore-errors`/`--keep-going` or comment out the comment out the corresponding `add_subdirectory` command in the CMakeLists.txt in the parent folder for the samples requiring Vulkan and libdrm_dev:
```
$ make -j$(nproc) --ignore-errors # or --keep-going
```
```
# In Samples/5_Domain_Specific/CMakeList.txt
# add_subdirectory(simpleGL)
# add_subdirectory(simpleVulkan)
# add_subdirectory(simpleVulkanMMAP)
# In Samples/8_Platform_Specific/Tegra/CMakeList.txt
# add_subdirectory(simpleGLES_EGLOutput)
```
### QNX
Cross-compilation for QNX with CMake is supported in the CUDA 13.0 samples release and newer. An example build for
the Tegra Thor QNX platform might look like this:
``` ```
$ mkdir build $ mkdir build
$ cd build $ cd build
$ cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DCMAKE_LIBRARY_PATH=/usr/local/cuda/orin/lib64/ -DCMAKE_INCLUDE_PATH=/usr/local/cuda/orin/include -DBUILD_TEGRA=True .. QNX_HOST=/path/to/qnx/host \
QNX_TARGET=/path/to/qnx/target \
cmake .. \
-DBUILD_TEGRA=True \
-DCMAKE_CUDA_COMPILER=/usr/local/cuda-safe-13.0/bin/nvcc \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/toolchain-aarch64-qnx.cmake \
-DCMAKE_LIBRARY_PATH=/usr/local/cuda-safe-13.0/thor/targets/aarch64-qnx/lib/stubs/ \
-DCMAKE_INCLUDE_PATH=/usr/local/cuda-safe-13.0/thor/targets/aarch64-qnx/include/
``` ```
### QNX ### Forward Compatibility
Note that in the current branch sample cross-compilation for QNX is not fully validated. This placeholder will be updated in the To build samples with new CUDA Toolkit(CUDA 13.0 or later) and UMD(Version 580 or later) and old KMD(Version 550 or earlier),you need to set the `CMAKE_PREFIX_PATH` for using new driver library, the command might like this:
near future with QNX cross-compilation instructions. In the meantime, if you want to cross-compile for QNX please check out one
of the previous tags prior to the CMake build system transition in 12.8. ```
cmake -DCMAKE_PREFIX_PATH=/usr/local/cuda/lib64/stubs/ ..
```
## Running All Samples as Tests ## Running All Samples as Tests

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -19,6 +19,12 @@ endif()
# Include directories and libraries # Include directories and libraries
include_directories(../../../Common) include_directories(../../../Common)
# This sample is not supported on QNX
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
message(STATUS "Will not build sample ${PROJECT_NAME} - not supported on QNX")
return()
endif()
# Source file # Source file
if(CMAKE_GENERATOR MATCHES "Visual Studio") if(CMAKE_GENERATOR MATCHES "Visual Studio")
find_package(OpenMP REQUIRED C CXX) find_package(OpenMP REQUIRED C CXX)

View File

@@ -247,7 +247,9 @@ int main(int argc, char **argv)
exit(EXIT_WAIVED); exit(EXIT_WAIVED);
} }
if (device_prop.computeMode == cudaComputeModeProhibited) { int computeMode;
checkCudaErrors(cudaDeviceGetAttribute(&computeMode, cudaDevAttrComputeMode, dev_id));
if (computeMode == cudaComputeModeProhibited) {
// This sample requires being run with a default or process exclusive mode // This sample requires being run with a default or process exclusive mode
fprintf(stderr, fprintf(stderr,
"This sample requires a device in either default or process " "This sample requires a device in either default or process "

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
else() else()

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -46,6 +46,14 @@ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}")
endforeach() endforeach()
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(INCLUDES_LIST)
foreach(dir ${CUDAToolkit_INCLUDE_DIRS})
list(APPEND INCLUDES_LIST "-I${dir}")
endforeach()
string(JOIN " " INCLUDES "${INCLUDES_LIST}")
endif()
add_custom_command( add_custom_command(
OUTPUT ${CUDA_FATBIN_FILE} OUTPUT ${CUDA_FATBIN_FILE}
COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE}

View File

@@ -271,6 +271,7 @@ static int initCUDA(int argc, char **argv, CUfunction *pMatrixMul, int *blk_size
CUfunction cuFunction = 0; CUfunction cuFunction = 0;
int major = 0, minor = 0; int major = 0, minor = 0;
char deviceName[100]; char deviceName[100];
CUctxCreateParams ctxCreateParams = {};
cuDevice = findCudaDeviceDRV(argc, (const char **)argv); cuDevice = findCudaDeviceDRV(argc, (const char **)argv);
@@ -283,7 +284,7 @@ static int initCUDA(int argc, char **argv, CUfunction *pMatrixMul, int *blk_size
checkCudaErrors(cuDeviceTotalMem(&totalGlobalMem, cuDevice)); checkCudaErrors(cuDeviceTotalMem(&totalGlobalMem, cuDevice));
printf(" Total amount of global memory: %llu bytes\n", (long long unsigned int)totalGlobalMem); printf(" Total amount of global memory: %llu bytes\n", (long long unsigned int)totalGlobalMem);
checkCudaErrors(cuCtxCreate(&cuContext, 0, cuDevice)); checkCudaErrors(cuCtxCreate(&cuContext, &ctxCreateParams, 0, cuDevice));
// first search for the module path before we load the results // first search for the module path before we load the results
std::string module_path; std::string module_path;

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -31,12 +31,17 @@ set_target_properties(matrixMulDynlinkJIT PROPERTIES
CUDA_SEPARABLE_COMPILATION ON CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )
# Only add -no-pie for GCC or Clang
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
endif()
target_link_libraries(matrixMulDynlinkJIT PUBLIC target_link_libraries(matrixMulDynlinkJIT PUBLIC
CUDA::cudart CUDA::cudart
CUDA::cuda_driver CUDA::cuda_driver
) )
if(UNIX) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(matrixMulDynlinkJIT PUBLIC dl) target_link_libraries(matrixMulDynlinkJIT PUBLIC dl)
endif() endif()

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -32,23 +32,26 @@ target_link_libraries(matrixMul_nvrtc PRIVATE
CUDA::cuda_driver CUDA::cuda_driver
) )
# The primary directory of CUDAToolkit_INCLUDE_DIRS is the CUDA Toolkit's include directory for finding the header files.
list(GET CUDAToolkit_INCLUDE_DIRS 0 CUDA_INCLUDE_DIR)
# Copy clock_kernel.cu to the output directory # Copy clock_kernel.cu to the output directory
add_custom_command(TARGET matrixMul_nvrtc POST_BUILD add_custom_command(TARGET matrixMul_nvrtc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/matrixMul_kernel.cu ${CUDAToolkit_BIN_DIR}/../include/cooperative_groups.h ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/matrixMul_kernel.cu ${CUDA_INCLUDE_DIR}/cooperative_groups.h ${CMAKE_CURRENT_BINARY_DIR}
) )
add_custom_command(TARGET matrixMul_nvrtc POST_BUILD add_custom_command(TARGET matrixMul_nvrtc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${CUDAToolkit_BIN_DIR}/../include/cooperative_groups ${CMAKE_CURRENT_BINARY_DIR}/cooperative_groups ${CUDA_INCLUDE_DIR}/cooperative_groups ${CMAKE_CURRENT_BINARY_DIR}/cooperative_groups
) )
add_custom_command(TARGET matrixMul_nvrtc POST_BUILD add_custom_command(TARGET matrixMul_nvrtc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${CUDAToolkit_BIN_DIR}/../include/nv ${CMAKE_CURRENT_BINARY_DIR}/nv ${CUDA_INCLUDE_DIR}/cccl/nv ${CMAKE_CURRENT_BINARY_DIR}/nv
) )
add_custom_command(TARGET matrixMul_nvrtc POST_BUILD add_custom_command(TARGET matrixMul_nvrtc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${CUDAToolkit_BIN_DIR}/../include/cuda ${CMAKE_CURRENT_BINARY_DIR}/cuda ${CUDA_INCLUDE_DIR}/cccl/cuda ${CMAKE_CURRENT_BINARY_DIR}/cuda
) )

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
@@ -20,6 +20,12 @@ endif()
# Include directories and libraries # Include directories and libraries
include_directories(../../../Common) include_directories(../../../Common)
# This sample is not supported on QNX
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
message(STATUS "simpleAWBarrier is not supported on QNX")
return()
endif()
# Source file # Source file
# Add target for simpleAWBarrier # Add target for simpleAWBarrier
add_executable(simpleAWBarrier simpleAWBarrier.cu) add_executable(simpleAWBarrier simpleAWBarrier.cu)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -48,6 +48,14 @@ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}")
endforeach() endforeach()
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(INCLUDES_LIST)
foreach(dir ${CUDAToolkit_INCLUDE_DIRS})
list(APPEND INCLUDES_LIST "-I${dir}")
endforeach()
string(JOIN " " INCLUDES "${INCLUDES_LIST}")
endif()
add_custom_command( add_custom_command(
OUTPUT ${CUDA_FATBIN_FILE} OUTPUT ${CUDA_FATBIN_FILE}
COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE}

View File

@@ -86,13 +86,14 @@ int main(int argc, char **argv)
CUfunction vecAdd_kernel; CUfunction vecAdd_kernel;
CUmodule cuModule = 0; CUmodule cuModule = 0;
CUcontext cuContext; CUcontext cuContext;
CUctxCreateParams ctxCreateParams = {};
// Initialize // Initialize
checkCudaDrvErrors(cuInit(0)); checkCudaDrvErrors(cuInit(0));
cuDevice = findCudaDevice(argc, (const char **)argv); cuDevice = findCudaDevice(argc, (const char **)argv);
// Create context // Create context
checkCudaDrvErrors(cuCtxCreate(&cuContext, 0, cuDevice)); checkCudaDrvErrors(cuCtxCreate(&cuContext, &ctxCreateParams, 0, cuDevice));
// first search for the module path before we load the results // first search for the module path before we load the results
string module_path; string module_path;

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -127,6 +127,10 @@ int main(int argc, char **argv)
checkCudaErrors(cudaGetDevice(&cuda_device)); checkCudaErrors(cudaGetDevice(&cuda_device));
checkCudaErrors(cudaGetDeviceProperties(&deviceProp, cuda_device)); checkCudaErrors(cudaGetDeviceProperties(&deviceProp, cuda_device));
// Get device clock rate
int clockRate;
checkCudaErrors(cudaDeviceGetAttribute(&clockRate, cudaDevAttrClockRate, cuda_device));
// HyperQ is available in devices of Compute Capability 3.5 and higher // HyperQ is available in devices of Compute Capability 3.5 and higher
if (deviceProp.major < 3 || (deviceProp.major == 3 && deviceProp.minor < 5)) { if (deviceProp.major < 3 || (deviceProp.major == 3 && deviceProp.minor < 5)) {
if (deviceProp.concurrentKernels == 0) { if (deviceProp.concurrentKernels == 0) {
@@ -170,9 +174,9 @@ int main(int argc, char **argv)
#if defined(__arm__) || defined(__aarch64__) #if defined(__arm__) || defined(__aarch64__)
// the kernel takes more time than the channel reset time on arm archs, so to // the kernel takes more time than the channel reset time on arm archs, so to
// prevent hangs reduce time_clocks. // prevent hangs reduce time_clocks.
clock_t time_clocks = (clock_t)(kernel_time * (deviceProp.clockRate / 100)); clock_t time_clocks = (clock_t)(kernel_time * (clockRate / 100));
#else #else
clock_t time_clocks = (clock_t)(kernel_time * deviceProp.clockRate); clock_t time_clocks = (clock_t)(kernel_time * clockRate);
#endif #endif
clock_t total_clocks = 0; clock_t total_clocks = 0;

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -247,7 +247,9 @@ static void parentProcess(char *app)
} }
// This sample requires two processes accessing each device, so we need // This sample requires two processes accessing each device, so we need
// to ensure exclusive or prohibited mode is not set // to ensure exclusive or prohibited mode is not set
if (prop.computeMode != cudaComputeModeDefault) { int computeMode;
checkCudaErrors(cudaDeviceGetAttribute(&computeMode, cudaDevAttrComputeMode, i));
if (computeMode != cudaComputeModeDefault) {
printf("Device %d is in an unsupported compute mode for this sample\n", i); printf("Device %d is in an unsupported compute mode for this sample\n", i);
continue; continue;
} }

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -37,6 +37,7 @@ target_compile_features(simpleMPI PRIVATE cxx_std_17 cuda_std_17)
) )
target_link_libraries(simpleMPI PUBLIC target_link_libraries(simpleMPI PUBLIC
${MPI_C_LIBRARIES}
${MPI_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
) )

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -218,9 +218,11 @@ int main(int argc, char *argv[])
printf("\n"); printf("\n");
printf("Relevant properties of this CUDA device\n"); printf("Relevant properties of this CUDA device\n");
int canOverlap;
checkCudaErrors(cudaDeviceGetAttribute(&canOverlap, cudaDevAttrGpuOverlap, cuda_device));
printf("(%s) Can overlap one CPU<>GPU data transfer with GPU kernel execution " printf("(%s) Can overlap one CPU<>GPU data transfer with GPU kernel execution "
"(device property \"deviceOverlap\")\n", "(device property \"cudaDevAttrGpuOverlap\")\n",
deviceProp.deviceOverlap ? "X" : " "); canOverlap ? "X" : " ");
// printf("(%s) Can execute several GPU kernels simultaneously (compute // printf("(%s) Can execute several GPU kernels simultaneously (compute
// capability >= 2.0)\n", deviceProp.major >= 2 ? "X": " "); // capability >= 2.0)\n", deviceProp.major >= 2 ? "X": " ");
printf("(%s) Can overlap two CPU<>GPU data transfers with GPU kernel execution\n" printf("(%s) Can overlap two CPU<>GPU data transfers with GPU kernel execution\n"

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
@@ -45,6 +45,14 @@ foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}") list(APPEND GENCODE_FLAGS "-gencode=arch=compute_${arch},code=sm_${arch}")
endforeach() endforeach()
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(INCLUDES_LIST)
foreach(dir ${CUDAToolkit_INCLUDE_DIRS})
list(APPEND INCLUDES_LIST "-I${dir}")
endforeach()
string(JOIN " " INCLUDES "${INCLUDES_LIST}")
endif()
add_custom_command( add_custom_command(
OUTPUT ${CUDA_FATBIN_FILE} OUTPUT ${CUDA_FATBIN_FILE}
COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE} COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} -Wno-deprecated-gpu-targets ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE}

View File

@@ -313,6 +313,7 @@ static CUresult initCUDA(int argc, char **argv, CUfunction *transform)
int major = 0, minor = 0, devID = 0; int major = 0, minor = 0, devID = 0;
char deviceName[100]; char deviceName[100];
string module_path; string module_path;
CUctxCreateParams ctxCreateParams = {};
cuDevice = findCudaDeviceDRV(argc, (const char **)argv); cuDevice = findCudaDeviceDRV(argc, (const char **)argv);
@@ -322,7 +323,7 @@ static CUresult initCUDA(int argc, char **argv, CUfunction *transform)
checkCudaErrors(cuDeviceGetName(deviceName, sizeof(deviceName), cuDevice)); checkCudaErrors(cuDeviceGetName(deviceName, sizeof(deviceName), cuDevice));
printf("> GPU Device has SM %d.%d compute capability\n", major, minor); printf("> GPU Device has SM %d.%d compute capability\n", major, minor);
checkCudaErrors(cuCtxCreate(&cuContext, 0, cuDevice)); checkCudaErrors(cuCtxCreate(&cuContext, &ctxCreateParams, 0, cuDevice));
// first search for the module_path before we try to load the results // first search for the module_path before we try to load the results
std::ostringstream fatbin; std::ostringstream fatbin;

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)
else() else()

View File

@@ -287,7 +287,9 @@ int main(int argc, char **argv)
exit(EXIT_WAIVED); exit(EXIT_WAIVED);
} }
if (device_prop.computeMode == cudaComputeModeProhibited) { int computeMode;
checkCudaErrors(cudaDeviceGetAttribute(&computeMode, cudaDevAttrComputeMode, dev_id));
if (computeMode == cudaComputeModeProhibited) {
// This sample requires being run with a default or process exclusive mode // This sample requires being run with a default or process exclusive mode
fprintf(stderr, fprintf(stderr,
"This sample requires a device in either default or process " "This sample requires a device in either default or process "

View File

@@ -1,15 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "sample",
"type": "shell",
"command": "make dbg=1",
"problemMatcher": ["$nvcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -8,7 +8,7 @@ find_package(CUDAToolkit REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 72 75 80 86 87 89 90 100 101 120) set(CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90 100 110 120)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-deprecated-gpu-targets")
if(ENABLE_CUDA_DEBUG) if(ENABLE_CUDA_DEBUG)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G") # enable cuda-gdb (may significantly affect performance on some targets)

Some files were not shown because too many files have changed in this diff Show More