From e6ff99b52b1540d15ba15a250721e4db254bd8be Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Thu, 22 Jul 2021 09:29:38 -0700 Subject: [PATCH] SWDEV-289409 - minor fixes for hipStream tests Change-Id: I68288f33724b636715ee732e9044f82790e5da47 [ROCm/hip commit: cc7237d27d31b7880f1b2f9ed39ecdc5f353784a] --- .../hip/tests/catch/unit/stream/hipMultiStream.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/hip/tests/catch/unit/stream/hipMultiStream.cc b/projects/hip/tests/catch/unit/stream/hipMultiStream.cc index f1a0b67ec9..02db9e659c 100755 --- a/projects/hip/tests/catch/unit/stream/hipMultiStream.cc +++ b/projects/hip/tests/catch/unit/stream/hipMultiStream.cc @@ -50,27 +50,28 @@ TEST_CASE("Unit_hipMultiStream_sameDevice") { HIP_CHECK(hipMalloc(&data[i], NN * sizeof(float))); hipLaunchKernelGGL(kernel, dim3(1), dim3(1), 0, streams[i], data[i], xd, NN); hipLaunchKernelGGL(HIP_KERNEL_NAME(nKernel), dim3(1), dim3(1), 0, 0, yd); + HIP_CHECK(hipFree(data[i])); } HIP_CHECK(hipMemcpy(&x, xd, sizeof(float), hipMemcpyDeviceToHost)); HIP_CHECK(hipMemcpy(&y, yd, sizeof(float), hipMemcpyDeviceToHost)); REQUIRE(x == Approx(y)); } + TEST_CASE("Unit_hipMultiStream_multimeDevice") { - constexpr int nLoops = 100000; + constexpr int nLoops = 50000; constexpr int nStreams = 2; std::vector streams(nStreams); int nGpu = 0; HIP_CHECK(hipGetDeviceCount(&nGpu)); if (nGpu < 1) { - std::cout << "info: didn't find any GPU! skipping the test!\n"; - REQUIRE(true); + INFO("No GPU for Testing"); + SUCCEED(true); } static int device = 0; HIP_CHECK(hipSetDevice(device)); hipDeviceProp_t props; HIP_CHECK(hipGetDeviceProperties(&props, device)); - std::cout << "info: running on bus " - << "0x" << props.pciBusID << " " << props.name << std::endl; + INFO("Running on Bus: " << props.pciBusID << " " << props.name); for (int i = 0; i < nStreams; i++) { HIP_CHECK(hipStreamCreate(&streams[i])); } @@ -85,7 +86,7 @@ TEST_CASE("Unit_hipMultiStream_multimeDevice") { // Sync stream 1 HIP_CHECK(hipStreamSynchronize(streams[0])); if (k % 10000 == 0 || k == nLoops) { - std::cout << "Info: Iteration = " << k << std::endl; + INFO("Iter: " << k); } } HIP_CHECK(hipDeviceSynchronize());