Unverified Commit 95a84559 authored by gilbertlee-amd's avatar gilbertlee-amd Committed by GitHub
Browse files

v1.09 Extra interactive output (#7)

parent ff2a96c9
# Changelog for TransferBench # Changelog for TransferBench
## v1.09
### Added
- Printing off src/dst memory addresses during interactive mode
### Changed
- Switching to numa_set_preferred instead of set_mempolicy
## v1.08 ## v1.08
### Changed ### Changed
- Fixing handling of non-configured NUMA nodes - Fixing handling of non-configured NUMA nodes
......
...@@ -26,7 +26,7 @@ THE SOFTWARE. ...@@ -26,7 +26,7 @@ THE SOFTWARE.
#include <algorithm> #include <algorithm>
#include <random> #include <random>
#include <time.h> #include <time.h>
#define TB_VERSION "1.08" #define TB_VERSION "1.09"
extern char const MemTypeStr[]; extern char const MemTypeStr[];
......
...@@ -292,6 +292,12 @@ void ExecuteTransfers(EnvVars const& ev, ...@@ -292,6 +292,12 @@ void ExecuteTransfers(EnvVars const& ev,
// Pause before starting first timed iteration in interactive mode // Pause before starting first timed iteration in interactive mode
if (verbose && ev.useInteractive && iteration == 0) if (verbose && ev.useInteractive && iteration == 0)
{ {
printf("Memory prepared:\n");
for (Transfer& transfer : transfers)
{
printf("Transfer %03d: SRC: %p DST: %p\n", transfer.transferIndex, transfer.srcMem, transfer.dstMem);
}
printf("Hit <Enter> to continue: "); printf("Hit <Enter> to continue: ");
scanf("%*c"); scanf("%*c");
printf("\n"); printf("\n");
...@@ -865,16 +871,9 @@ void AllocateMemory(MemType memType, int devIndex, size_t numBytes, void** memPt ...@@ -865,16 +871,9 @@ void AllocateMemory(MemType memType, int devIndex, size_t numBytes, void** memPt
if (IsCpuType(memType)) if (IsCpuType(memType))
{ {
// Set numa policy prior to call to hipHostMalloc // Set numa policy prior to call to hipHostMalloc
unsigned long nodemask = (1ULL << devIndex); numa_set_preferred(devIndex);
long retCode = set_mempolicy(MPOL_BIND, &nodemask, sizeof(nodemask)*8);
if (retCode)
{
printf("[ERROR] Unable to set NUMA memory policy to bind to NUMA node %d\n", devIndex);
exit(1);
}
// Allocate host-pinned memory (should respect NUMA mem policy) // Allocate host-pinned memory (should respect NUMA mem policy)
if (memType == MEM_CPU_FINE) if (memType == MEM_CPU_FINE)
{ {
HIP_CALL(hipHostMalloc((void **)memPtr, numBytes, hipHostMallocNumaUser)); HIP_CALL(hipHostMalloc((void **)memPtr, numBytes, hipHostMallocNumaUser));
...@@ -897,12 +896,7 @@ void AllocateMemory(MemType memType, int devIndex, size_t numBytes, void** memPt ...@@ -897,12 +896,7 @@ void AllocateMemory(MemType memType, int devIndex, size_t numBytes, void** memPt
CheckPages((char*)*memPtr, numBytes, devIndex); CheckPages((char*)*memPtr, numBytes, devIndex);
// Reset to default numa mem policy // Reset to default numa mem policy
retCode = set_mempolicy(MPOL_DEFAULT, NULL, 8); numa_set_preferred(-1);
if (retCode)
{
printf("[ERROR] Unable reset to default NUMA memory policy\n");
exit(1);
}
} }
else if (memType == MEM_GPU) else if (memType == MEM_GPU)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment