From 85ce4d0bcc4dd01d851bcb3c83ce30f6acd528d7 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Tue, 13 Jul 2021 23:39:01 -0400 Subject: [PATCH] SWDEV-295037 - Fix passed() in DTests passed() should not call exit(0) which will prevent object destructor being called. Change-Id: Ibaee0d85cb616727dc5db557bb9422702670b688 [ROCm/hip-tests commit: 913003099c83cd8bd016f1ac3b6ebeb5d7e2db8e] --- projects/hip-tests/perftests/compute/hipPerfDotProduct.cpp | 6 ++---- projects/hip-tests/perftests/compute/hipPerfMandelbrot.cpp | 4 +--- projects/hip-tests/perftests/memory/hipPerfMemFill.cpp | 3 +-- projects/hip-tests/perftests/memory/hipPerfMemcpy.cpp | 4 +--- projects/hip-tests/perftests/memory/hipPerfMemset.cpp | 6 ++---- projects/hip-tests/perftests/memory/hipPerfSampleRate.cpp | 6 ++---- .../perftests/stream/hipPerfDeviceConcurrency.cpp | 7 +------ .../perftests/stream/hipPerfStreamConcurrency.cpp | 7 +------ .../perftests/stream/hipPerfStreamCreateCopyDestroy.cpp | 4 +--- 9 files changed, 12 insertions(+), 35 deletions(-) diff --git a/projects/hip-tests/perftests/compute/hipPerfDotProduct.cpp b/projects/hip-tests/perftests/compute/hipPerfDotProduct.cpp index 78215c8502..e1d444d5b5 100644 --- a/projects/hip-tests/perftests/compute/hipPerfDotProduct.cpp +++ b/projects/hip-tests/perftests/compute/hipPerfDotProduct.cpp @@ -238,9 +238,7 @@ int main(int argc, char* argv[]) { HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return 0; + failed("No GPU!"); } hipDeviceProp_t props = {0}; props = {0}; @@ -379,6 +377,6 @@ int main(int argc, char* argv[]) { HIPCHECK(hipFree(workspace)); } - + passed(); return 0; } diff --git a/projects/hip-tests/perftests/compute/hipPerfMandelbrot.cpp b/projects/hip-tests/perftests/compute/hipPerfMandelbrot.cpp index 5d556ed960..8e6c3a25cc 100644 --- a/projects/hip-tests/perftests/compute/hipPerfMandelbrot.cpp +++ b/projects/hip-tests/perftests/compute/hipPerfMandelbrot.cpp @@ -403,9 +403,7 @@ void hipPerfMandelBrot::open(int deviceId) { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + failed("No GPU!"); } diff --git a/projects/hip-tests/perftests/memory/hipPerfMemFill.cpp b/projects/hip-tests/perftests/memory/hipPerfMemFill.cpp index 4aedb72073..0dbae58ce4 100644 --- a/projects/hip-tests/perftests/memory/hipPerfMemFill.cpp +++ b/projects/hip-tests/perftests/memory/hipPerfMemFill.cpp @@ -130,8 +130,7 @@ class hipPerfMemFill { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - cout << "Info: didn't find any GPU! skipping the test!\n"; - passed(); + failed("No GPU!"); } else if (deviceId >= nGpu) { failed("Info: wrong GPU Id %d\n", deviceId); } diff --git a/projects/hip-tests/perftests/memory/hipPerfMemcpy.cpp b/projects/hip-tests/perftests/memory/hipPerfMemcpy.cpp index 005b1a9c85..c9dfedc99e 100644 --- a/projects/hip-tests/perftests/memory/hipPerfMemcpy.cpp +++ b/projects/hip-tests/perftests/memory/hipPerfMemcpy.cpp @@ -62,9 +62,7 @@ void hipPerfMemcpy::open(int deviceId) { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + failed("No GPU!"); } HIPCHECK(hipSetDevice(deviceId)); diff --git a/projects/hip-tests/perftests/memory/hipPerfMemset.cpp b/projects/hip-tests/perftests/memory/hipPerfMemset.cpp index 4e71a094dc..4d6ae88711 100644 --- a/projects/hip-tests/perftests/memory/hipPerfMemset.cpp +++ b/projects/hip-tests/perftests/memory/hipPerfMemset.cpp @@ -18,7 +18,7 @@ */ /* HIT_START - * BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvcc + * BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvidia * TEST: %t * HIT_END */ @@ -110,9 +110,7 @@ void hipPerfMemset::open(int deviceId) { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + failed("No GPU!"); } HIPCHECK(hipSetDevice(deviceId)); diff --git a/projects/hip-tests/perftests/memory/hipPerfSampleRate.cpp b/projects/hip-tests/perftests/memory/hipPerfSampleRate.cpp index 8346cb3cda..1cb0741158 100644 --- a/projects/hip-tests/perftests/memory/hipPerfSampleRate.cpp +++ b/projects/hip-tests/perftests/memory/hipPerfSampleRate.cpp @@ -128,10 +128,8 @@ void hipPerfSampleRate::open(void) { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); - if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + if (nGpu < 1) { + failed("No GPU!"); } int deviceId = 0; diff --git a/projects/hip-tests/perftests/stream/hipPerfDeviceConcurrency.cpp b/projects/hip-tests/perftests/stream/hipPerfDeviceConcurrency.cpp index a4403eeae7..0c1a1ec6dc 100644 --- a/projects/hip-tests/perftests/stream/hipPerfDeviceConcurrency.cpp +++ b/projects/hip-tests/perftests/stream/hipPerfDeviceConcurrency.cpp @@ -95,17 +95,12 @@ hipPerfDeviceConcurrency::hipPerfDeviceConcurrency() {} hipPerfDeviceConcurrency::~hipPerfDeviceConcurrency() {} void hipPerfDeviceConcurrency::open(void) { - - int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); setNumGpus(nGpu); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); + failed("No GPU!"); } - - } diff --git a/projects/hip-tests/perftests/stream/hipPerfStreamConcurrency.cpp b/projects/hip-tests/perftests/stream/hipPerfStreamConcurrency.cpp index fd4b0107e4..557ad7823c 100644 --- a/projects/hip-tests/perftests/stream/hipPerfStreamConcurrency.cpp +++ b/projects/hip-tests/perftests/stream/hipPerfStreamConcurrency.cpp @@ -235,17 +235,12 @@ hipPerfStreamConcurrency::hipPerfStreamConcurrency() {} hipPerfStreamConcurrency::~hipPerfStreamConcurrency() {} void hipPerfStreamConcurrency::open(int deviceId) { - - int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + failed("No GPU!"); } - HIPCHECK(hipSetDevice(deviceId)); hipDeviceProp_t props = {0}; HIPCHECK(hipGetDeviceProperties(&props, deviceId)); diff --git a/projects/hip-tests/perftests/stream/hipPerfStreamCreateCopyDestroy.cpp b/projects/hip-tests/perftests/stream/hipPerfStreamCreateCopyDestroy.cpp index 1a58f7e045..90292942db 100644 --- a/projects/hip-tests/perftests/stream/hipPerfStreamCreateCopyDestroy.cpp +++ b/projects/hip-tests/perftests/stream/hipPerfStreamCreateCopyDestroy.cpp @@ -54,9 +54,7 @@ void hipPerfStreamCreateCopyDestroy::open(int deviceId) { int nGpu = 0; HIPCHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - passed(); - return; + failed("No GPU!"); } HIPCHECK(hipSetDevice(deviceId));