Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/header/TransferBench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,15 @@ namespace {
deviceIdx = GetClosestCpuNumaToGpu(memDevice.memIndex);
}

if (IsCpuMemType(memType)) {
// Set NUMA policy prior to call to hipHostMalloc
numa_set_preferred(deviceIdx);
} else if (IsGpuMemType(memType)) {
Comment on lines +1498 to +1501
// Switch to the appropriate GPU
// IMP: if the remapping above changes, remember to modify this!
ERR_CHECK(hipSetDevice(deviceIdx));
}
Comment thread
nileshnegi marked this conversation as resolved.
Comment on lines +1498 to +1505

// If memHandle is provided, allocate sharable memory
if (memHandle != NULL) {
#ifdef POD_COMM_ENABLED
Expand Down Expand Up @@ -1532,13 +1541,14 @@ namespace {
memset(*memPtr, 0, roundedUpBytes);
// Check that the allocated pages are actually on the correct NUMA node
ERR_CHECK(CheckPages((char*)*memPtr, roundedUpBytes, deviceIdx));
numa_set_preferred(-1);
} else if (IsGpuMemType(memType)) {
ERR_CHECK(hipSetDevice(memDevice.memIndex));
ERR_CHECK(hipMemset(*memPtr, 0, numBytes));
ERR_CHECK(hipDeviceSynchronize());
}
return ERR_NONE;
#else
if (IsCpuMemType(memType)) numa_set_preferred(-1);
return {ERR_FATAL, "Unable to allocate sharable memory if not compiled with pod communication support"};
#endif
} else {
Expand All @@ -1547,9 +1557,6 @@ namespace {

if (IsCpuMemType(memType)) {

// Set NUMA policy prior to call to hipHostMalloc
numa_set_preferred(deviceIdx);

// Allocate host-pinned memory (should respect NUMA mem policy)
int flags = 0;
#if !defined (__NVCC__)
Expand Down Expand Up @@ -1590,8 +1597,6 @@ namespace {
// Reset to default numa mem policy
numa_set_preferred(-1);
} else if (IsGpuMemType(memType)) {
// Switch to the appropriate GPU
ERR_CHECK(hipSetDevice(memDevice.memIndex));

if (memType == MEM_GPU) {
// Allocate GPU memory on appropriate device
Expand Down