From 01a62e2bc0c640634bf1c7b190acdc3ebe676bc0 Mon Sep 17 00:00:00 2001 From: shawnz Date: Fri, 11 Apr 2025 10:40:35 +0800 Subject: [PATCH] Bug 5184356: Update the computeMode for remaining 3 samples --- Samples/0_Introduction/simpleIPC/simpleIPC.cu | 4 +++- Samples/0_Introduction/systemWideAtomics/systemWideAtomics.cu | 4 +++- .../streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Samples/0_Introduction/simpleIPC/simpleIPC.cu b/Samples/0_Introduction/simpleIPC/simpleIPC.cu index ab59fc4d..29403ca5 100644 --- a/Samples/0_Introduction/simpleIPC/simpleIPC.cu +++ b/Samples/0_Introduction/simpleIPC/simpleIPC.cu @@ -247,7 +247,9 @@ static void parentProcess(char *app) } // This sample requires two processes accessing each device, so we need // 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); continue; } diff --git a/Samples/0_Introduction/systemWideAtomics/systemWideAtomics.cu b/Samples/0_Introduction/systemWideAtomics/systemWideAtomics.cu index 28e40ebc..121ba207 100644 --- a/Samples/0_Introduction/systemWideAtomics/systemWideAtomics.cu +++ b/Samples/0_Introduction/systemWideAtomics/systemWideAtomics.cu @@ -287,7 +287,9 @@ int main(int argc, char **argv) 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 fprintf(stderr, "This sample requires a device in either default or process " diff --git a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu index 3bfa9fe5..b473e8da 100644 --- a/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu +++ b/Samples/2_Concepts_and_Techniques/streamOrderedAllocationIPC/streamOrderedAllocationIPC.cu @@ -322,7 +322,9 @@ static void parentProcess(char *app) } // This sample requires two processes accessing each device, so we need // 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); continue; }