From 24a617c043e6ec41b5c4f0df52fe81a19a140453 Mon Sep 17 00:00:00 2001 From: shawnz Date: Wed, 12 Feb 2025 12:22:55 +0800 Subject: [PATCH] Update source code for cudaGraphPerfScaling --- .../cudaGraphsPerfScaling/cudaGraphPerfScaling.cu | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Samples/6_Performance/cudaGraphsPerfScaling/cudaGraphPerfScaling.cu b/Samples/6_Performance/cudaGraphsPerfScaling/cudaGraphPerfScaling.cu index 2f8b6c9e..9699c83f 100644 --- a/Samples/6_Performance/cudaGraphsPerfScaling/cudaGraphPerfScaling.cu +++ b/Samples/6_Performance/cudaGraphsPerfScaling/cudaGraphPerfScaling.cu @@ -350,8 +350,10 @@ int main(int argc, char **argv) cudaFree(0); cudaMallocHost(&hostData, sizeof(*hostData)); - stream.resize(width); - for (int i = 0; i < width; i++) + int numStreams = width; + if (numStreams == 1) numStreams = 2; // demo needs two streams even if capture only needs 1. + stream.resize(numStreams); + for (int i = 0; i < numStreams; i++) { cudaStreamCreate(&stream[i]); } @@ -386,7 +388,7 @@ int main(int argc, char **argv) if (!(outputFmt & 6)) { printf("skipping trials since no output is expected\n"); - return EXIT_FAILURE; + return 1; } std::vector metricTotal; @@ -429,6 +431,9 @@ int main(int argc, char **argv) length += stride; } - printf("\n"); -} + cudaFreeHost(hostData); + printf("\n"); + printf("Test passed\n"); + return 0; +}