Use new naming scheme

This commit is contained in:
Brandon Potter
2024-11-25 14:12:15 -06:00
rodzic 308816bc5e
commit fd8dbc7fb6
179 zmienionych plików z 5250 dodań i 5251 usunięć
@@ -23,32 +23,32 @@
using namespace rocshmem;
/* Declare the template with a generic implementation */
template <typename T, ROC_SHMEM_OP Op>
__device__ int wg_team_reduce(roc_shmem_ctx_t ctx, roc_shmem_team_t, T *dest,
template <typename T, ROCSHMEM_OP Op>
__device__ int wg_team_reduce(rocshmem_ctx_t ctx, rocshmem_team_t, T *dest,
const T *source, int nreduce) {
return ROC_SHMEM_SUCCESS;
return ROCSHMEM_SUCCESS;
}
/* Define templates to call ROC_SHMEM */
/* Define templates to call rocSHMEM */
#define TEAM_REDUCTION_DEF_GEN(T, TNAME, Op_API, Op) \
template <> \
__device__ int wg_team_reduce<T, Op>(roc_shmem_ctx_t ctx, \
roc_shmem_team_t team, T * dest, \
__device__ int wg_team_reduce<T, Op>(rocshmem_ctx_t ctx, \
rocshmem_team_t team, T * dest, \
const T *source, int nreduce) { \
return roc_shmem_ctx_##TNAME##_##Op_API##_wg_reduce(ctx, team, dest, \
return rocshmem_ctx_##TNAME##_##Op_API##_wg_reduce(ctx, team, dest, \
source, nreduce); \
}
#define TEAM_ARITH_REDUCTION_DEF_GEN(T, TNAME) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, sum, ROC_SHMEM_SUM) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, min, ROC_SHMEM_MIN) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, max, ROC_SHMEM_MAX) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, prod, ROC_SHMEM_PROD)
TEAM_REDUCTION_DEF_GEN(T, TNAME, sum, ROCSHMEM_SUM) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, min, ROCSHMEM_MIN) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, max, ROCSHMEM_MAX) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, prod, ROCSHMEM_PROD)
#define TEAM_BITWISE_REDUCTION_DEF_GEN(T, TNAME) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, or, ROC_SHMEM_OR) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, and, ROC_SHMEM_AND) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, xor, ROC_SHMEM_XOR)
TEAM_REDUCTION_DEF_GEN(T, TNAME, or, ROCSHMEM_OR) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, and, ROCSHMEM_AND) \
TEAM_REDUCTION_DEF_GEN(T, TNAME, xor, ROCSHMEM_XOR)
#define TEAM_INT_REDUCTION_DEF_GEN(T, TNAME) \
TEAM_ARITH_REDUCTION_DEF_GEN(T, TNAME) \
@@ -67,72 +67,72 @@ TEAM_FLOAT_REDUCTION_DEF_GEN(double, double)
// so disable it for now.
// FLOAT_REDUCTION_DEF_GEN(long double, longdouble)
roc_shmem_team_t team_reduce_world_dup;
rocshmem_team_t team_reduce_world_dup;
/******************************************************************************
* DEVICE TEST KERNEL
*****************************************************************************/
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
__global__ void TeamReductionTest(int loop, int skip, uint64_t *timer,
T1 *s_buf, T1 *r_buf, int size, TestType type,
ShmemContextType ctx_type,
roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
int n_pes = roc_shmem_ctx_n_pes(ctx);
int n_pes = rocshmem_ctx_n_pes(ctx);
__syncthreads();
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (i == skip && hipThreadIdx_x == 0) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
wg_team_reduce<T1, T2>(ctx, team, r_buf, s_buf, size);
roc_shmem_ctx_wg_barrier_all(ctx);
rocshmem_ctx_wg_barrier_all(ctx);
}
__syncthreads();
if (hipThreadIdx_x == 0) {
timer[hipBlockIdx_x] = roc_shmem_timer() - start;
timer[hipBlockIdx_x] = rocshmem_timer() - start;
}
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
/******************************************************************************
* HOST TESTER CLASS METHODS
*****************************************************************************/
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
TeamReductionTester<T1, T2>::TeamReductionTester(
TesterArguments args, std::function<void(T1 &, T1 &)> f1,
std::function<std::pair<bool, std::string>(const T1 &, const T1 &)> f2)
: Tester(args), init_buf{f1}, verify_buf{f2} {
s_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1));
r_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1));
s_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1));
r_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1));
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
TeamReductionTester<T1, T2>::~TeamReductionTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
void TeamReductionTester<T1, T2>::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
team_reduce_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_reduce_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_reduce_world_dup);
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
void TeamReductionTester<T1, T2>::launchKernel(dim3 gridSize, dim3 blockSize,
int loop, uint64_t size) {
size_t shared_bytes = 0;
@@ -146,21 +146,21 @@ void TeamReductionTester<T1, T2>::launchKernel(dim3 gridSize, dim3 blockSize,
num_timed_msgs = loop;
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
void TeamReductionTester<T1, T2>::postLaunchKernel() {
roc_shmem_team_destroy(team_reduce_world_dup);
rocshmem_team_destroy(team_reduce_world_dup);
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
void TeamReductionTester<T1, T2>::resetBuffers(uint64_t size) {
for (int i = 0; i < args.max_msg_size; i++) {
init_buf(s_buf[i], r_buf[i]);
}
}
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
void TeamReductionTester<T1, T2>::verifyResults(uint64_t size) {
int n_pes = roc_shmem_n_pes();
int n_pes = rocshmem_n_pes();
for (int i = 0; i < size; i++) {
auto r = verify_buf(r_buf[i], (T1)n_pes);
if (r.first == false) {