Add multi work-group support for collective functional tests (#45)

- Added multi-work group support for the All-to-all, Fcollect, Broadcast, Barrier and Sync collective functional tests
- Renamed All-to-all and Fcollect tests to TeamAlltoAll and TeamFcollect

[ROCm/rocshmem commit: 57d60aa727]
This commit is contained in:
Avinash Kethineedi
2025-02-19 10:31:53 -06:00
committed by GitHub
parent e1ed36e58f
commit 65b4ff4c41
14 changed files with 719 additions and 486 deletions
@@ -30,14 +30,12 @@
#include <rocshmem/rocshmem.hpp>
#include <vector>
#include "alltoall_tester.hpp"
#include "amo_bitwise_tester.hpp"
#include "amo_extended_tester.hpp"
#include "amo_standard_tester.hpp"
#include "barrier_all_tester.hpp"
#include "empty_tester.hpp"
#include "extended_primitives.hpp"
#include "fcollect_tester.hpp"
#include "ping_all_tester.hpp"
#include "ping_pong_tester.hpp"
#include "primitive_mr_tester.hpp"
@@ -47,9 +45,11 @@
#include "signaling_operations_tester.hpp"
#include "swarm_tester.hpp"
#include "sync_tester.hpp"
#include "team_alltoall_tester.hpp"
#include "team_broadcast_tester.hpp"
#include "team_ctx_infra_tester.hpp"
#include "team_ctx_primitive_tester.hpp"
#include "team_fcollect_tester.hpp"
#include "team_reduction_tester.hpp"
#include "wave_level_primitives.hpp"
@@ -162,85 +162,37 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
if (rank == 0) {
std::cout << "Team Broadcast Test ###" << std::endl;
}
testers.push_back(new TeamBroadcastTester<long>(
args,
[](long& f1, long& f2) {
f1 = 1;
f2 = 2;
},
[rank](long v) {
long expected_val;
/**
* The verification routine here requires that the
* PE_root value is 0 which denotes that the
* sending processing element is rank 0.
*
* The difference in expected values arises from
* the specification for broadcast where the
* PE_root processing element does not copy the
* contents from its own source to dest during
* the broadcast.
*/
if (rank == 0) {
expected_val = 2;
} else {
expected_val = 1;
}
return (v == expected_val)
? std::make_pair(true, "")
: std::make_pair(
false, "Rank " + std::to_string(rank) + ", Got " +
std::to_string(v) + ", Expect " +
std::to_string(expected_val));
}));
testers.push_back(new TeamBroadcastTester<int64_t>(args));
testers.push_back(new TeamBroadcastTester<int>(args));
testers.push_back(new TeamBroadcastTester<long long>(args));
testers.push_back(new TeamBroadcastTester<float>(args));
testers.push_back(new TeamBroadcastTester<double>(args));
testers.push_back(new TeamBroadcastTester<char>(args));
testers.push_back(new TeamBroadcastTester<unsigned char>(args));
return testers;
case AllToAllTestType:
case TeamAllToAllTestType:
if (rank == 0) {
std::cout << "Alltoall Test ###" << std::endl;
}
testers.push_back(new AlltoallTester<int64_t>(
args,
[rank](int64_t& f1, int64_t& f2, int64_t dest_pe) {
const long SRC_SHIFT = 16;
// Make value for each src, dst pair unique
// by shifting src by SRC_SHIFT bits
f1 = (rank << SRC_SHIFT) + dest_pe;
f2 = -1;
},
[rank](int64_t v, int64_t src_pe) {
const long SRC_SHIFT = 16;
// See if we obtained unique value
long expected_val = (src_pe << SRC_SHIFT) + rank;
return (v == expected_val)
? std::make_pair(true, "")
: std::make_pair(
false, "Rank " + std::to_string(rank) + ", Got " +
std::to_string(v) + ", Expect " +
std::to_string(expected_val));
}));
testers.push_back(new TeamAlltoallTester<int64_t>(args));
testers.push_back(new TeamAlltoallTester<int>(args));
testers.push_back(new TeamAlltoallTester<long long>(args));
testers.push_back(new TeamAlltoallTester<float>(args));
testers.push_back(new TeamAlltoallTester<double>(args));
testers.push_back(new TeamAlltoallTester<char>(args));
testers.push_back(new TeamAlltoallTester<unsigned char>(args));
return testers;
case FCollectTestType:
case TeamFCollectTestType:
if (rank == 0) {
std::cout << "Fcollect Test ###" << std::endl;
}
testers.push_back(new FcollectTester<int64_t>(
args,
[rank](int64_t& f1, int64_t& f2) {
f1 = rank;
f2 = -1;
},
[rank](int64_t v, int64_t src_pe) {
int64_t expected_val = src_pe;
return (v == expected_val)
? std::make_pair(true, "")
: std::make_pair(
false, "Rank " + std::to_string(rank) + ", Got " +
std::to_string(v) + ", Expect " +
std::to_string(expected_val));
}));
testers.push_back(new TeamFcollectTester<int64_t>(args));
testers.push_back(new TeamFcollectTester<int>(args));
testers.push_back(new TeamFcollectTester<long long>(args));
testers.push_back(new TeamFcollectTester<float>(args));
testers.push_back(new TeamFcollectTester<double>(args));
testers.push_back(new TeamFcollectTester<char>(args));
testers.push_back(new TeamFcollectTester<unsigned char>(args));
return testers;
case AMO_FAddTestType:
if (rank == 0) std::cout << "AMO Fetch_Add ###" << std::endl;
@@ -525,7 +477,7 @@ bool Tester::peLaunchesKernel() {
*/
is_launcher = is_launcher || (_type == TeamReductionTestType) ||
(_type == TeamBroadcastTestType) || (_type == TeamCtxInfraTestType) ||
(_type == AllToAllTestType) || (_type == FCollectTestType) ||
(_type == TeamAllToAllTestType) || (_type == TeamFCollectTestType) ||
(_type == PingPongTestType) || (_type == BarrierAllTestType) ||
(_type == SyncTestType) || (_type == SyncAllTestType) ||
(_type == RandomAccessTestType) || (_type == PingAllTestType);