a40d4eb960
* working tests for a single message size
* move call_RCCL routine StandaloneUtils, create .cpp file for StandaloneUtils so that it can be included in several tests
* simplify test invocation
* remove unecessary logs and exit from ncclCommRegister
* set expected results for allGather
* skip test if nranks doesn't match number of gpus, call getAndDistributeNCCLid only from parent process
* fix improper size of expected-results vector
* Removing unused changes.
* Refactored to create a new file for the forked collectives call, as StandaloneUtils is for the Standalone tests. Renamed the functions to be slightly more accurate and follow existing naming conventions.
* Apply suggestions from code review
Co-authored-by: corey-derochie-amd <161367113+corey-derochie-amd@users.noreply.github.com>
---------
Co-authored-by: isaki001 <isakioti@banff-pla-r27-38.pla.dcgpu>
Co-authored-by: corey-derochie-amd <161367113+corey-derochie-amd@users.noreply.github.com>
Co-authored-by: Corey Derochie <corey.derochie@amd.com>
[ROCm/rccl commit: 3398fa78fe]
77 lignes
2.1 KiB
C++
77 lignes
2.1 KiB
C++
/*************************************************************************
|
|
* Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
|
*
|
|
* See LICENSE.txt for license information
|
|
************************************************************************/
|
|
#include "CollectiveArgs.hpp"
|
|
#include "StandaloneUtils.hpp"
|
|
#include <iostream>
|
|
#include <regex>
|
|
|
|
|
|
namespace RcclUnitTesting
|
|
{
|
|
|
|
std::string executeCommand(const char* cmd) {
|
|
std::string result;
|
|
FILE* pipe = popen(cmd, "r");
|
|
|
|
if (!pipe) {
|
|
std::cerr << "Error executing command: " << cmd << std::endl;
|
|
return result;
|
|
}
|
|
|
|
char buffer[128];
|
|
while (!feof(pipe)) {
|
|
if (fgets(buffer, 128, pipe) != NULL) {
|
|
result += buffer;
|
|
}
|
|
}
|
|
|
|
pclose(pipe);
|
|
return result;
|
|
}
|
|
|
|
std::vector<std::string> splitString(const std::string& str, char delimiter) {
|
|
std::vector<std::string> result;
|
|
std::istringstream iss(str);
|
|
|
|
std::string line;
|
|
while(std::getline(iss, line, delimiter)) {
|
|
result.push_back(line);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
ArchInfo parseMetadata(const std::vector<std::string>& list) {
|
|
ArchInfo archInfo;
|
|
KernelInfo currKernelInfo;
|
|
|
|
std::regex amdhsaTargetRegex("amdhsa.target:\\s+(?:'?)amdgcn-amd-amdhsa--(\\w+)(?:'?)");
|
|
std::regex kernelNameRegex("\\.name:\\s+(\\w+)");
|
|
std::regex privateSegmentSizeRegex("\\.private_segment_fixed_size:\\s+(\\d+)");
|
|
|
|
for (const auto& line : list) {
|
|
std::smatch match;
|
|
|
|
if (std::regex_search(line, match, amdhsaTargetRegex)) {
|
|
archInfo.archName = match[1];
|
|
} else if (std::regex_search(line, match, kernelNameRegex)) {
|
|
currKernelInfo.name = match[1];
|
|
} else if (std::regex_search(line, match, privateSegmentSizeRegex)) {
|
|
currKernelInfo.privateSegmentFixedSize = std::stoi(match[1]);
|
|
}
|
|
|
|
if (!currKernelInfo.name.empty() && currKernelInfo.privateSegmentFixedSize != 0) {
|
|
archInfo.kernels.push_back(currKernelInfo);
|
|
currKernelInfo = {}; // Empty kernelInfo
|
|
}
|
|
}
|
|
|
|
return archInfo;
|
|
}
|
|
|
|
}
|