Files
rocm-systems/test/test_BroadcastMultiProcess.cpp
T

68 lines
2.5 KiB
C++
Raw Normal View History

2021-01-15 16:34:36 -07:00
/*************************************************************************
* Copyright (c) 2019-2021 Advanced Micro Devices, Inc. All rights reserved.
*
* See LICENSE.txt for license information
************************************************************************/
#include "test_BroadcastMultiProcess.hpp"
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <iostream>
namespace CorrectnessTests
{
TEST_P(BroadcastMultiProcessCorrectnessTest, Correctness)
{
dataset->InitializeRootProcess(numDevices, numElements, dataType, inPlace, ncclCollBroadcast);
std::vector<int> pids(numDevices);
2021-01-15 16:34:36 -07:00
int gpu = -1;
for (int i = 0; i < numDevices; i++)
2021-01-15 16:34:36 -07:00
{
gpu++;
int pid = fork();
if (pid == 0)
2021-01-15 16:34:36 -07:00
{
bool pass;
TestBroadcast(gpu, *dataset, pass);
TerminateChildProcess(pass);
2021-01-15 16:34:36 -07:00
}
else
{
pids[gpu] = pid;
2021-01-15 16:34:36 -07:00
}
}
ValidateProcesses(pids);
2021-01-15 16:34:36 -07:00
}
INSTANTIATE_TEST_SUITE_P(BroadcastMultiProcessCorrectnessSweep,
BroadcastMultiProcessCorrectnessTest,
testing::Combine(
// Reduction operator is not used
testing::Values(ncclSum),
// Data types
testing::Values(ncclInt8,
ncclUint8,
ncclInt32,
ncclUint32,
ncclInt64,
ncclUint64,
//ncclFloat16,
ncclFloat32,
ncclFloat64,
ncclBfloat16),
// Number of elements
testing::Values(1024, 1048576),
// Number of devices
testing::Values(2,3,4,8),
2021-01-15 16:34:36 -07:00
// In-place or not
testing::Values(false, true),
testing::Values("")),
CorrectnessTest::PrintToStringParamName());
} // namespace