diff --git a/projects/hip-tests/catch/unit/memory/hipPtrGetAttribute.cc b/projects/hip-tests/catch/unit/memory/hipPtrGetAttribute.cc index 99dbc5ab8d..eaf4c8b153 100644 --- a/projects/hip-tests/catch/unit/memory/hipPtrGetAttribute.cc +++ b/projects/hip-tests/catch/unit/memory/hipPtrGetAttribute.cc @@ -122,10 +122,14 @@ TEST_CASE("Unit_hipPtrGetAttribute_Simple") { // HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL if (numDevices > 1) { - HIP_CHECK(hipSetDevice(1)); - HIP_CHECK(hipPointerGetAttribute(&datatype, HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL, - reinterpret_cast(A_d))); - REQUIRE(datatype == 0); + int canAccess = -1; + HIP_CHECK(hipDeviceCanAccessPeer(&canAccess, 1, 0)); + if (canAccess == 1) { + HIP_CHECK(hipSetDevice(1)); + HIP_CHECK(hipPointerGetAttribute(&datatype, HIP_POINTER_ATTRIBUTE_DEVICE_ORDINAL, + reinterpret_cast(A_d))); + REQUIRE(datatype == 0); + } } // HIP_POINTER_ATTRIBUTE_MAPPED