CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/*
|
|
* Test Scenarios:
|
|
* 1. Perform host and Pinned host Memory
|
|
* 2. Perform bytecount 0 validation for hipMemcpyAtoH API
|
|
* 3. Allocate Memory from one GPU device and call hipMemcpyAtoH from Peer
|
|
* GPU device
|
|
* 4. Perform hipMemcpyAtoH Negative Scenarios
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <hip_test_checkers.hh>
|
|
|
|
|
|
static constexpr auto NUM_W{10};
|
|
static constexpr auto NUM_H{1};
|
|
static constexpr auto copy_bytes{2};
|
|
|
|
/*
|
|
This testcase performs the basic and pinned host memory scenarios
|
|
of hipMemcpyAtoH API
|
|
Memory is allocated in GPU-0 and the API is triggered from GPU-1
|
|
Input: "A_d" initialized with "hData" Pi value
|
|
Output:"B_h" host variable output of hipMemcpyAtoH API
|
|
is then validated with "hData"
|
|
*/
|
|
#if HT_AMD
|
|
HIP_TEMPLATE_TEST_CASE(Unit_hipMemcpyAtoH_multiDevice_PeerDeviceContext, char, int, float) {
|
|
CHECK_IMAGE_SUPPORT
|
|
|
|
int numDevices = 0;
|
|
HIP_CHECK(hipGetDeviceCount(&numDevices));
|
|
if (numDevices > 1) {
|
|
int peerAccess = 0;
|
|
HIP_CHECK(hipDeviceCanAccessPeer(&peerAccess, 1, 0));
|
|
if (!peerAccess) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kPeerAccessUnavailable);
|
|
} else {
|
|
HIP_CHECK(hipSetDevice(0));
|
|
hipArray_t A_d;
|
|
TestType *hData{nullptr}, *B_h{nullptr};
|
|
size_t width{NUM_W * sizeof(TestType)};
|
|
|
|
// Initialization of data
|
|
HipTest::initArrays<TestType>(nullptr, nullptr, nullptr, &hData, &B_h, nullptr, NUM_W);
|
|
HipTest::setDefaultData<TestType>(NUM_W, hData, B_h, nullptr);
|
|
hipChannelFormatDesc desc = hipCreateChannelDesc<TestType>();
|
|
HIP_CHECK(hipMallocArray(&A_d, &desc, NUM_W, NUM_H, hipArrayDefault));
|
|
HIP_CHECK(hipMemcpy2DToArray(A_d, 0, 0, hData, width, width, NUM_H, hipMemcpyHostToDevice));
|
|
|
|
HIP_CHECK(hipDeviceSynchronize());
|
|
// Changing the device context
|
|
HIP_CHECK(hipSetDevice(1));
|
|
|
|
// Performing API call
|
|
REQUIRE(hipMemcpyAtoH(B_h, A_d, 0, copy_bytes * sizeof(TestType)) == hipSuccess);
|
|
// Validating the result
|
|
REQUIRE(HipTest::checkArray(B_h, hData, copy_bytes, NUM_H) == true);
|
|
|
|
// DeAllocating the memory
|
|
HIP_CHECK(hipFreeArray(A_d));
|
|
REQUIRE(HipTest::freeArrays<TestType>(nullptr, nullptr, nullptr, hData, B_h, nullptr,
|
|
false) == true);
|
|
}
|
|
} else {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kFewerThanTwoGpus);
|
|
}
|
|
}
|
|
#endif
|