Update MP UT to support arbitrary # of GPUs; multiple bugfixes (#16)
* Fixing temp file creation/deletion for Clique kernel mode.
* Refactoring of MP unit tests; include bugfixes and general support for any number of GPUs
* GroupCall MP UT properly quits when too many devices specified
* MP UT will programmatically set NCCL_COMM_ID if not specified; updated install script
[ROCm/rccl commit: d00b7d17bd]
This commit is contained in:
@@ -21,34 +21,50 @@ namespace CorrectnessTests
|
||||
class GroupCallsMultiProcessCorrectnessTest : public MultiProcessCorrectnessTest
|
||||
{
|
||||
public:
|
||||
void TestGroupCalls(int process, std::vector<int> const& ranks, std::vector<Dataset*>& datasets, std::vector<ncclFunc_t> const& funcs)
|
||||
void TestGroupCalls(int process, std::vector<int> const& ranks, std::vector<Dataset*>& datasets, std::vector<ncclFunc_t> const& funcs, bool& pass)
|
||||
{
|
||||
if (numDevices > numDevicesAvailable) return;
|
||||
|
||||
ncclGroupStart();
|
||||
for (int i = 0; i < ranks.size(); i++)
|
||||
{
|
||||
SetUpPerProcess(ranks[i], funcs, comms[ranks[i]], streams[ranks[i]], datasets);
|
||||
if (numDevices > numDevicesAvailable)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ncclGroupEnd();
|
||||
|
||||
if (numDevices > numDevicesAvailable)
|
||||
{
|
||||
pass = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int numProcesses = numDevices / ranks.size();
|
||||
Barrier barrier(process, numProcesses, std::atoi(getenv("NCCL_COMM_ID")));
|
||||
|
||||
int const root = 0;
|
||||
for (int i = 0; i < ranks.size(); i++)
|
||||
{
|
||||
AllGatherMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[0], barrier, numDevices, ranks[i]);
|
||||
AllReduceMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[1], barrier, op, ranks[i]);
|
||||
BroadcastMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[2], root, ranks[i]);
|
||||
ReduceMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[3], barrier, op, root, ranks[i]);
|
||||
ReduceScatterMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[4], barrier, op, ranks[i]);
|
||||
for (int j = 0; j < datasets.size(); j++)
|
||||
{
|
||||
FillDatasetWithPattern(*datasets[j], ranks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int const root = 0;
|
||||
|
||||
AllGatherMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[0], barrier, numDevices, ranks);
|
||||
AllReduceMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[1], barrier, op, ranks);
|
||||
BroadcastMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[2], root, ranks);
|
||||
ReduceMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[3], barrier, op, root, ranks);
|
||||
ReduceScatterMultiProcessCorrectnessTest::ComputeExpectedResults(*datasets[4], barrier, op, ranks);
|
||||
barrier.Wait();
|
||||
|
||||
ncclGroupStart();
|
||||
|
||||
// AllGather
|
||||
size_t const byteCount = datasets[0]->NumBytes() / numDevices;
|
||||
size_t const elemCount = numElements / numDevices;
|
||||
|
||||
ncclGroupStart();
|
||||
// AllGather
|
||||
for (int i = 0; i < ranks.size(); i++)
|
||||
{
|
||||
int rank = ranks[i];
|
||||
@@ -90,7 +106,7 @@ namespace CorrectnessTests
|
||||
{
|
||||
int rank = ranks[i];
|
||||
ncclReduceScatter(datasets[4]->inputs[rank],
|
||||
(int8_t *)datasets[4]->outputs[rank] + (i * byteCount),
|
||||
(int8_t *)datasets[4]->outputs[rank] + (rank * byteCount),
|
||||
elemCount, dataType, op,
|
||||
comms[rank], streams[rank]);
|
||||
}
|
||||
@@ -108,7 +124,11 @@ namespace CorrectnessTests
|
||||
{
|
||||
for (int j = 0; j < ranks.size(); j++)
|
||||
{
|
||||
ValidateResults(*datasets[i], ranks[j]);
|
||||
pass = ValidateResults(*datasets[i], ranks[j], root);
|
||||
if (!pass)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
barrier.Wait();
|
||||
for (int j = 0; j < ranks.size(); j++)
|
||||
|
||||
Reference in New Issue
Block a user