Skip to content
Merged
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
28 changes: 13 additions & 15 deletions src/header/TransferBench.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7776,21 +7776,6 @@ static bool IsConfiguredGid(union ibv_gid const& gid)
return HSA_STATUS_SUCCESS;
};

// Index CPU agents
hsa_init();
std::map<int, hsa_agent_t> cpuAgentMap;
hsa_iterate_agents(cpuAgentCallback, &cpuAgentMap);
hsa_shut_down();

cpuAgents.clear();
int numCpus = numa_num_configured_nodes();
cpuAgents.resize(numCpus);
for (int i = 0; i < numCpus; i++) {
if (cpuAgentMap.count(i)) {
cpuAgents[i] = cpuAgentMap[i];
}
}

// Index GPU agents
int numGpus = 0;
hipError_t status = hipGetDeviceCount(&numGpus);
Expand All @@ -7803,6 +7788,19 @@ static bool IsConfiguredGid(union ibv_gid const& gid)
gpuAgents.push_back(info.agentOwner);
DeallocateMemory(MEM_GPU, tempBuffer, 1024);
}

// Index CPU agents (done after HIP initialization)
std::map<int, hsa_agent_t> cpuAgentMap;
hsa_iterate_agents(cpuAgentCallback, &cpuAgentMap);

Comment thread
gilbertlee-amd marked this conversation as resolved.
cpuAgents.clear();
int numCpus = numa_num_configured_nodes();
Comment thread
gilbertlee-amd marked this conversation as resolved.
cpuAgents.resize(numCpus);
for (int i = 0; i < numCpus; i++) {
if (cpuAgentMap.count(i)) {
cpuAgents[i] = cpuAgentMap[i];
}
}
}
#endif

Expand Down