Use new naming scheme

This commit is contained in:
Brandon Potter
2024-11-25 14:12:15 -06:00
parent 308816bc5e
commit fd8dbc7fb6
179 changed files with 5250 additions and 5251 deletions
+25 -25
View File
@@ -24,17 +24,17 @@ using namespace rocshmem;
/* Declare the template with a generic implementation */
template <typename T>
__device__ void wg_alltoall(roc_shmem_ctx_t ctx, roc_shmem_team_t team, T *dest,
__device__ void wg_alltoall(rocshmem_ctx_t ctx, rocshmem_team_t team, T *dest,
const T *source, int nelem) {
return;
}
/* Define templates to call ROC_SHMEM */
/* Define templates to call rocSHMEM */
#define ALLTOALL_DEF_GEN(T, TNAME) \
template <> \
__device__ void wg_alltoall<T>(roc_shmem_ctx_t ctx, roc_shmem_team_t team, \
__device__ void wg_alltoall<T>(rocshmem_ctx_t ctx, rocshmem_team_t team, \
T * dest, const T *source, int nelem) { \
roc_shmem_ctx_##TNAME##_wg_alltoall(ctx, team, dest, source, nelem); \
rocshmem_ctx_##TNAME##_wg_alltoall(ctx, team, dest, source, nelem); \
}
ALLTOALL_DEF_GEN(float, float)
@@ -52,7 +52,7 @@ ALLTOALL_DEF_GEN(unsigned int, uint)
ALLTOALL_DEF_GEN(unsigned long, ulong)
ALLTOALL_DEF_GEN(unsigned long long, ulonglong)
roc_shmem_team_t team_alltoall_world_dup;
rocshmem_team_t team_alltoall_world_dup;
/******************************************************************************
* DEVICE TEST KERNEL
@@ -60,20 +60,20 @@ roc_shmem_team_t team_alltoall_world_dup;
template <typename T1>
__global__ void AlltoallTest(int loop, int skip, uint64_t *timer,
T1 *source_buf, T1 *dest_buf, int size,
ShmemContextType ctx_type, roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
ShmemContextType ctx_type, 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_alltoall<T1>(ctx, team,
dest_buf, // T* dest
@@ -84,11 +84,11 @@ __global__ void AlltoallTest(int loop, int skip, uint64_t *timer,
__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();
}
/******************************************************************************
@@ -99,24 +99,24 @@ AlltoallTester<T1>::AlltoallTester(
TesterArguments args, std::function<void(T1 &, T1 &, T1)> f1,
std::function<std::pair<bool, std::string>(const T1 &, T1)> f2)
: Tester(args), init_buf{f1}, verify_buf{f2} {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
source_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
dest_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
source_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
dest_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
}
template <typename T1>
AlltoallTester<T1>::~AlltoallTester() {
roc_shmem_free(source_buf);
roc_shmem_free(dest_buf);
rocshmem_free(source_buf);
rocshmem_free(dest_buf);
}
template <typename T1>
void AlltoallTester<T1>::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
bw_factor = sizeof(T1) * n_pes;
team_alltoall_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_alltoall_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_alltoall_world_dup);
}
@@ -135,12 +135,12 @@ void AlltoallTester<T1>::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
template <typename T1>
void AlltoallTester<T1>::postLaunchKernel() {
roc_shmem_team_destroy(team_alltoall_world_dup);
rocshmem_team_destroy(team_alltoall_world_dup);
}
template <typename T1>
void AlltoallTester<T1>::resetBuffers(uint64_t size) {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
for (int i = 0; i < n_pes; i++) {
for (int j = 0; j < size; j++) {
init_buf(source_buf[i * size + j], dest_buf[i * size + j], (T1)i);
@@ -150,7 +150,7 @@ void AlltoallTester<T1>::resetBuffers(uint64_t size) {
template <typename T1>
void AlltoallTester<T1>::verifyResults(uint64_t size) {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
for (int i = 0; i < n_pes; i++) {
for (int j = 0; j < size; j++) {
auto r = verify_buf(dest_buf[i * size + j], i);
+19 -19
View File
@@ -23,7 +23,7 @@
#include "amo_bitwise_tester.hpp"
#include <iostream>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -41,13 +41,13 @@ __global__ void AMOBitwiseTest(int loop, int skip, uint64_t *timer, char *r_buf,
template <typename T>
AMOBitwiseTester<T>::AMOBitwiseTester(TesterArguments args) : Tester(args) {
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
_r_buf = (char *)rocshmem_malloc(args.max_msg_size);
_s_buf = (T *)rocshmem_malloc(args.max_msg_size * args.num_wgs);
}
template <typename T>
AMOBitwiseTester<T>::~AMOBitwiseTester() {
roc_shmem_free(_r_buf);
rocshmem_free(_r_buf);
CHECK_HIP(hipFree(_ret_val));
}
@@ -125,48 +125,48 @@ void AMOBitwiseTester<T>::verifyResults(uint64_t size) {
__global__ void AMOBitwiseTest<T>( \
int loop, int skip, uint64_t *timer, char *r_buf, T *s_buf, T *ret_val, \
TestType type, ShmemContextType ctx_type) { \
__shared__ roc_shmem_ctx_t ctx; \
roc_shmem_wg_init(); \
roc_shmem_wg_ctx_create(ctx_type, &ctx); \
__shared__ rocshmem_ctx_t ctx; \
rocshmem_wg_init(); \
rocshmem_wg_ctx_create(ctx_type, &ctx); \
if (hipThreadIdx_x == 0) { \
uint64_t start; \
T ret = 0; \
T cond = 0; \
for (int i = 0; i < loop + skip; i++) { \
if (i == skip) start = roc_shmem_timer(); \
if (i == skip) start = rocshmem_timer(); \
switch (type) { \
case AMO_FetchAndTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_fetch_and(ctx, (T *)r_buf, \
ret = rocshmem_ctx_##TNAME##_atomic_fetch_and(ctx, (T *)r_buf, \
0xFFFF, 1); \
break; \
case AMO_AndTestType: \
roc_shmem_ctx_##TNAME##_atomic_and(ctx, (T *)r_buf, 0xFFFF, 1); \
rocshmem_ctx_##TNAME##_atomic_and(ctx, (T *)r_buf, 0xFFFF, 1); \
break; \
case AMO_FetchOrTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_fetch_or(ctx, (T *)r_buf, \
ret = rocshmem_ctx_##TNAME##_atomic_fetch_or(ctx, (T *)r_buf, \
0xFFFF, 1); \
break; \
case AMO_OrTestType: \
roc_shmem_ctx_##TNAME##_atomic_or(ctx, (T *)r_buf, 0xFFFF, 1); \
rocshmem_ctx_##TNAME##_atomic_or(ctx, (T *)r_buf, 0xFFFF, 1); \
break; \
case AMO_FetchXorTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_fetch_xor(ctx, (T *)r_buf, \
ret = rocshmem_ctx_##TNAME##_atomic_fetch_xor(ctx, (T *)r_buf, \
0xFFFF, 1); \
break; \
case AMO_XorTestType: \
roc_shmem_ctx_##TNAME##_atomic_xor(ctx, (T *)r_buf, 0xFFFF, 1); \
rocshmem_ctx_##TNAME##_atomic_xor(ctx, (T *)r_buf, 0xFFFF, 1); \
break; \
default: \
break; \
} \
} \
roc_shmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = roc_shmem_timer() - start; \
rocshmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = rocshmem_timer() - start; \
ret_val[hipBlockIdx_x] = ret; \
roc_shmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
rocshmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
} \
roc_shmem_wg_ctx_destroy(&ctx); \
roc_shmem_wg_finalize(); \
rocshmem_wg_ctx_destroy(&ctx); \
rocshmem_wg_finalize(); \
} \
template class AMOBitwiseTester<T>;
+16 -16
View File
@@ -23,7 +23,7 @@
#include "amo_extended_tester.hpp"
#include <iostream>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -41,13 +41,13 @@ __global__ void AMOExtendedTest(int loop, int skip, uint64_t *timer,
template <typename T>
AMOExtendedTester<T>::AMOExtendedTester(TesterArguments args) : Tester(args) {
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
_r_buf = (char *)rocshmem_malloc(args.max_msg_size);
_s_buf = (T *)rocshmem_malloc(args.max_msg_size * args.num_wgs);
}
template <typename T>
AMOExtendedTester<T>::~AMOExtendedTester() {
roc_shmem_free(_r_buf);
rocshmem_free(_r_buf);
CHECK_HIP(hipFree(_ret_val));
}
@@ -113,37 +113,37 @@ void AMOExtendedTester<T>::verifyResults(uint64_t size) {
__global__ void AMOExtendedTest<T>( \
int loop, int skip, uint64_t *timer, char *r_buf, T *s_buf, T *ret_val, \
TestType type, ShmemContextType ctx_type) { \
__shared__ roc_shmem_ctx_t ctx; \
roc_shmem_wg_init(); \
roc_shmem_wg_ctx_create(ctx_type, &ctx); \
__shared__ rocshmem_ctx_t ctx; \
rocshmem_wg_init(); \
rocshmem_wg_ctx_create(ctx_type, &ctx); \
if (hipThreadIdx_x == 0) { \
uint64_t start; \
T ret = 0; \
T cond = 0; \
for (int i = 0; i < loop + skip; i++) { \
if (i == skip) start = roc_shmem_timer(); \
if (i == skip) start = rocshmem_timer(); \
switch (type) { \
case AMO_FetchTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_fetch(ctx, (T *)r_buf, 1); \
ret = rocshmem_ctx_##TNAME##_atomic_fetch(ctx, (T *)r_buf, 1); \
break; \
case AMO_SetTestType: \
roc_shmem_ctx_##TNAME##_atomic_set(ctx, (T *)r_buf, 44, 1); \
rocshmem_ctx_##TNAME##_atomic_set(ctx, (T *)r_buf, 44, 1); \
break; \
case AMO_SwapTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_swap(ctx, (T *)r_buf, \
ret = rocshmem_ctx_##TNAME##_atomic_swap(ctx, (T *)r_buf, \
ret + 1, 1); \
break; \
default: \
break; \
} \
} \
roc_shmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = roc_shmem_timer() - start; \
rocshmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = rocshmem_timer() - start; \
ret_val[hipBlockIdx_x] = ret; \
roc_shmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
rocshmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
} \
roc_shmem_wg_ctx_destroy(&ctx); \
roc_shmem_wg_finalize(); \
rocshmem_wg_ctx_destroy(&ctx); \
rocshmem_wg_finalize(); \
} \
template class AMOExtendedTester<T>;
+18 -18
View File
@@ -23,7 +23,7 @@
#include "amo_standard_tester.hpp"
#include <iostream>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -41,13 +41,13 @@ __global__ void AMOStandardTest(int loop, int skip, uint64_t *timer,
template <typename T>
AMOStandardTester<T>::AMOStandardTester(TesterArguments args) : Tester(args) {
CHECK_HIP(hipMalloc((void **)&_ret_val, args.max_msg_size * args.num_wgs));
_r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
_s_buf = (T *)roc_shmem_malloc(args.max_msg_size * args.num_wgs);
_r_buf = (char *)rocshmem_malloc(args.max_msg_size);
_s_buf = (T *)rocshmem_malloc(args.max_msg_size * args.num_wgs);
}
template <typename T>
AMOStandardTester<T>::~AMOStandardTester() {
roc_shmem_free(_r_buf);
rocshmem_free(_r_buf);
CHECK_HIP(hipFree(_ret_val));
}
@@ -121,46 +121,46 @@ void AMOStandardTester<T>::verifyResults(uint64_t size) {
__global__ void AMOStandardTest<T>( \
int loop, int skip, uint64_t *timer, char *r_buf, T *s_buf, T *ret_val, \
TestType type, ShmemContextType ctx_type) { \
__shared__ roc_shmem_ctx_t ctx; \
roc_shmem_wg_init(); \
roc_shmem_wg_ctx_create(ctx_type, &ctx); \
__shared__ rocshmem_ctx_t ctx; \
rocshmem_wg_init(); \
rocshmem_wg_ctx_create(ctx_type, &ctx); \
if (hipThreadIdx_x == 0) { \
uint64_t start; \
T ret = 0; \
T cond = 0; \
for (int i = 0; i < loop + skip; i++) { \
if (i == skip) start = roc_shmem_timer(); \
if (i == skip) start = rocshmem_timer(); \
switch (type) { \
case AMO_FAddTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_fetch_add(ctx, (T *)r_buf, 2, \
ret = rocshmem_ctx_##TNAME##_atomic_fetch_add(ctx, (T *)r_buf, 2, \
1); \
break; \
case AMO_FIncTestType: \
ret = \
roc_shmem_ctx_##TNAME##_atomic_fetch_inc(ctx, (T *)r_buf, 1); \
rocshmem_ctx_##TNAME##_atomic_fetch_inc(ctx, (T *)r_buf, 1); \
break; \
case AMO_FCswapTestType: \
ret = roc_shmem_ctx_##TNAME##_atomic_compare_swap(ctx, (T *)r_buf, \
ret = rocshmem_ctx_##TNAME##_atomic_compare_swap(ctx, (T *)r_buf, \
cond, (T)i, 1); \
cond = i; \
break; \
case AMO_AddTestType: \
roc_shmem_ctx_##TNAME##_atomic_add(ctx, (T *)r_buf, 2, 1); \
rocshmem_ctx_##TNAME##_atomic_add(ctx, (T *)r_buf, 2, 1); \
break; \
case AMO_IncTestType: \
roc_shmem_ctx_##TNAME##_atomic_inc(ctx, (T *)r_buf, 1); \
rocshmem_ctx_##TNAME##_atomic_inc(ctx, (T *)r_buf, 1); \
break; \
default: \
break; \
} \
} \
roc_shmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = roc_shmem_timer() - start; \
rocshmem_ctx_quiet(ctx); \
timer[hipBlockIdx_x] = rocshmem_timer() - start; \
ret_val[hipBlockIdx_x] = ret; \
roc_shmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
rocshmem_ctx_getmem(ctx, &s_buf[hipBlockIdx_x], r_buf, sizeof(T), 1); \
} \
roc_shmem_wg_ctx_destroy(&ctx); \
roc_shmem_wg_finalize(); \
rocshmem_wg_ctx_destroy(&ctx); \
rocshmem_wg_finalize(); \
} \
template class AMOStandardTester<T>;
@@ -22,7 +22,7 @@
#include "barrier_all_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -30,29 +30,29 @@ using namespace rocshmem;
* DEVICE TEST KERNEL
*****************************************************************************/
__global__ void BarrierAllTest(int loop, int skip, uint64_t *timer) {
__shared__ roc_shmem_ctx_t ctx;
__shared__ rocshmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ROC_SHMEM_CTX_WG_PRIVATE, &ctx);
rocshmem_wg_init();
rocshmem_wg_ctx_create(ROCSHMEM_CTX_WG_PRIVATE, &ctx);
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (hipThreadIdx_x == 0 && i == skip) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
__syncthreads();
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();
}
/******************************************************************************
+6 -6
View File
@@ -22,7 +22,7 @@
#include "empty_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -31,12 +31,12 @@ using namespace rocshmem;
*****************************************************************************/
__global__ void EmptyTest(int loop, int skip, uint64_t *timer, int size,
TestType type, ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
/******************************************************************************
+17 -17
View File
@@ -22,7 +22,7 @@
#include "extended_primitives.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <numeric>
@@ -35,9 +35,9 @@ __global__ void ExtendedPrimitiveTest(int loop, int skip, uint64_t *timer,
char *s_buf, char *r_buf, int size,
TestType type,
ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
/**
* Calculate start index for each work group for tiled version
@@ -50,34 +50,34 @@ __global__ void ExtendedPrimitiveTest(int loop, int skip, uint64_t *timer,
r_buf += idx;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) start = roc_shmem_timer();
if (i == skip) start = rocshmem_timer();
switch (type) {
case WGGetTestType:
roc_shmem_ctx_getmem_wg(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_wg(ctx, r_buf, s_buf, size, 1);
break;
case WGGetNBITestType:
roc_shmem_ctx_getmem_nbi_wg(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_nbi_wg(ctx, r_buf, s_buf, size, 1);
break;
case WGPutTestType:
roc_shmem_ctx_putmem_wg(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_wg(ctx, r_buf, s_buf, size, 1);
break;
case WGPutNBITestType:
roc_shmem_ctx_putmem_nbi_wg(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_nbi_wg(ctx, r_buf, s_buf, size, 1);
break;
default:
break;
}
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
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();
}
/******************************************************************************
@@ -85,13 +85,13 @@ __global__ void ExtendedPrimitiveTest(int loop, int skip, uint64_t *timer,
*****************************************************************************/
ExtendedPrimitiveTester::ExtendedPrimitiveTester(TesterArguments args)
: Tester(args) {
s_buf = static_cast<int*>(roc_shmem_malloc(args.max_msg_size * args.num_wgs));
r_buf = static_cast<int*>(roc_shmem_malloc(args.max_msg_size * args.num_wgs));
s_buf = static_cast<int*>(rocshmem_malloc(args.max_msg_size * args.num_wgs));
r_buf = static_cast<int*>(rocshmem_malloc(args.max_msg_size * args.num_wgs));
}
ExtendedPrimitiveTester::~ExtendedPrimitiveTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
void ExtendedPrimitiveTester::resetBuffers(uint64_t size) {
+28 -28
View File
@@ -22,21 +22,21 @@
using namespace rocshmem;
roc_shmem_team_t team_fcollect_world_dup;
rocshmem_team_t team_fcollect_world_dup;
/* Declare the template with a generic implementation */
template <typename T>
__device__ void wg_fcollect(roc_shmem_ctx_t ctx, roc_shmem_team_t team, T *dest,
__device__ void wg_fcollect(rocshmem_ctx_t ctx, rocshmem_team_t team, T *dest,
const T *source, int nelems) {
return;
}
/* Define templates to call ROC_SHMEM */
#define FCOLLECT_DEF_GEN(T, TNAME) \
template <> \
__device__ void wg_fcollect<T>(roc_shmem_ctx_t ctx, roc_shmem_team_t team, \
T * dest, const T *source, int nelem) { \
roc_shmem_ctx_##TNAME##_wg_fcollect(ctx, team, dest, source, nelem); \
/* Define templates to call rocSHMEM */
#define FCOLLECT_DEF_GEN(T, TNAME) \
template <> \
__device__ void wg_fcollect<T>(rocshmem_ctx_t ctx, rocshmem_team_t team, \
T * dest, const T *source, int nelem) { \
rocshmem_ctx_##TNAME##_wg_fcollect(ctx, team, dest, source, nelem); \
}
FCOLLECT_DEF_GEN(float, float)
@@ -60,19 +60,19 @@ FCOLLECT_DEF_GEN(unsigned long long, ulonglong)
template <typename T1>
__global__ void FcollectTest(int loop, int skip, uint64_t *timer,
T1 *source_buf, T1 *dest_buf, int size,
ShmemContextType ctx_type, roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
ShmemContextType ctx_type, 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_fcollect<T1>(ctx, team,
dest_buf, // T* dest
@@ -83,11 +83,11 @@ __global__ void FcollectTest(int loop, int skip, uint64_t *timer,
__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();
}
/******************************************************************************
@@ -98,24 +98,24 @@ FcollectTester<T1>::FcollectTester(
TesterArguments args, std::function<void(T1 &, T1 &)> f1,
std::function<std::pair<bool, std::string>(const T1 &, T1)> f2)
: Tester(args), init_buf{f1}, verify_buf{f2} {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
source_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1));
dest_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
source_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1));
dest_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1) * n_pes);
}
template <typename T1>
FcollectTester<T1>::~FcollectTester() {
roc_shmem_free(source_buf);
roc_shmem_free(dest_buf);
rocshmem_free(source_buf);
rocshmem_free(dest_buf);
}
template <typename T1>
void FcollectTester<T1>::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
bw_factor = sizeof(T1) * n_pes;
team_fcollect_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_fcollect_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_fcollect_world_dup);
}
@@ -134,12 +134,12 @@ void FcollectTester<T1>::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
template <typename T1>
void FcollectTester<T1>::postLaunchKernel() {
roc_shmem_team_destroy(team_fcollect_world_dup);
rocshmem_team_destroy(team_fcollect_world_dup);
}
template <typename T1>
void FcollectTester<T1>::resetBuffers(uint64_t size) {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
for (int i = 0; i < n_pes; i++) {
for (int j = 0; j < size; j++) {
// Note: This is redundant work,
@@ -151,7 +151,7 @@ void FcollectTester<T1>::resetBuffers(uint64_t size) {
template <typename T1>
void FcollectTester<T1>::verifyResults(uint64_t size) {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
for (int i = 0; i < n_pes; i++) {
for (int j = 0; j < size; j++) {
auto r = verify_buf(dest_buf[i * size + j], i);
+16 -16
View File
@@ -22,7 +22,7 @@
#include "ping_all_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -31,13 +31,13 @@ using namespace rocshmem;
*****************************************************************************/
__global__ void PingAllTest(int loop, int skip, uint64_t *timer, int *r_buf,
ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
__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 pe = roc_shmem_ctx_my_pe(ctx);
int num_pe = roc_shmem_ctx_n_pes(ctx);
int pe = rocshmem_ctx_my_pe(ctx);
int num_pe = rocshmem_ctx_n_pes(ctx);
int status[1024];
for (int j{0}; j < num_pe; j++) {
status[j] = 0;
@@ -49,32 +49,32 @@ __global__ void PingAllTest(int loop, int skip, uint64_t *timer, int *r_buf,
for (int i = 0; i < loop + skip; i++) {
if (i == skip) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
for (int j{0}; j < num_pe; j++) {
roc_shmem_ctx_int_p(ctx, &r_buf[blk_pe_off + pe], 1, j);
rocshmem_ctx_int_p(ctx, &r_buf[blk_pe_off + pe], 1, j);
}
roc_shmem_int_wait_until_all(&r_buf[blk_pe_off], num_pe, status, ROC_SHMEM_CMP_EQ, 1);
rocshmem_int_wait_until_all(&r_buf[blk_pe_off], num_pe, status, ROCSHMEM_CMP_EQ, 1);
}
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
*****************************************************************************/
PingAllTester::PingAllTester(TesterArguments args) : Tester(args) {
int num_pes {roc_shmem_n_pes()};
r_buf = (int *)roc_shmem_malloc(sizeof(int) * args.wg_size * num_pes);
int num_pes {rocshmem_n_pes()};
r_buf = (int *)rocshmem_malloc(sizeof(int) * args.wg_size * num_pes);
}
PingAllTester::~PingAllTester() { roc_shmem_free(r_buf); }
PingAllTester::~PingAllTester() { rocshmem_free(r_buf); }
void PingAllTester::resetBuffers(uint64_t size) {
int num_pes {roc_shmem_n_pes()};
int num_pes {rocshmem_n_pes()};
memset(r_buf, 0, sizeof(int) * args.wg_size * num_pes);
}
+15 -15
View File
@@ -22,7 +22,7 @@
#include "ping_pong_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -31,45 +31,45 @@ using namespace rocshmem;
*****************************************************************************/
__global__ void PingPongTest(int loop, int skip, uint64_t *timer, int *r_buf,
ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
__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 pe = roc_shmem_ctx_my_pe(ctx);
int pe = rocshmem_ctx_my_pe(ctx);
if (hipThreadIdx_x == 0) {
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
if (pe == 0) {
roc_shmem_ctx_int_p(ctx, &r_buf[hipBlockIdx_x], i + 1, 1);
roc_shmem_int_wait_until(&r_buf[hipBlockIdx_x], ROC_SHMEM_CMP_EQ,
rocshmem_ctx_int_p(ctx, &r_buf[hipBlockIdx_x], i + 1, 1);
rocshmem_int_wait_until(&r_buf[hipBlockIdx_x], ROCSHMEM_CMP_EQ,
i + 1);
} else {
roc_shmem_int_wait_until(&r_buf[hipBlockIdx_x], ROC_SHMEM_CMP_EQ,
rocshmem_int_wait_until(&r_buf[hipBlockIdx_x], ROCSHMEM_CMP_EQ,
i + 1);
roc_shmem_ctx_int_p(ctx, &r_buf[hipBlockIdx_x], i + 1, 0);
rocshmem_ctx_int_p(ctx, &r_buf[hipBlockIdx_x], i + 1, 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
*****************************************************************************/
PingPongTester::PingPongTester(TesterArguments args) : Tester(args) {
r_buf = (int *)roc_shmem_malloc(sizeof(int) * args.wg_size);
r_buf = (int *)rocshmem_malloc(sizeof(int) * args.wg_size);
}
PingPongTester::~PingPongTester() { roc_shmem_free(r_buf); }
PingPongTester::~PingPongTester() { rocshmem_free(r_buf); }
void PingPongTester::resetBuffers(uint64_t size) {
memset(r_buf, 0, sizeof(int) * args.wg_size);
+14 -14
View File
@@ -22,7 +22,7 @@
#include "primitive_mr_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -32,42 +32,42 @@ using namespace rocshmem;
__global__ void PrimitiveMRTest(int loop, uint64_t *timer, char *s_buf,
char *r_buf, int size,
ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
if (hipThreadIdx_x == 0) {
uint64_t start;
start = roc_shmem_timer();
start = rocshmem_timer();
for (int win_i = 0; win_i < 64 * loop; win_i++) {
for (int i = 0; i < 64; i++) {
roc_shmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
}
timer[hipBlockIdx_x] = roc_shmem_timer() - start;
timer[hipBlockIdx_x] = rocshmem_timer() - start;
}
__syncthreads();
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
/******************************************************************************
* HOST TESTER CLASS METHODS
*****************************************************************************/
PrimitiveMRTester::PrimitiveMRTester(TesterArguments args) : Tester(args) {
s_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
s_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
}
PrimitiveMRTester::~PrimitiveMRTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
void PrimitiveMRTester::resetBuffers(size_t size) {
+19 -19
View File
@@ -22,7 +22,7 @@
#include "primitive_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -32,40 +32,40 @@ using namespace rocshmem;
__global__ void PrimitiveTest(int loop, int skip, uint64_t *timer, char *s_buf,
char *r_buf, int size, TestType type,
ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) {
__syncthreads();
start = roc_shmem_timer();
start = rocshmem_timer();
}
switch (type) {
case GetTestType:
roc_shmem_ctx_getmem(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem(ctx, r_buf, s_buf, size, 1);
break;
case GetNBITestType:
roc_shmem_ctx_getmem_nbi(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_nbi(ctx, r_buf, s_buf, size, 1);
break;
case PutTestType:
roc_shmem_ctx_putmem(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem(ctx, r_buf, s_buf, size, 1);
break;
case PutNBITestType:
roc_shmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
break;
case PTestType:
for (int s = 0; s < size; s++) {
char val = s_buf[s];
roc_shmem_ctx_char_p(ctx, &r_buf[s], val, 1);
rocshmem_ctx_char_p(ctx, &r_buf[s], val, 1);
}
break;
case GTestType:
for (int s = 0; s < size; s++) {
char ret = roc_shmem_ctx_char_g(ctx, &s_buf[s], 1);
char ret = rocshmem_ctx_char_g(ctx, &s_buf[s], 1);
r_buf[s] = ret;
}
break;
@@ -74,29 +74,29 @@ __global__ void PrimitiveTest(int loop, int skip, uint64_t *timer, char *s_buf,
}
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(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
*****************************************************************************/
PrimitiveTester::PrimitiveTester(TesterArguments args) : Tester(args) {
s_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
s_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
}
PrimitiveTester::~PrimitiveTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
void PrimitiveTester::resetBuffers(uint64_t size) {
+16 -16
View File
@@ -21,7 +21,7 @@
*****************************************************************************/
#include "random_access_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -55,11 +55,11 @@ __global__ void RandomAccessTest(int loop, int skip, uint64_t *timer,
uint32_t *threads_bins, uint32_t *off_bins,
uint32_t *PE_bins, ShmemContextType ctx_type) {
uint64_t start;
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
int pe = roc_shmem_ctx_my_pe(ctx);
int pe = rocshmem_ctx_my_pe(ctx);
int offset;
int PE;
@@ -69,26 +69,26 @@ __global__ void RandomAccessTest(int loop, int skip, uint64_t *timer,
r_buf = r_buf + offset;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) start = roc_shmem_timer();
if (i == skip) start = rocshmem_timer();
switch (type) {
case GetType:
roc_shmem_ctx_getmem(ctx, r_buf, s_buf, size, PE);
rocshmem_ctx_getmem(ctx, r_buf, s_buf, size, PE);
break;
case PutType:
roc_shmem_ctx_putmem(ctx, (char *)r_buf, (char *)s_buf, size, PE);
rocshmem_ctx_putmem(ctx, (char *)r_buf, (char *)s_buf, size, PE);
break;
default:
break;
}
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
atomicAdd((unsigned long long *)&timer[hipBlockIdx_x],
roc_shmem_timer() - start);
rocshmem_timer() - start);
}
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
/******************************************************************************
@@ -131,8 +131,8 @@ RandomAccessTester::RandomAccessTester(TesterArguments args) : Tester(args) {
_num_bins = args.thread_access / args.coal_coef;
assert((args.wg_size / 64) <= 1);
s_buf = (int *)roc_shmem_malloc(max_size * wg_size * space);
r_buf = (int *)roc_shmem_malloc(max_size * wg_size * space);
s_buf = (int *)rocshmem_malloc(max_size * wg_size * space);
r_buf = (int *)rocshmem_malloc(max_size * wg_size * space);
h_buf = (int *)malloc(max_size * wg_size * space);
h_dev_buf = (int *)malloc(max_size * wg_size * space);
CHECK_HIP(hipMalloc((void **)&_threads_bins, sizeof(uint32_t) * _num_waves * _num_bins));
@@ -144,8 +144,8 @@ RandomAccessTester::RandomAccessTester(TesterArguments args) : Tester(args) {
}
RandomAccessTester::~RandomAccessTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
free(h_buf);
free(h_dev_buf);
CHECK_HIP(hipFree(_threads_bins));
+6 -6
View File
@@ -21,7 +21,7 @@
*****************************************************************************/
#include "shmem_ptr_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -29,18 +29,18 @@ using namespace rocshmem;
* DEVICE TEST KERNEL
*****************************************************************************/
__global__ void ShmemPtrTest(char *r_buf, int *available) {
roc_shmem_wg_init();
rocshmem_wg_init();
if (hipThreadIdx_x == 0) {
char *local_addr = r_buf + 4;
void *remote_addr = roc_shmem_ptr((void *)local_addr, 1);
void *remote_addr = rocshmem_ptr((void *)local_addr, 1);
if (remote_addr != NULL) {
*available = 1;
((char *)remote_addr)[0] = '1';
}
}
roc_shmem_wg_finalize();
rocshmem_wg_finalize();
}
/******************************************************************************
@@ -48,12 +48,12 @@ __global__ void ShmemPtrTest(char *r_buf, int *available) {
*****************************************************************************/
ShmemPtrTester::ShmemPtrTester(TesterArguments args) : Tester(args) {
CHECK_HIP(hipMalloc((void **)&_available, sizeof(int)));
r_buf = (char *)roc_shmem_malloc(args.max_msg_size);
r_buf = (char *)rocshmem_malloc(args.max_msg_size);
}
ShmemPtrTester::~ShmemPtrTester() {
CHECK_HIP(hipFree(_available));
roc_shmem_free(r_buf);
rocshmem_free(r_buf);
}
void ShmemPtrTester::resetBuffers(uint64_t size) {
+10 -10
View File
@@ -22,7 +22,7 @@
#include "swarm_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
@@ -31,13 +31,13 @@ using namespace rocshmem;
*****************************************************************************/
__global__ void GetSwarmTest(int loop, int skip, uint64_t *timer, char *s_buf,
char *r_buf, int size, ShmemContextType ctx_type) {
__shared__ roc_shmem_ctx_t ctx;
__shared__ rocshmem_ctx_t ctx;
int provided;
roc_shmem_wg_init_thread(ROC_SHMEM_THREAD_MULTIPLE, &provided);
assert(provided == ROC_SHMEM_THREAD_MULTIPLE);
rocshmem_wg_init_thread(ROCSHMEM_THREAD_MULTIPLE, &provided);
assert(provided == ROCSHMEM_THREAD_MULTIPLE);
roc_shmem_wg_ctx_create(ctx_type, &ctx);
rocshmem_wg_ctx_create(ctx_type, &ctx);
__syncthreads();
@@ -45,18 +45,18 @@ __global__ void GetSwarmTest(int loop, int skip, uint64_t *timer, char *s_buf,
uint64_t start = 0;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) start = roc_shmem_timer();
if (i == skip) start = rocshmem_timer();
roc_shmem_ctx_getmem(ctx, &r_buf[index], &s_buf[index], size, 1);
rocshmem_ctx_getmem(ctx, &r_buf[index], &s_buf[index], size, 1);
__syncthreads();
}
atomicAdd((unsigned long long *)&timer[hipBlockIdx_x],
roc_shmem_timer() - start);
rocshmem_timer() - start);
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
/******************************************************************************
+15 -15
View File
@@ -22,33 +22,33 @@
#include "sync_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
roc_shmem_team_t team_sync_world_dup;
rocshmem_team_t team_sync_world_dup;
/******************************************************************************
* DEVICE TEST KERNEL
*****************************************************************************/
__global__ void SyncTest(int loop, int skip, uint64_t *timer, TestType type,
ShmemContextType ctx_type, roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
ShmemContextType ctx_type, rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (hipThreadIdx_x == 0 && i == skip) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
__syncthreads();
switch (type) {
case SyncAllTestType:
roc_shmem_ctx_wg_sync_all(ctx);
rocshmem_ctx_wg_sync_all(ctx);
break;
case SyncTestType:
roc_shmem_ctx_wg_team_sync(ctx, team);
rocshmem_ctx_wg_team_sync(ctx, team);
break;
default:
break;
@@ -57,11 +57,11 @@ __global__ void SyncTest(int loop, int skip, uint64_t *timer, TestType type,
__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();
}
/******************************************************************************
@@ -77,10 +77,10 @@ void SyncTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
uint64_t size) {
size_t shared_bytes = 0;
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
team_sync_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_sync_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_sync_world_dup);
hipLaunchKernelGGL(SyncTest, gridSize, blockSize, shared_bytes, stream, loop,
@@ -24,20 +24,20 @@ using namespace rocshmem;
/* Declare the template with a generic implementation */
template <typename T>
__device__ void wg_team_broadcast(roc_shmem_ctx_t ctx, roc_shmem_team_t team,
__device__ void wg_team_broadcast(rocshmem_ctx_t ctx, rocshmem_team_t team,
T *dest, const T *source, int nelem,
int pe_root) {
return;
}
/* Define templates to call ROC_SHMEM */
#define TEAM_BROADCAST_DEF_GEN(T, TNAME) \
template <> \
__device__ void wg_team_broadcast<T>( \
roc_shmem_ctx_t ctx, roc_shmem_team_t team, T * dest, const T *source, \
int nelem, int pe_root) { \
roc_shmem_ctx_##TNAME##_wg_broadcast(ctx, team, dest, source, nelem, \
pe_root); \
/* Define templates to call ROCSHMEM */
#define TEAM_BROADCAST_DEF_GEN(T, TNAME) \
template <> \
__device__ void wg_team_broadcast<T>( \
rocshmem_ctx_t ctx, rocshmem_team_t team, T * dest, const T *source, \
int nelem, int pe_root) { \
rocshmem_ctx_##TNAME##_wg_broadcast(ctx, team, dest, source, nelem, \
pe_root); \
}
TEAM_BROADCAST_DEF_GEN(float, float)
@@ -55,7 +55,7 @@ TEAM_BROADCAST_DEF_GEN(unsigned int, uint)
TEAM_BROADCAST_DEF_GEN(unsigned long, ulong)
TEAM_BROADCAST_DEF_GEN(unsigned long long, ulonglong)
roc_shmem_team_t team_bcast_world_dup;
rocshmem_team_t team_bcast_world_dup;
/******************************************************************************
* DEVICE TEST KERNEL
@@ -64,20 +64,20 @@ template <typename T1>
__global__ void TeamBroadcastTest(int loop, int skip, uint64_t *timer,
T1 *source_buf, T1 *dest_buf, int size,
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; i++) {
if (i == skip && hipThreadIdx_x == 0) {
start = roc_shmem_timer();
start = rocshmem_timer();
}
wg_team_broadcast<T1>(ctx, team,
@@ -85,17 +85,17 @@ __global__ void TeamBroadcastTest(int loop, int skip, uint64_t *timer,
source_buf, // const T* source
size, // int nelement
0); // int PE_root
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();
}
/******************************************************************************
@@ -106,22 +106,22 @@ TeamBroadcastTester<T1>::TeamBroadcastTester(
TesterArguments args, std::function<void(T1 &, T1 &)> f1,
std::function<std::pair<bool, std::string>(const T1 &)> f2)
: Tester(args), init_buf{f1}, verify_buf{f2} {
source_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1));
dest_buf = (T1 *)roc_shmem_malloc(args.max_msg_size * sizeof(T1));
source_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1));
dest_buf = (T1 *)rocshmem_malloc(args.max_msg_size * sizeof(T1));
}
template <typename T1>
TeamBroadcastTester<T1>::~TeamBroadcastTester() {
roc_shmem_free(source_buf);
roc_shmem_free(dest_buf);
rocshmem_free(source_buf);
rocshmem_free(dest_buf);
}
template <typename T1>
void TeamBroadcastTester<T1>::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
team_bcast_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_bcast_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_bcast_world_dup);
}
@@ -140,7 +140,7 @@ void TeamBroadcastTester<T1>::launchKernel(dim3 gridSize, dim3 blockSize,
template <typename T1>
void TeamBroadcastTester<T1>::postLaunchKernel() {
roc_shmem_team_destroy(team_bcast_world_dup);
rocshmem_team_destroy(team_bcast_world_dup);
}
template <typename T1>
@@ -24,34 +24,34 @@
#include <stdlib.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
/* this constant should equal ROC_SHMEM_MAX_NUM_TEAMS-1 */
/* this constant should equal ROCSHMEM_MAX_NUM_TEAMS-1 */
#define NUM_TEAMS 39
roc_shmem_team_t team_world_dup[NUM_TEAMS];
rocshmem_team_t team_world_dup[NUM_TEAMS];
/******************************************************************************
* DEVICE TEST KERNEL
*****************************************************************************/
__global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
roc_shmem_team_t *team) {
__shared__ roc_shmem_ctx_t ctx1, ctx2, ctx3;
__shared__ roc_shmem_ctx_t ctx[NUM_TEAMS];
rocshmem_team_t *team) {
__shared__ rocshmem_ctx_t ctx1, ctx2, ctx3;
__shared__ rocshmem_ctx_t ctx[NUM_TEAMS];
roc_shmem_wg_init();
rocshmem_wg_init();
/**
* Test 1: Assert team infos of different ctxs
* from the same team are the same.
*/
roc_shmem_wg_team_create_ctx(team[0], ctx_type, &ctx1);
roc_shmem_wg_team_create_ctx(team[0], ctx_type, &ctx2);
roc_shmem_wg_ctx_destroy(&ctx1);
roc_shmem_wg_team_create_ctx(team[0], ctx_type, &ctx3);
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx1);
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx2);
rocshmem_wg_ctx_destroy(&ctx1);
rocshmem_wg_team_create_ctx(team[0], ctx_type, &ctx3);
__syncthreads();
@@ -60,8 +60,8 @@ __global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
abort();
}
roc_shmem_wg_ctx_destroy(&ctx2);
roc_shmem_wg_ctx_destroy(&ctx3);
rocshmem_wg_ctx_destroy(&ctx2);
rocshmem_wg_ctx_destroy(&ctx3);
__syncthreads();
@@ -70,7 +70,7 @@ __global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
* from different teams are different.
*/
for (int team_i = 0; team_i < NUM_TEAMS; team_i++) {
roc_shmem_wg_team_create_ctx(team[team_i], ctx_type, &ctx[team_i]);
rocshmem_wg_team_create_ctx(team[team_i], ctx_type, &ctx[team_i]);
}
if (ctx[0].team_opaque == ctx[NUM_TEAMS - 1].team_opaque) {
@@ -82,10 +82,10 @@ __global__ void TeamCtxInfraTest(ShmemContextType ctx_type,
__syncthreads();
for (int team_i = 0; team_i < NUM_TEAMS; team_i++) {
roc_shmem_wg_ctx_destroy(&ctx[team_i]);
rocshmem_wg_ctx_destroy(&ctx[team_i]);
}
roc_shmem_wg_finalize();
rocshmem_wg_finalize();
}
/******************************************************************************
@@ -98,23 +98,23 @@ TeamCtxInfraTester::~TeamCtxInfraTester() {}
void TeamCtxInfraTester::resetBuffers(uint64_t size) {}
void TeamCtxInfraTester::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
for (int team_i = 0; team_i < NUM_TEAMS; team_i++) {
team_world_dup[team_i] = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_world_dup[team_i] = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_world_dup[team_i]);
if (team_world_dup[team_i] == ROC_SHMEM_TEAM_INVALID) {
if (team_world_dup[team_i] == ROCSHMEM_TEAM_INVALID) {
printf("Team %d is invalid!\n", team_i);
abort();
}
}
/* Assert the failure of a new team creation. */
roc_shmem_team_t new_team = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
rocshmem_team_t new_team = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&new_team);
if (new_team != ROC_SHMEM_TEAM_INVALID) {
if (new_team != ROCSHMEM_TEAM_INVALID) {
printf("new team is not invalid\n");
abort();
}
@@ -125,10 +125,10 @@ void TeamCtxInfraTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
size_t shared_bytes = 0;
/* Copy array of teams to device */
roc_shmem_team_t *teams_on_device;
CHECK_HIP(hipMalloc(&teams_on_device, sizeof(roc_shmem_team_t) * NUM_TEAMS));
rocshmem_team_t *teams_on_device;
CHECK_HIP(hipMalloc(&teams_on_device, sizeof(rocshmem_team_t) * NUM_TEAMS));
CHECK_HIP(hipMemcpy(teams_on_device, team_world_dup,
sizeof(roc_shmem_team_t) * NUM_TEAMS, hipMemcpyHostToDevice));
sizeof(rocshmem_team_t) * NUM_TEAMS, hipMemcpyHostToDevice));
hipLaunchKernelGGL(TeamCtxInfraTest, gridSize, blockSize, shared_bytes,
stream, _shmem_context, teams_on_device);
@@ -138,7 +138,7 @@ void TeamCtxInfraTester::launchKernel(dim3 gridSize, dim3 blockSize, int loop,
void TeamCtxInfraTester::postLaunchKernel() {
for (int team_i = 0; team_i < NUM_TEAMS; team_i++) {
roc_shmem_team_destroy(team_world_dup[team_i]);
rocshmem_team_destroy(team_world_dup[team_i]);
}
}
@@ -22,11 +22,11 @@
#include "team_ctx_primitive_tester.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
using namespace rocshmem;
roc_shmem_team_t team_primitive_world_dup;
rocshmem_team_t team_primitive_world_dup;
/******************************************************************************
* DEVICE TEST KERNEL
@@ -34,42 +34,42 @@ roc_shmem_team_t team_primitive_world_dup;
__global__ void TeamCtxPrimitiveTest(int loop, int skip, uint64_t *timer,
char *s_buf, char *r_buf, int size,
TestType type, ShmemContextType ctx_type,
roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_team_create_ctx(team, ctx_type, &ctx);
rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_team_create_ctx(team, ctx_type, &ctx);
if (hipThreadIdx_x == 0) {
uint64_t start;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) start = roc_shmem_timer();
if (i == skip) start = rocshmem_timer();
switch (type) {
case TeamCtxGetTestType:
roc_shmem_ctx_getmem(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem(ctx, r_buf, s_buf, size, 1);
break;
case TeamCtxGetNBITestType:
roc_shmem_ctx_getmem_nbi(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_nbi(ctx, r_buf, s_buf, size, 1);
break;
case TeamCtxPutTestType:
roc_shmem_ctx_putmem(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem(ctx, r_buf, s_buf, size, 1);
break;
case TeamCtxPutNBITestType:
roc_shmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_nbi(ctx, r_buf, s_buf, size, 1);
break;
default:
break;
}
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
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();
}
/******************************************************************************
@@ -77,13 +77,13 @@ __global__ void TeamCtxPrimitiveTest(int loop, int skip, uint64_t *timer,
*****************************************************************************/
TeamCtxPrimitiveTester::TeamCtxPrimitiveTester(TesterArguments args)
: Tester(args) {
s_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)roc_shmem_malloc(args.max_msg_size * args.wg_size);
s_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
r_buf = (char *)rocshmem_malloc(args.max_msg_size * args.wg_size);
}
TeamCtxPrimitiveTester::~TeamCtxPrimitiveTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
void TeamCtxPrimitiveTester::resetBuffers(uint64_t size) {
@@ -92,10 +92,10 @@ void TeamCtxPrimitiveTester::resetBuffers(uint64_t size) {
}
void TeamCtxPrimitiveTester::preLaunchKernel() {
int n_pes = roc_shmem_team_n_pes(ROC_SHMEM_TEAM_WORLD);
int n_pes = rocshmem_team_n_pes(ROCSHMEM_TEAM_WORLD);
team_primitive_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
team_primitive_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, n_pes, nullptr, 0,
&team_primitive_world_dup);
}
@@ -112,7 +112,7 @@ void TeamCtxPrimitiveTester::launchKernel(dim3 gridSize, dim3 blockSize,
}
void TeamCtxPrimitiveTester::postLaunchKernel() {
roc_shmem_team_destroy(team_primitive_world_dup);
rocshmem_team_destroy(team_primitive_world_dup);
}
void TeamCtxPrimitiveTester::verifyResults(uint64_t size) {
@@ -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) {
@@ -31,7 +31,7 @@
/******************************************************************************
* HOST TESTER CLASS
*****************************************************************************/
template <typename T1, ROC_SHMEM_OP T2>
template <typename T1, ROCSHMEM_OP T2>
class TeamReductionTester : public Tester {
public:
explicit TeamReductionTester(
+4 -4
View File
@@ -20,7 +20,7 @@
* IN THE SOFTWARE.
*****************************************************************************/
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <vector>
#include "tester.hpp"
@@ -37,7 +37,7 @@ int main(int argc, char *argv[]) {
/***
* Select a GPU
*/
int rank = roc_shmem_my_pe();
int rank = rocshmem_my_pe();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = rank % ndevices;
@@ -46,7 +46,7 @@ int main(int argc, char *argv[]) {
/**
* Must initialize rocshmem to access arguments needed by the tester.
*/
roc_shmem_init();
rocshmem_init();
/**
* Now grab the arguments from rocshmem.
@@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {
* The rocshmem library needs to be cleaned up with this call. It pairs
* with the init function above.
*/
roc_shmem_finalize();
rocshmem_finalize();
return 0;
}
+4 -4
View File
@@ -27,7 +27,7 @@
#include <functional>
#include <iostream>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <vector>
#include "alltoall_tester.hpp"
@@ -140,7 +140,7 @@ std::vector<Tester*> Tester::create(TesterArguments args) {
case TeamReductionTestType:
if (rank == 0)
std::cout << "All-to-All Team-based Reduction ###" << std::endl;
testers.push_back(new TeamReductionTester<float, ROC_SHMEM_SUM>(
testers.push_back(new TeamReductionTester<float, ROCSHMEM_SUM>(
args,
[](float& f1, float& f2) {
f1 = 1;
@@ -480,8 +480,8 @@ void Tester::execute() {
printf("error = %d \n", err);
}
// roc_shmem_dump_stats();
roc_shmem_reset_stats();
// rocshmem_dump_stats();
rocshmem_reset_stats();
}
barrier();
+1 -1
View File
@@ -23,7 +23,7 @@
#ifndef _TESTER_HPP_
#define _TESTER_HPP_
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <vector>
#include "tester_arguments.hpp"
+4 -4
View File
@@ -24,7 +24,7 @@
#include <cstdlib>
#include <iostream>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include "tester.hpp"
@@ -120,7 +120,7 @@ TesterArguments::TesterArguments(int argc, char *argv[]) {
void TesterArguments::show_usage(std::string executable_name) {
std::cout << "Usage: " << executable_name << std::endl;
std::cout << "\t-t <number of roc_shmem service threads>\n";
std::cout << "\t-t <number of rocshmem service threads>\n";
std::cout << "\t-w <number of workgroups>\n";
std::cout << "\t-s <maximum message size (in bytes)>\n";
std::cout << "\t-a <algorithm number to test>\n";
@@ -132,8 +132,8 @@ void TesterArguments::show_usage(std::string executable_name) {
}
void TesterArguments::get_rocshmem_arguments() {
numprocs = roc_shmem_n_pes();
myid = roc_shmem_my_pe();
numprocs = rocshmem_n_pes();
myid = rocshmem_my_pe();
TestType type = (TestType)algorithm;
if ((type != BarrierAllTestType) && (type != SyncAllTestType) &&
+3 -3
View File
@@ -25,7 +25,7 @@
#include <climits>
#include <cstdint>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <string>
class TesterArguments {
@@ -34,7 +34,7 @@ class TesterArguments {
/**
* Initialize rocshmem members
* Valid after roc_shmem_init function called.
* Valid after rocshmem_init function called.
*/
void get_rocshmem_arguments();
@@ -57,7 +57,7 @@ class TesterArguments {
unsigned thread_access = 64;
unsigned coal_coef = 64;
unsigned op_type = 0;
unsigned shmem_context = rocshmem::ROC_SHMEM_CTX_WG_PRIVATE;
unsigned shmem_context = rocshmem::ROCSHMEM_CTX_WG_PRIVATE;
/**
* Arguments obtained from rocshmem
@@ -22,7 +22,7 @@
#include "wave_level_primitives.hpp"
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#include <numeric>
@@ -35,9 +35,9 @@ __global__ void WaveLevelPrimitiveTest(int loop, int skip, uint64_t *timer,
char *s_buf, char *r_buf, int size,
TestType type, ShmemContextType ctx_type,
int wf_size) {
__shared__ roc_shmem_ctx_t ctx;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
__shared__ rocshmem_ctx_t ctx;
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
/**
* Calculate start index for each wavefront for tiled version
@@ -52,34 +52,34 @@ __global__ void WaveLevelPrimitiveTest(int loop, int skip, uint64_t *timer,
r_buf += idx;
for (int i = 0; i < loop + skip; i++) {
if (i == skip) start = roc_shmem_timer();
if (i == skip) start = rocshmem_timer();
switch (type) {
case WAVEGetTestType:
roc_shmem_ctx_getmem_wave(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_wave(ctx, r_buf, s_buf, size, 1);
break;
case WAVEGetNBITestType:
roc_shmem_ctx_getmem_nbi_wave(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_getmem_nbi_wave(ctx, r_buf, s_buf, size, 1);
break;
case WAVEPutTestType:
roc_shmem_ctx_putmem_wave(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_wave(ctx, r_buf, s_buf, size, 1);
break;
case WAVEPutNBITestType:
roc_shmem_ctx_putmem_nbi_wave(ctx, r_buf, s_buf, size, 1);
rocshmem_ctx_putmem_nbi_wave(ctx, r_buf, s_buf, size, 1);
break;
default:
break;
}
}
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
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();
}
/******************************************************************************
@@ -88,14 +88,14 @@ __global__ void WaveLevelPrimitiveTest(int loop, int skip, uint64_t *timer,
WaveLevelPrimitiveTester::WaveLevelPrimitiveTester(TesterArguments args)
: Tester(args) {
s_buf = static_cast<int*>(
roc_shmem_malloc(args.max_msg_size * args.num_wgs * num_warps));
rocshmem_malloc(args.max_msg_size * args.num_wgs * num_warps));
r_buf = static_cast<int*>(
roc_shmem_malloc(args.max_msg_size * args.num_wgs * num_warps));
rocshmem_malloc(args.max_msg_size * args.num_wgs * num_warps));
}
WaveLevelPrimitiveTester::~WaveLevelPrimitiveTester() {
roc_shmem_free(s_buf);
roc_shmem_free(r_buf);
rocshmem_free(s_buf);
rocshmem_free(r_buf);
}
void WaveLevelPrimitiveTester::resetBuffers(uint64_t size) {