SWDEV-273235 - catch2 windows build (#2422)
Change-Id: I331c6c2525a65746e2d0799ec8dc2f608af1176a
[ROCm/hip commit: 0d361c5621]
Этот коммит содержится в:
@@ -24,7 +24,22 @@ if(NOT DEFINED HIP_PATH)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "HIP Path: ${HIP_PATH}")
|
message(STATUS "HIP Path: ${HIP_PATH}")
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc")
|
if(UNIX)
|
||||||
|
set(CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc")
|
||||||
|
set(CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc")
|
||||||
|
else()
|
||||||
|
# using cmake_path as it handles path correctly.
|
||||||
|
# Set both compilers else windows cmake complains of mismatch
|
||||||
|
cmake_path(SET CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc.bat")
|
||||||
|
cmake_path(SET CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc.bat")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(NOT UNIX)
|
||||||
|
# In linux this reruns the cmake and fails with incorrect vars.
|
||||||
|
# so the project command is used only for windows
|
||||||
|
project(build_tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED CATCH2_PATH)
|
if(NOT DEFINED CATCH2_PATH)
|
||||||
if(DEFINED ENV{CATCH2_PATH})
|
if(DEFINED ENV{CATCH2_PATH})
|
||||||
@@ -118,10 +133,10 @@ add_subdirectory(unit)
|
|||||||
add_subdirectory(ABM)
|
add_subdirectory(ABM)
|
||||||
add_subdirectory(hipTestMain)
|
add_subdirectory(hipTestMain)
|
||||||
add_subdirectory(stress)
|
add_subdirectory(stress)
|
||||||
add_subdirectory(TypeQualifiers)
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
add_subdirectory(multiproc)
|
add_subdirectory(multiproc)
|
||||||
|
add_subdirectory(TypeQualifiers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_policy(POP)
|
cmake_policy(POP)
|
||||||
|
|||||||
@@ -2,18 +2,8 @@
|
|||||||
#include <picojson.h>
|
#include <picojson.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#if __has_include(<filesystem>)
|
|
||||||
#include <filesystem>
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
#elif __has_include(<experimental/filesystem>)
|
|
||||||
#include <experimental/filesystem>
|
|
||||||
namespace fs = std::experimental::filesystem;
|
|
||||||
#else
|
|
||||||
#error "gg filesystem"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include "hip_test_filesystem.hh"
|
||||||
|
|
||||||
void TestContext::detectOS() {
|
void TestContext::detectOS() {
|
||||||
#if (HT_WIN == 1)
|
#if (HT_WIN == 1)
|
||||||
@@ -49,7 +39,7 @@ void TestContext::fillConfig() {
|
|||||||
if (config_path.has_parent_path() && config_path.has_filename()) {
|
if (config_path.has_parent_path() && config_path.has_filename()) {
|
||||||
config_.json_file = config_str;
|
config_.json_file = config_str;
|
||||||
} else if (config_path.has_parent_path()) {
|
} else if (config_path.has_parent_path()) {
|
||||||
config_.json_file = config_path / def_config_json;
|
config_.json_file = config_path.string() + def_config_json;
|
||||||
} else {
|
} else {
|
||||||
config_.json_file = exe_path + def_config_json;
|
config_.json_file = exe_path + def_config_json;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ THE SOFTWARE.
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "hip_test_context.hh"
|
#include "hip_test_context.hh"
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define HIP_PRINT_STATUS(status) INFO(hipGetErrorName(status) << " at line: " << __LINE__);
|
#define HIP_PRINT_STATUS(status) INFO(hipGetErrorName(status) << " at line: " << __LINE__);
|
||||||
|
|
||||||
@@ -105,4 +106,13 @@ static inline unsigned setNumBlocks(unsigned blocksPerCU, unsigned threadsPerBlo
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int RAND_R(unsigned* rand_seed)
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
srand(*rand_seed);
|
||||||
|
return rand();
|
||||||
|
#else
|
||||||
|
return rand_r(rand_seed);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
// We haven't checked which filesystem to include yet
|
||||||
|
#ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
// Check for feature test macro for <filesystem>
|
||||||
|
#if defined(__cpp_lib_filesystem)
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
// Check for feature test macro for <experimental/filesystem>
|
||||||
|
#elif defined(__cpp_lib_experimental_filesystem)
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
// We can't check if headers exist...
|
||||||
|
// Let's assume experimental to be safe
|
||||||
|
#elif !defined(__has_include)
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
// Check if the header "<filesystem>" exists
|
||||||
|
#elif __has_include(<filesystem>)
|
||||||
|
// If we're compiling on Visual Studio and are not compiling with C++17,
|
||||||
|
// we need to use experimental
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Check and include header that defines "_HAS_CXX17"
|
||||||
|
#if __has_include(<yvals_core.h>)
|
||||||
|
#include <yvals_core.h>
|
||||||
|
|
||||||
|
// Check for enabled C++17 support
|
||||||
|
#if defined(_HAS_CXX17) && _HAS_CXX17
|
||||||
|
// We're using C++17, so let's use the normal version
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// If the marco isn't defined yet, that means any of the other
|
||||||
|
// VS specific checks failed, so we need to use experimental
|
||||||
|
#ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Not on Visual Studio. Let's use the normal version
|
||||||
|
#else // #ifdef _MSC_VER
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Check if the header "<filesystem>" exists
|
||||||
|
#elif __has_include(<experimental/filesystem>)
|
||||||
|
#define INCLUDE_STD_FILESYSTEM_EXPERIMENTAL 1
|
||||||
|
|
||||||
|
// Fail if neither header is available with a nice error message
|
||||||
|
#else
|
||||||
|
#error Could not find system header "<filesystem>" ||
|
||||||
|
"<experimental/filesystem>"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// We priously determined that we need the exprimental version
|
||||||
|
#if INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
// Include it
|
||||||
|
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING 1;
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
// We need the alias from std::experimental::filesystem to std::filesystem
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
// We have a decent compiler and can use the normal version
|
||||||
|
#else
|
||||||
|
// Include it
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
@@ -25,6 +25,9 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
|
#else
|
||||||
|
#include <windows.h>
|
||||||
|
#include <sysinfoapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace HipTest {
|
namespace HipTest {
|
||||||
|
|||||||
@@ -29,16 +29,7 @@ THE SOFTWARE.
|
|||||||
#include <random>
|
#include <random>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
#include "hip_test_filesystem.hh"
|
||||||
#if __has_include(<filesystem>)
|
|
||||||
#include <filesystem>
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
#elif __has_include(<experimental/filesystem>)
|
|
||||||
#include <experimental/filesystem>
|
|
||||||
namespace fs = std::experimental::filesystem;
|
|
||||||
#else
|
|
||||||
#error "gg filesystem"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace hip {
|
namespace hip {
|
||||||
class SpawnProc {
|
class SpawnProc {
|
||||||
|
|||||||
@@ -9,12 +9,18 @@ set(TEST_SRC
|
|||||||
brev.cc
|
brev.cc
|
||||||
popc.cc
|
popc.cc
|
||||||
ldg.cc
|
ldg.cc
|
||||||
syncthreadsand.cc
|
|
||||||
syncthreadscount.cc
|
|
||||||
syncthreadsor.cc
|
|
||||||
threadfence_system.cc
|
threadfence_system.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# skipped for windows compiler issue - Illegal instruction detected
|
||||||
|
if(UNIX)
|
||||||
|
set(TEST_SRC ${TEST_SRC}
|
||||||
|
syncthreadsand.cc
|
||||||
|
syncthreadscount.cc
|
||||||
|
syncthreadsor.cc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# AMD only tests
|
# AMD only tests
|
||||||
set(AMD_TEST_SRC
|
set(AMD_TEST_SRC
|
||||||
unsafeAtomicAdd.cc
|
unsafeAtomicAdd.cc
|
||||||
|
|||||||
@@ -3,10 +3,15 @@ set(TEST_SRC
|
|||||||
Unit_hipEvent_Negative.cc
|
Unit_hipEvent_Negative.cc
|
||||||
Unit_hipEvent.cc
|
Unit_hipEvent.cc
|
||||||
Unit_hipEventElapsedTime.cc
|
Unit_hipEventElapsedTime.cc
|
||||||
Unit_hipEventRecord.cc
|
|
||||||
Unit_hipEventIpc.cc
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# skipped for windows due to duplicate symbols
|
||||||
|
if(UNIX)
|
||||||
|
set(TEST_SRC ${TEST_SRC}
|
||||||
|
Unit_hipEventRecord.cc
|
||||||
|
Unit_hipEventIpc.cc)
|
||||||
|
endif()
|
||||||
|
|
||||||
hip_add_exe_to_target(NAME EventTest
|
hip_add_exe_to_target(NAME EventTest
|
||||||
TEST_SRC ${TEST_SRC}
|
TEST_SRC ${TEST_SRC}
|
||||||
TEST_TARGET_NAME build_tests)
|
TEST_TARGET_NAME build_tests)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ set(TEST_SRC
|
|||||||
malloc.cc
|
malloc.cc
|
||||||
hipMemcpy2DToArray.cc
|
hipMemcpy2DToArray.cc
|
||||||
hipMemcpy2DToArrayAsync.cc
|
hipMemcpy2DToArrayAsync.cc
|
||||||
hipMemcpyPeer.cc
|
|
||||||
hipMemcpyPeerAsync.cc
|
|
||||||
hipMemcpy3D.cc
|
hipMemcpy3D.cc
|
||||||
hipMemcpy3DAsync.cc
|
hipMemcpy3DAsync.cc
|
||||||
hipMemcpyParam2D.cc
|
hipMemcpyParam2D.cc
|
||||||
@@ -17,37 +15,25 @@ set(TEST_SRC
|
|||||||
hipMemcpy2DFromArrayAsync.cc
|
hipMemcpy2DFromArrayAsync.cc
|
||||||
hipMemcpyAtoH.cc
|
hipMemcpyAtoH.cc
|
||||||
hipMemcpyHtoA.cc
|
hipMemcpyHtoA.cc
|
||||||
hipMemcpyDtoD.cc
|
|
||||||
hipMemcpyDtoDAsync.cc
|
|
||||||
hipMemcpyAsync.cc
|
|
||||||
hipMemcpy.cc
|
|
||||||
hipMemcpyWithStream.cc
|
|
||||||
hipMemcpyAllApiNegative.cc
|
hipMemcpyAllApiNegative.cc
|
||||||
hipMemcpyWithStreamMultiThread.cc
|
|
||||||
hipMemcpy_MultiThread.cc
|
hipMemcpy_MultiThread.cc
|
||||||
hipHostMalloc.cc
|
|
||||||
hipHostRegister.cc
|
hipHostRegister.cc
|
||||||
hipMemPtrGetInfo.cc
|
hipMemPtrGetInfo.cc
|
||||||
hipPointerGetAttributes.cc
|
hipPointerGetAttributes.cc
|
||||||
hipHostGetFlags.cc
|
hipHostGetFlags.cc
|
||||||
hipMemoryAllocateCoherent.cc
|
|
||||||
hipMallocManaged_MultiScenario.cc
|
hipMallocManaged_MultiScenario.cc
|
||||||
hipMemsetInvalidPtr.cc
|
hipMemsetInvalidPtr.cc
|
||||||
hipMemset.cc
|
hipMemset.cc
|
||||||
hipMemsetAsyncMultiThread.cc
|
hipMemsetAsyncMultiThread.cc
|
||||||
hipMemsetAsyncAndKernel.cc
|
|
||||||
hipMemset3D.cc
|
hipMemset3D.cc
|
||||||
hipMemset2D.cc
|
hipMemset2D.cc
|
||||||
hipMemset2DAsyncMultiThreadAndKernel.cc
|
|
||||||
hipHostMallocTests.cc
|
hipHostMallocTests.cc
|
||||||
hipMallocConcurrency.cc
|
|
||||||
hipMemset3DFunctional.cc
|
hipMemset3DFunctional.cc
|
||||||
hipMemset3DNegative.cc
|
hipMemset3DNegative.cc
|
||||||
hipMemset3DRegressMultiThread.cc
|
hipMemset3DRegressMultiThread.cc
|
||||||
hipMallocManagedFlagsTst.cc
|
hipMallocManagedFlagsTst.cc
|
||||||
hipMemPrefetchAsyncExtTsts.cc
|
hipMemPrefetchAsyncExtTsts.cc
|
||||||
hipMemAdviseMmap.cc
|
hipMemAdviseMmap.cc
|
||||||
hipMallocManaged.cc
|
|
||||||
hipMemCoherencyTst.cc
|
hipMemCoherencyTst.cc
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
@@ -56,8 +42,6 @@ set(TEST_SRC
|
|||||||
malloc.cc
|
malloc.cc
|
||||||
hipMemcpy2DToArray.cc
|
hipMemcpy2DToArray.cc
|
||||||
hipMemcpy2DToArrayAsync.cc
|
hipMemcpy2DToArrayAsync.cc
|
||||||
hipMemcpyPeer.cc
|
|
||||||
hipMemcpyPeerAsync.cc
|
|
||||||
hipMemcpy3D.cc
|
hipMemcpy3D.cc
|
||||||
hipMemcpy3DAsync.cc
|
hipMemcpy3DAsync.cc
|
||||||
hipMemcpyParam2D.cc
|
hipMemcpyParam2D.cc
|
||||||
@@ -68,39 +52,45 @@ set(TEST_SRC
|
|||||||
hipMemcpy2DFromArrayAsync.cc
|
hipMemcpy2DFromArrayAsync.cc
|
||||||
hipMemcpyAtoH.cc
|
hipMemcpyAtoH.cc
|
||||||
hipMemcpyHtoA.cc
|
hipMemcpyHtoA.cc
|
||||||
hipMemcpyDtoD.cc
|
|
||||||
hipMemcpyDtoDAsync.cc
|
|
||||||
hipMemcpyAsync.cc
|
|
||||||
hipMemcpy.cc
|
|
||||||
hipMemcpyWithStream.cc
|
|
||||||
hipMemcpyAllApiNegative.cc
|
hipMemcpyAllApiNegative.cc
|
||||||
hipMemcpyWithStreamMultiThread.cc
|
|
||||||
hipMemcpy_MultiThread.cc
|
hipMemcpy_MultiThread.cc
|
||||||
hipHostMalloc.cc
|
|
||||||
hipHostRegister.cc
|
hipHostRegister.cc
|
||||||
hipHostGetFlags.cc
|
hipHostGetFlags.cc
|
||||||
hipMemoryAllocateCoherent.cc
|
|
||||||
hipMallocManaged_MultiScenario.cc
|
hipMallocManaged_MultiScenario.cc
|
||||||
hipMemsetInvalidPtr.cc
|
hipMemsetInvalidPtr.cc
|
||||||
hipMemset.cc
|
hipMemset.cc
|
||||||
hipMemsetAsyncMultiThread.cc
|
hipMemsetAsyncMultiThread.cc
|
||||||
hipMemsetAsyncAndKernel.cc
|
|
||||||
hipMemset3D.cc
|
hipMemset3D.cc
|
||||||
hipMemset2D.cc
|
hipMemset2D.cc
|
||||||
hipMemset2DAsyncMultiThreadAndKernel.cc
|
|
||||||
hipHostMallocTests.cc
|
hipHostMallocTests.cc
|
||||||
hipMallocConcurrency.cc
|
|
||||||
hipMemset3DFunctional.cc
|
hipMemset3DFunctional.cc
|
||||||
hipMemset3DNegative.cc
|
hipMemset3DNegative.cc
|
||||||
hipMemset3DRegressMultiThread.cc
|
hipMemset3DRegressMultiThread.cc
|
||||||
hipMallocManagedFlagsTst.cc
|
hipMallocManagedFlagsTst.cc
|
||||||
hipMemPrefetchAsyncExtTsts.cc
|
hipMemPrefetchAsyncExtTsts.cc
|
||||||
hipMemAdviseMmap.cc
|
hipMemAdviseMmap.cc
|
||||||
hipMallocManaged.cc
|
|
||||||
hipMemCoherencyTst.cc
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#skipped in windows -duplicate HipTest::vectorADD sym (compiler issue)
|
||||||
|
if(UNIX)
|
||||||
|
set(TEST_SRC ${TEST_SRC}
|
||||||
|
hipMemcpyPeer.cc
|
||||||
|
hipMemcpyPeerAsync.cc
|
||||||
|
hipMemcpyWithStream.cc
|
||||||
|
hipMemcpyWithStreamMultiThread.cc
|
||||||
|
hipMemsetAsyncAndKernel.cc
|
||||||
|
hipMemset2DAsyncMultiThreadAndKernel.cc
|
||||||
|
hipMallocManaged.cc
|
||||||
|
hipMallocConcurrency.cc
|
||||||
|
hipMemcpyDtoD.cc
|
||||||
|
hipMemcpyDtoDAsync.cc
|
||||||
|
hipMemoryAllocateCoherent.cc
|
||||||
|
hipHostMalloc.cc
|
||||||
|
hipMemcpy.cc
|
||||||
|
hipMemcpyAsync.cc)
|
||||||
|
endif()
|
||||||
|
|
||||||
hip_add_exe_to_target(NAME MemoryTest
|
hip_add_exe_to_target(NAME MemoryTest
|
||||||
TEST_SRC ${TEST_SRC}
|
TEST_SRC ${TEST_SRC}
|
||||||
TEST_TARGET_NAME build_tests)
|
TEST_TARGET_NAME build_tests)
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpy_PinnedRegMemWithKernelLaunch",
|
|||||||
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
||||||
|
|
||||||
unsigned int seed = time(0);
|
unsigned int seed = time(0);
|
||||||
HIP_CHECK(hipSetDevice(rand_r(&seed) % (numDevices-1)+1));
|
HIP_CHECK(hipSetDevice(HipTest::RAND_R(&seed) % (numDevices-1)+1));
|
||||||
|
|
||||||
int device;
|
int device;
|
||||||
hipGetDevice(&device);
|
hipGetDevice(&device);
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_PinnedRegMemWithKernelLaunch",
|
|||||||
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
HipTest::checkVectorADD(A_h, B_h, C_h, NUM_ELM);
|
||||||
|
|
||||||
unsigned int seed = time(0);
|
unsigned int seed = time(0);
|
||||||
HIP_CHECK(hipSetDevice(rand_r(&seed) % (numDevices-1)+1));
|
HIP_CHECK(hipSetDevice(HipTest::RAND_R(&seed) % (numDevices-1)+1));
|
||||||
|
|
||||||
int device;
|
int device;
|
||||||
HIP_CHECK(hipGetDevice(&device));
|
HIP_CHECK(hipGetDevice(&device));
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ static void seekAndSet3DArraySlice(bool bAsync) {
|
|||||||
|
|
||||||
// select random slice for memset
|
// select random slice for memset
|
||||||
unsigned int seed = time(nullptr);
|
unsigned int seed = time(nullptr);
|
||||||
int slice_index = rand_r(&seed) % ZSIZE_S;
|
int slice_index = HipTest::RAND_R(&seed) % ZSIZE_S;
|
||||||
|
|
||||||
INFO("memset3d for sliceindex " << slice_index);
|
INFO("memset3d for sliceindex " << slice_index);
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ void clusterAllocs(int numAllocs, size_t minSize, size_t maxSize) {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < numAllocs; i++) {
|
for (int i = 0; i < numAllocs; i++) {
|
||||||
unsigned rand_seed = time(NULL);
|
unsigned rand_seed = time(NULL);
|
||||||
bool isDevice = rand_r(&rand_seed) & 0x1;
|
bool isDevice = HipTest::RAND_R(&rand_seed) & 0x1;
|
||||||
reference[i]._sizeBytes = zrand(maxSize - minSize) + minSize;
|
reference[i]._sizeBytes = zrand(maxSize - minSize) + minSize;
|
||||||
|
|
||||||
reference[i]._attrib.device = zrand(numDevices);
|
reference[i]._attrib.device = zrand(numDevices);
|
||||||
|
|||||||
@@ -4,14 +4,20 @@ set(TEST_SRC
|
|||||||
hipStreamGetFlags.cc
|
hipStreamGetFlags.cc
|
||||||
hipStreamGetPriority.cc
|
hipStreamGetPriority.cc
|
||||||
hipMultiStream.cc
|
hipMultiStream.cc
|
||||||
hipStreamACb_MultiThread.cc
|
|
||||||
hipStreamAddCallback.cc
|
hipStreamAddCallback.cc
|
||||||
hipStreamCreateWithFlags.cc
|
hipStreamCreateWithFlags.cc
|
||||||
hipStreamCreateWithPriority.cc
|
hipStreamCreateWithPriority.cc
|
||||||
hipStreamWithCUMask.cc
|
|
||||||
hipStreamGetCUMask.cc
|
hipStreamGetCUMask.cc
|
||||||
hipAPIStreamDisable.cc
|
hipAPIStreamDisable.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#skipped in windows - duplicate HipTest::vector_square sym (compiler issue)
|
||||||
|
if(UNIX)
|
||||||
|
set(TEST_SRC ${TEST_SRC}
|
||||||
|
hipStreamWithCUMask.cc
|
||||||
|
hipStreamACb_MultiThread.cc)
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
set(TEST_SRC
|
set(TEST_SRC
|
||||||
hipStreamCreate.cc
|
hipStreamCreate.cc
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ Testcase Scenarios :
|
|||||||
|
|
||||||
#include <hip_test_common.hh>
|
#include <hip_test_common.hh>
|
||||||
#include <hip_test_kernels.hh>
|
#include <hip_test_kernels.hh>
|
||||||
#include <unistd.h>
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ bool testStreamCallbackFunctionality(bool isDefault) {
|
|||||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
||||||
0));
|
0));
|
||||||
HIP_CHECK(hipStreamAddCallback(0, Callback, nullptr, 0));
|
HIP_CHECK(hipStreamAddCallback(0, Callback, nullptr, 0));
|
||||||
while (!gcbDone) usleep(100000); // Sleep for 100 ms
|
while (!gcbDone) std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||||
} else {
|
} else {
|
||||||
hipStream_t mystream;
|
hipStream_t mystream;
|
||||||
HIP_CHECK(hipStreamCreateWithFlags(&mystream, hipStreamNonBlocking));
|
HIP_CHECK(hipStreamCreateWithFlags(&mystream, hipStreamNonBlocking));
|
||||||
@@ -105,7 +106,7 @@ bool testStreamCallbackFunctionality(bool isDefault) {
|
|||||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
||||||
mystream));
|
mystream));
|
||||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0));
|
HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0));
|
||||||
while (!gcbDone) usleep(100000); // Sleep for 100 ms
|
while (!gcbDone) std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||||
HIP_CHECK(hipStreamDestroy(mystream));
|
HIP_CHECK(hipStreamDestroy(mystream));
|
||||||
}
|
}
|
||||||
HIP_CHECK(hipFree(reinterpret_cast<void*>(C_d)));
|
HIP_CHECK(hipFree(reinterpret_cast<void*>(C_d)));
|
||||||
@@ -192,7 +193,7 @@ TEST_CASE("Unit_hipStreamAddCallback_ParamTst") {
|
|||||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr,
|
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkUsrdataPtr,
|
||||||
gusrptr, 0));
|
gusrptr, 0));
|
||||||
while (!gcbDone) {
|
while (!gcbDone) {
|
||||||
usleep(100000); // Sleep for 100 ms
|
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||||
}
|
}
|
||||||
REQUIRE_FALSE(!gPassed);
|
REQUIRE_FALSE(!gPassed);
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ TEST_CASE("Unit_hipStreamAddCallback_ParamTst") {
|
|||||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue,
|
HIP_CHECK(hipStreamAddCallback(mystream, Callback_ChkStreamValue,
|
||||||
nullptr, 0));
|
nullptr, 0));
|
||||||
while (!gcbDone) {
|
while (!gcbDone) {
|
||||||
usleep(100000); // Sleep for 100 ms
|
std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||||
}
|
}
|
||||||
REQUIRE_FALSE(!gPassed);
|
REQUIRE_FALSE(!gPassed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ are ignored and hipExtStreamCreateWithCUMask must return hipSuccess.
|
|||||||
|
|
||||||
#include <hip_test_common.hh>
|
#include <hip_test_common.hh>
|
||||||
#include <hip_test_kernels.hh>
|
#include <hip_test_kernels.hh>
|
||||||
#include <unistd.h>
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ TEST_CASE("Unit_hipExtStreamCreateWithCUMask_ValidateCallbackFunc") {
|
|||||||
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
HIP_CHECK(hipMemcpyAsync(C_h, C_d, Nbytes, hipMemcpyDeviceToHost,
|
||||||
mystream));
|
mystream));
|
||||||
HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0));
|
HIP_CHECK(hipStreamAddCallback(mystream, Callback, nullptr, 0));
|
||||||
while (!cbDone) usleep(100000); // Sleep for 100 ms
|
while (!cbDone) std::this_thread::sleep_for(std::chrono::microseconds(100000)); // Sleep for 100 ms
|
||||||
HIP_CHECK(hipStreamDestroy(mystream));
|
HIP_CHECK(hipStreamDestroy(mystream));
|
||||||
HIP_CHECK(hipFree(reinterpret_cast<void*>(C_d)));
|
HIP_CHECK(hipFree(reinterpret_cast<void*>(C_d)));
|
||||||
HIP_CHECK(hipFree(reinterpret_cast<void*>(A_d)));
|
HIP_CHECK(hipFree(reinterpret_cast<void*>(A_d)));
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user