Skip to content

Commit 9c688d7

Browse files
committed
Updating samples for CUDA 12.5
1 parent 5f97d7d commit 9c688d7

File tree

997 files changed

+5284
-1393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

997 files changed

+5284
-1393
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Changelog
22

3+
### CUDA 12.5
4+
35
### CUDA 12.4
46
* Added graphConditionalNodes Sample
57

Common/helper_multiprocess.cpp

+19-7
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int waitProcess(Process *process) {
168168
#endif
169169
}
170170

171-
#if defined(__linux__)
171+
#if defined(__linux__) || defined(__QNX__)
172172
int ipcCreateSocket(ipcHandle *&handle, const char *name,
173173
const std::vector<Process> &processes) {
174174
int server_fd;
@@ -262,41 +262,48 @@ int ipcRecvShareableHandle(ipcHandle *handle, ShareableHandle *shHandle) {
262262
// Union to guarantee alignment requirements for control array
263263
union {
264264
struct cmsghdr cm;
265-
char control[CMSG_SPACE(sizeof(int))];
265+
// This will not work on QNX as QNX CMSG_SPACE calls __cmsg_alignbytes
266+
// And __cmsg_alignbytes is a runtime function instead of compile-time macros
267+
// char control[CMSG_SPACE(sizeof(int))]
268+
char* control;
266269
} control_un;
267270

271+
size_t sizeof_control = CMSG_SPACE(sizeof(int)) * sizeof(char);
272+
control_un.control = (char*) malloc(sizeof_control);
268273
struct cmsghdr *cmptr;
269274
ssize_t n;
270275
int receivedfd;
271276
char dummy_buffer[1];
272277
ssize_t sendResult;
273-
274278
msg.msg_control = control_un.control;
275-
msg.msg_controllen = sizeof(control_un.control);
279+
msg.msg_controllen = sizeof_control;
276280

277281
iov[0].iov_base = (void *)dummy_buffer;
278282
iov[0].iov_len = sizeof(dummy_buffer);
279283

280284
msg.msg_iov = iov;
281285
msg.msg_iovlen = 1;
282-
283286
if ((n = recvmsg(handle->socket, &msg, 0)) <= 0) {
284287
perror("IPC failure: Receiving data over socket failed");
288+
free(control_un.control);
285289
return -1;
286290
}
287291

288292
if (((cmptr = CMSG_FIRSTHDR(&msg)) != NULL) &&
289293
(cmptr->cmsg_len == CMSG_LEN(sizeof(int)))) {
290294
if ((cmptr->cmsg_level != SOL_SOCKET) || (cmptr->cmsg_type != SCM_RIGHTS)) {
295+
free(control_un.control);
291296
return -1;
292297
}
293298

294299
memmove(&receivedfd, CMSG_DATA(cmptr), sizeof(receivedfd));
295300
*(int *)shHandle = receivedfd;
296301
} else {
302+
free(control_un.control);
297303
return -1;
298304
}
299305

306+
free(control_un.control);
300307
return 0;
301308
}
302309

@@ -340,9 +347,12 @@ int ipcSendShareableHandle(ipcHandle *handle,
340347

341348
union {
342349
struct cmsghdr cm;
343-
char control[CMSG_SPACE(sizeof(int))];
350+
char* control;
344351
} control_un;
345352

353+
size_t sizeof_control = CMSG_SPACE(sizeof(int)) * sizeof(char);
354+
control_un.control = (char*) malloc(sizeof_control);
355+
346356
struct cmsghdr *cmptr;
347357
ssize_t readResult;
348358
struct sockaddr_un cliaddr;
@@ -360,7 +370,7 @@ int ipcSendShareableHandle(ipcHandle *handle,
360370
int sendfd = (int)shareableHandles[data];
361371

362372
msg.msg_control = control_un.control;
363-
msg.msg_controllen = sizeof(control_un.control);
373+
msg.msg_controllen = sizeof_control;
364374

365375
cmptr = CMSG_FIRSTHDR(&msg);
366376
cmptr->cmsg_len = CMSG_LEN(sizeof(int));
@@ -380,9 +390,11 @@ int ipcSendShareableHandle(ipcHandle *handle,
380390
ssize_t sendResult = sendmsg(handle->socket, &msg, 0);
381391
if (sendResult <= 0) {
382392
perror("IPC failure: Sending data over socket failed");
393+
free(control_un.control);
383394
return -1;
384395
}
385396

397+
free(control_un.control);
386398
return 0;
387399
}
388400

Common/helper_multiprocess.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int waitProcess(Process *process);
8484
#define checkIpcErrors(ipcFuncResult) \
8585
if (ipcFuncResult == -1) { fprintf(stderr, "Failure at %u %s\n", __LINE__, __FILE__); exit(EXIT_FAILURE); }
8686

87-
#if defined(__linux__)
87+
#if defined(__linux__) || defined(__QNX__)
8888
struct ipcHandle_st {
8989
int socket;
9090
char *socketName;

README.md

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
# CUDA Samples
22

3-
Samples for CUDA Developers which demonstrates features in CUDA Toolkit. This version supports [CUDA Toolkit 12.4](https://developer.nvidia.com/cuda-downloads).
3+
Samples for CUDA Developers which demonstrates features in CUDA Toolkit. This version supports [CUDA Toolkit 12.5](https://developer.nvidia.com/cuda-downloads).
44

55
## Release Notes
66

77
This section describes the release notes for the CUDA Samples on GitHub only.
88

9-
### CUDA 12.4
10-
11-
- Hopper Confidential Computing Modes do not support Video samples, nor do they support host-pinned memory due to the restrictions created by CPU IOMMUs. The following Samples are affected:
12-
- convolutionTexture
13-
- cudaNvSci
14-
- dct8x8
15-
- lineOfSight
16-
- simpleCubemapTexture
17-
- simpleIPC
18-
- simpleLayeredTexture
19-
- simplePitchLinearTexture
20-
- simpleStream
21-
- simpleTexture
22-
- simpleTextureDrv
23-
- watershedSegmentationNPP
24-
9+
### CUDA 12.5
2510

2611
### [older versions...](./CHANGELOG.md)
2712

2813
## Getting Started
2914

3015
### Prerequisites
3116

32-
Download and install the [CUDA Toolkit 12.4](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
17+
Download and install the [CUDA Toolkit 12.5](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
3318
For system requirements and installation instructions of cuda toolkit, please refer to the [Linux Installation Guide](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/), and the [Windows Installation Guide](http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).
3419

3520
### Getting the CUDA Samples

Samples/0_Introduction/UnifiedMemoryStreams/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ CCFLAGS :=
169169
LDFLAGS :=
170170

171171
# build flags
172+
173+
# Link flag for customized HOST_COMPILER with gcc realpath
174+
GCC_PATH := $(shell which gcc)
175+
ifeq ($(CUSTOM_HOST_COMPILER),1)
176+
ifneq ($(filter /%,$(HOST_COMPILER)),)
177+
ifneq ($(findstring gcc,$(HOST_COMPILER)),)
178+
ifneq ($(GCC_PATH),$(HOST_COMPILER))
179+
LDFLAGS += -lstdc++
180+
endif
181+
endif
182+
endif
183+
endif
184+
172185
ifeq ($(TARGET_OS),darwin)
173186
LDFLAGS += -rpath $(CUDA_PATH)/lib
174187
CCFLAGS += -arch $(HOST_ARCH)

Samples/0_Introduction/UnifiedMemoryStreams/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cudaStreamDestroy, cudaFree, cudaMallocManaged, cudaStreamAttachMemAsync, cudaSe
2828

2929
## Prerequisites
3030

31-
Download and install the [CUDA Toolkit 12.4](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
31+
Download and install the [CUDA Toolkit 12.5](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
3232
Make sure the dependencies mentioned in [Dependencies]() section above are installed.
3333

3434
## Build and Run

Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2017.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</PropertyGroup>
3939
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4040
<ImportGroup Label="ExtensionSettings">
41-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
41+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
4242
</ImportGroup>
4343
<ImportGroup Label="PropertySheets">
4444
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -108,6 +108,6 @@
108108
</ItemGroup>
109109
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
110110
<ImportGroup Label="ExtensionTargets">
111-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
111+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
112112
</ImportGroup>
113113
</Project>

Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2019.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -104,6 +104,6 @@
104104
</ItemGroup>
105105
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
106106
<ImportGroup Label="ExtensionTargets">
107-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
107+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
108108
</ImportGroup>
109109
</Project>

Samples/0_Introduction/UnifiedMemoryStreams/UnifiedMemoryStreams_vs2022.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -104,6 +104,6 @@
104104
</ItemGroup>
105105
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
106106
<ImportGroup Label="ExtensionTargets">
107-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
107+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
108108
</ImportGroup>
109109
</Project>

Samples/0_Introduction/asyncAPI/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ CCFLAGS :=
169169
LDFLAGS :=
170170

171171
# build flags
172+
173+
# Link flag for customized HOST_COMPILER with gcc realpath
174+
GCC_PATH := $(shell which gcc)
175+
ifeq ($(CUSTOM_HOST_COMPILER),1)
176+
ifneq ($(filter /%,$(HOST_COMPILER)),)
177+
ifneq ($(findstring gcc,$(HOST_COMPILER)),)
178+
ifneq ($(GCC_PATH),$(HOST_COMPILER))
179+
LDFLAGS += -lstdc++
180+
endif
181+
endif
182+
endif
183+
endif
184+
172185
ifeq ($(TARGET_OS),darwin)
173186
LDFLAGS += -rpath $(CUDA_PATH)/lib
174187
CCFLAGS += -arch $(HOST_ARCH)

Samples/0_Introduction/asyncAPI/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cudaProfilerStop, cudaMalloc, cudaMemcpyAsync, cudaFree, cudaMallocHost, cudaPro
2727

2828
## Prerequisites
2929

30-
Download and install the [CUDA Toolkit 12.4](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
30+
Download and install the [CUDA Toolkit 12.5](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
3131

3232
## Build and Run
3333

Samples/0_Introduction/asyncAPI/asyncAPI_vs2017.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</PropertyGroup>
3939
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4040
<ImportGroup Label="ExtensionSettings">
41-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
41+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
4242
</ImportGroup>
4343
<ImportGroup Label="PropertySheets">
4444
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -107,6 +107,6 @@
107107
</ItemGroup>
108108
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
109109
<ImportGroup Label="ExtensionTargets">
110-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
110+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
111111
</ImportGroup>
112112
</Project>

Samples/0_Introduction/asyncAPI/asyncAPI_vs2019.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -103,6 +103,6 @@
103103
</ItemGroup>
104104
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
105105
<ImportGroup Label="ExtensionTargets">
106-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
106+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
107107
</ImportGroup>
108108
</Project>

Samples/0_Introduction/asyncAPI/asyncAPI_vs2022.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -103,6 +103,6 @@
103103
</ItemGroup>
104104
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
105105
<ImportGroup Label="ExtensionTargets">
106-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
106+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
107107
</ImportGroup>
108108
</Project>

Samples/0_Introduction/c++11_cuda/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ CCFLAGS :=
169169
LDFLAGS :=
170170

171171
# build flags
172+
173+
# Link flag for customized HOST_COMPILER with gcc realpath
174+
GCC_PATH := $(shell which gcc)
175+
ifeq ($(CUSTOM_HOST_COMPILER),1)
176+
ifneq ($(filter /%,$(HOST_COMPILER)),)
177+
ifneq ($(findstring gcc,$(HOST_COMPILER)),)
178+
ifneq ($(GCC_PATH),$(HOST_COMPILER))
179+
LDFLAGS += -lstdc++
180+
endif
181+
endif
182+
endif
183+
endif
184+
172185
ifeq ($(TARGET_OS),darwin)
173186
LDFLAGS += -rpath $(CUDA_PATH)/lib
174187
CCFLAGS += -arch $(HOST_ARCH)

Samples/0_Introduction/c++11_cuda/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cudaMalloc, cudaMemcpy, cudaMemset, cudaFree
3030

3131
## Prerequisites
3232

33-
Download and install the [CUDA Toolkit 12.4](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
33+
Download and install the [CUDA Toolkit 12.5](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
3434
Make sure the dependencies mentioned in [Dependencies]() section above are installed.
3535

3636
## Build and Run

Samples/0_Introduction/c++11_cuda/c++11_cuda_vs2017.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</PropertyGroup>
3939
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4040
<ImportGroup Label="ExtensionSettings">
41-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
41+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
4242
</ImportGroup>
4343
<ImportGroup Label="PropertySheets">
4444
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -107,6 +107,6 @@
107107
</ItemGroup>
108108
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
109109
<ImportGroup Label="ExtensionTargets">
110-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
110+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
111111
</ImportGroup>
112112
</Project>

Samples/0_Introduction/c++11_cuda/c++11_cuda_vs2019.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -103,6 +103,6 @@
103103
</ItemGroup>
104104
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
105105
<ImportGroup Label="ExtensionTargets">
106-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
106+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
107107
</ImportGroup>
108108
</Project>

Samples/0_Introduction/c++11_cuda/c++11_cuda_vs2022.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
3636
<ImportGroup Label="ExtensionSettings">
37-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.props" />
37+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.props" />
3838
</ImportGroup>
3939
<ImportGroup Label="PropertySheets">
4040
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
@@ -103,6 +103,6 @@
103103
</ItemGroup>
104104
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
105105
<ImportGroup Label="ExtensionTargets">
106-
<Import Project="$(CUDAPropsPath)\CUDA 12.4.targets" />
106+
<Import Project="$(CUDAPropsPath)\CUDA 12.5.targets" />
107107
</ImportGroup>
108108
</Project>

0 commit comments

Comments
 (0)