Skip to content

Commit 0defc42

Browse files
committed
Move p2p_memory_access_failed to p2p_memory_access_host_staging
Signed-off-by: Jan Stephan <jan.stephan@amd.com>
1 parent 7bd131c commit 0defc42

25 files changed

+24
-30
lines changed

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ add_subdirectory(device_enumeration)
2727
add_subdirectory(device_selection)
2828
add_subdirectory(multi_device_synchronization)
2929
add_subdirectory(p2p_memory_access)
30-
add_subdirectory(p2p_memory_access_failed)
30+
add_subdirectory(p2p_memory_access_host_staging)

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ EXAMPLES := \
2525
device_selection \
2626
multi_device_synchronization \
2727
p2p_memory_access \
28-
p2p_memory_access_failed
28+
p2p_memory_access_host_staging
2929

3030
all: $(EXAMPLES)
3131

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This example demonstrates how to copy data between devices by adding peer-to-pee
77
[HIP documentation](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_runtime_api/multi_device.html#peer-to-peer-memory-access).
88

99
This example is intended for comparison with the
10-
[failed peer-to-peer memory access example](../p2p_memory_access_failed).
10+
[peer-to-peer memory access with host staging example](../p2p_memory_access_host_staging).
1111

1212
### Application flow
1313

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hip_p2p_memory_access_host_staging

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/CMakeLists.txt renamed to HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_host_staging/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
set(example_name hip_p2p_memory_access_failed)
23+
set(example_name hip_p2p_memory_host_staging)
2424

2525
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
2626
project(${example_name} LANGUAGES CXX)
@@ -54,7 +54,6 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
5454
add_executable(${example_name} main.hip)
5555
# Make example runnable using ctest
5656
add_test(NAME ${example_name} COMMAND ${example_name})
57-
set_tests_properties(${example_name} PROPERTIES WILL_FAIL TRUE)
5857

5958
set_source_files_properties(main.hip PROPERTIES LANGUAGE ${ROCM_EXAMPLES_GPU_LANGUAGE})
6059

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/Makefile renamed to HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_host_staging/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
EXAMPLE := hip_p2p_memory_access_failed
23+
EXAMPLE := hip_p2p_memory_access_host_staging
2424
GPU_RUNTIME := HIP
2525

2626
# HIP variables

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/README.md renamed to HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_host_staging/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HIP-Doc Peer-to-Peer Failed Memory Access Example
1+
# HIP-Doc Peer-to-Peer Memory Access with Host Staging Example
22

33
## Description
44

@@ -7,8 +7,7 @@ This example demonstrates how to copy data between devices by adding peer-to-pee
77
For more information on this topic, please refer to the
88
[HIP documentation](https://rocm.docs.amd.com/projects/HIP/en/latest/how-to/hip_runtime_api/multi_device.html#peer-to-peer-memory-access).
99

10-
**This will result in a failure**; this version is intended for comparison with the
11-
[working peer-to-peer example](../p2p_memory_access).
10+
This version is intended for comparison with the [default peer-to-peer example](../p2p_memory_access).
1211

1312
### Application flow
1413

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/main.hip renamed to HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_host_staging/main.hip

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main()
5353
if(deviceCount < 2)
5454
{
5555
std::cout << "This example requires at least two HIP devices." << std::endl;
56-
return EXIT_FAILURE;
56+
return EXIT_SUCCESS;
5757
}
5858

5959
double* deviceData0;
@@ -75,13 +75,9 @@ int main()
7575
simpleKernel<<<1000, 128>>>(deviceData1); // Launch kernel on device 1
7676
HIP_CHECK(hipDeviceSynchronize());
7777

78-
// Attempt to use deviceData0 on device 1 (This will not work as deviceData0 is allocated on device 0)
78+
// Use deviceData0 on device 1. This works but incurs a performance penalty.
7979
HIP_CHECK(hipSetDevice(deviceId1));
80-
hipError_t err = hipMemcpy(deviceData1, deviceData0, size, hipMemcpyDeviceToDevice); // This should fail
81-
if (err != hipSuccess)
82-
{
83-
std::cout << "Error: Cannot access deviceData0 from device 1, deviceData0 is on device 0" << std::endl;
84-
}
80+
HIP_CHECK(hipMemcpy(deviceData1, deviceData0, size, hipMemcpyDeviceToDevice));
8581

8682
// Copy result from device 0
8783
double hostData0[1024];

HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_failed/p2p_memory_access_failed_vs2017.sln renamed to HIP-Doc/Programming-Guide/Using-HIP-Runtime-API/Multi-Device-Management/p2p_memory_access_host_staging/p2p_memory_access_host_staging_vs2017.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.36217.24
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p2p_memory_access_failed_vs2017", "p2p_memory_access_failed_vs2017.vcxproj", "{FAA67BCB-BA0E-4152-95C9-2DBE0F0DFBF4}"
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p2p_memory_access_host_staging_vs2017", "p2p_memory_access_host_staging_vs2017.vcxproj", "{FAA67BCB-BA0E-4152-95C9-2DBE0F0DFBF4}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)