Use new naming scheme
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -45,44 +45,44 @@ int main(int argc, char **argv) {
|
||||
int *buf, *buf_in;
|
||||
int me, npes, i, target;
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
/* Each PE allocates space for "me + 1" integers */
|
||||
bufsize = me + 1;
|
||||
buf = (int *)roc_shmem_malloc(sizeof(int) * bufsize);
|
||||
buf = (int *)rocshmem_malloc(sizeof(int) * bufsize);
|
||||
|
||||
if (NULL == buf) roc_shmem_global_exit(1);
|
||||
if (NULL == buf) rocshmem_global_exit(1);
|
||||
|
||||
for (i = 0; i < bufsize; i++) buf[i] = -1;
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* Write to neighbor's buffer */
|
||||
target = (me + 1) % npes;
|
||||
buf_in = (int *)malloc(sizeof(int) * (target + 1));
|
||||
if (!buf_in) {
|
||||
fprintf(stderr, "ERR - null buf_in pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < target + 1; i++) buf_in[i] = target;
|
||||
|
||||
roc_shmem_int_put(buf, buf_in, target + 1, target);
|
||||
rocshmem_int_put(buf, buf_in, target + 1, target);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* Validate data was written correctly */
|
||||
for (i = 0; i < me + 1; i++) {
|
||||
if (buf[i] != me) {
|
||||
printf("Error [%3d]: buf[%d] == %d, expected %d\n", me, i, buf[i], me);
|
||||
roc_shmem_global_exit(2);
|
||||
rocshmem_global_exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
free(buf_in);
|
||||
roc_shmem_free(buf);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_free(buf);
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* test roc_shmem_int_atomic_inc() atomic_inc {-v|q}
|
||||
* test rocshmem_int_atomic_inc() atomic_inc {-v|q}
|
||||
* {loop-cnt(default=10)(default=10)} where: -q == quiet, -v == verbose/debug
|
||||
* Loop for loop-cnt
|
||||
* all PEs call roc_shmem_int_atomic_inc(), PE-0 totals
|
||||
* all PEs call rocshmem_int_atomic_inc(), PE-0 totals
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -44,18 +44,18 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define Rfprintf \
|
||||
if (roc_shmem_my_pe() == 0) fprintf
|
||||
if (rocshmem_my_pe() == 0) fprintf
|
||||
#define Rprintf \
|
||||
if (roc_shmem_my_pe() == 0) printf
|
||||
if (rocshmem_my_pe() == 0) printf
|
||||
#define RDfprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) fprintf
|
||||
if (Verbose && rocshmem_my_pe() == 0) fprintf
|
||||
#define RDprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) printf
|
||||
if (Verbose && rocshmem_my_pe() == 0) printf
|
||||
#define Vprintf \
|
||||
if (Verbose) printf
|
||||
#define Vfprintf \
|
||||
@@ -69,12 +69,12 @@ int main(int argc, char *argv[]) {
|
||||
int Announce = (NULL == getenv("MAKELEVEL")) ? 1 : 0;
|
||||
int *lock_cnt;
|
||||
|
||||
roc_shmem_init();
|
||||
my_rank = roc_shmem_my_pe();
|
||||
num_ranks = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
my_rank = rocshmem_my_pe();
|
||||
num_ranks = rocshmem_n_pes();
|
||||
if (num_ranks == 1) {
|
||||
fprintf(stderr, "ERR - Requires > 1 PEs\n");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
default:
|
||||
Rfprintf(stderr, "ERR - unknown -%c ?\n", c);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -99,30 +99,30 @@ int main(int argc, char *argv[]) {
|
||||
loops = atoi(argv[optind++]);
|
||||
if (loops <= 0 || loops > 1000000) {
|
||||
Rfprintf(stderr, "ERR - loops arg out of bounds '%d'?\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
lock_cnt = (int *)roc_shmem_malloc(sizeof(int));
|
||||
lock_cnt = (int *)rocshmem_malloc(sizeof(int));
|
||||
|
||||
for (cloop = 1; cloop <= loops; cloop++) {
|
||||
*lock_cnt = 0;
|
||||
roc_shmem_barrier_all(); /* sync all ranks */
|
||||
rocshmem_barrier_all(); /* sync all ranks */
|
||||
|
||||
for (c = 0; c < num_ranks; c++)
|
||||
roc_shmem_int64_atomic_inc((int64_t *)lock_cnt, c);
|
||||
rocshmem_int64_atomic_inc((int64_t *)lock_cnt, c);
|
||||
|
||||
Vprintf("[%d] locked: lock_cnt(%d)\n", my_rank, *lock_cnt);
|
||||
|
||||
roc_shmem_int_wait_until(lock_cnt, ROC_SHMEM_CMP_GE, num_ranks);
|
||||
rocshmem_int_wait_until(lock_cnt, ROCSHMEM_CMP_GE, num_ranks);
|
||||
|
||||
roc_shmem_barrier_all(); /* sync all ranks */
|
||||
rocshmem_barrier_all(); /* sync all ranks */
|
||||
|
||||
if ((*lock_cnt) != num_ranks) {
|
||||
printf("[%d] loop %d: bad lock_cnt %d, expected %d?\n", my_rank, cloop,
|
||||
*lock_cnt, num_ranks);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
if ((cloop % 10) == 0) {
|
||||
@@ -133,9 +133,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
Vprintf("[%d] of %d, Exit: lock_cnt %d\n", my_rank, num_ranks, *lock_cnt);
|
||||
|
||||
roc_shmem_free(lock_cnt);
|
||||
rocshmem_free(lock_cnt);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,25 +30,25 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* roc_shmem_barrier() test barrier {-V} {loop-cnt}
|
||||
* rocshmem_barrier() test barrier {-V} {loop-cnt}
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define Rfprintf \
|
||||
if (roc_shmem_my_pe() == 0) fprintf
|
||||
if (rocshmem_my_pe() == 0) fprintf
|
||||
#define Rprintf \
|
||||
if (roc_shmem_my_pe() == 0) printf
|
||||
if (rocshmem_my_pe() == 0) printf
|
||||
#define RDfprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) fprintf
|
||||
if (Verbose && rocshmem_my_pe() == 0) fprintf
|
||||
#define RDprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) printf
|
||||
if (Verbose && rocshmem_my_pe() == 0) printf
|
||||
|
||||
int Verbose;
|
||||
|
||||
@@ -57,12 +57,12 @@ int main(int argc, char* argv[]) {
|
||||
int rank, num_ranks;
|
||||
char* prog_name;
|
||||
|
||||
roc_shmem_init();
|
||||
rank = roc_shmem_my_pe();
|
||||
num_ranks = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
rank = rocshmem_my_pe();
|
||||
num_ranks = rocshmem_n_pes();
|
||||
if (num_ranks == 1) {
|
||||
Rfprintf(stderr, "ERR - Requires > 1 PEs\n");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
prog_name = strrchr(argv[0], '/');
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char* argv[]) {
|
||||
break;
|
||||
default:
|
||||
Rfprintf(stderr, "ERR - unknown -%c ?\n", c);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char* argv[]) {
|
||||
loops = atoi(argv[optind++]);
|
||||
if (loops <= 0 || loops > 1000000) {
|
||||
Rfprintf(stderr, "ERR - loops arg out of bounds '%d'?\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ int main(int argc, char* argv[]) {
|
||||
// if ( j==0 || (j % 10) == 0 )
|
||||
RDfprintf(stderr, "[%d] pre-barrier(%d)\n", rank, j);
|
||||
|
||||
roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
// if ( j==0 || (j % 10) == 0 )
|
||||
RDfprintf(stderr, "[%d] post barrier(%d)\n", rank, j);
|
||||
@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
RDprintf("%d(%d) Exit\n", rank, num_ranks);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
* usage: bcast {-v|h}
|
||||
*
|
||||
* Loop - roc_shmem_broadcast_all() with increasing data amount.
|
||||
* Loop - rocshmem_broadcast_all() with increasing data amount.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -58,19 +58,19 @@ int main(int argc, char *argv[]) {
|
||||
int nLongs = 0;
|
||||
long *pSync;
|
||||
|
||||
roc_shmem_init();
|
||||
mpe = roc_shmem_my_pe();
|
||||
num_pes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
mpe = rocshmem_my_pe();
|
||||
num_pes = rocshmem_n_pes();
|
||||
|
||||
if (num_pes == 1) {
|
||||
printf("%s: Requires number of PEs > 1\n", argv[0]);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sizeof(long) != 8) {
|
||||
printf("Test assumes 64-bit long (%zd)\n", sizeof(long));
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,15 +85,15 @@ int main(int argc, char *argv[]) {
|
||||
Verbose = 1;
|
||||
} else if (strncmp(argv[1], "-h", 3) == 0) {
|
||||
fprintf(stderr, "usage: %s {-v(verbose)|h(help)}\n", pgm);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
pSync = (long *)roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE);
|
||||
pSync = (long *)rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE);
|
||||
|
||||
for (i = 0; i < ROC_SHMEM_BCAST_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (i = 0; i < ROCSHMEM_BCAST_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
if (mpe == 0 && Verbose) {
|
||||
@@ -102,9 +102,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
for (cloop = 1; cloop <= loops; cloop++) {
|
||||
nLongs = nBytes / sizeof(long);
|
||||
dst = (long *)roc_shmem_malloc(nBytes * 2);
|
||||
dst = (long *)rocshmem_malloc(nBytes * 2);
|
||||
if (!dst) {
|
||||
fprintf(stderr, "[%d] roc_shmem_malloc(%d) failed %s\n", mpe, nBytes,
|
||||
fprintf(stderr, "[%d] rocshmem_malloc(%d) failed %s\n", mpe, nBytes,
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
@@ -114,9 +114,9 @@ int main(int argc, char *argv[]) {
|
||||
src[i] = i + 1;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_long_broadcast(ROC_SHMEM_CTX_DEFAULT, dst, src, nLongs, 1, 0,
|
||||
rocshmem_ctx_long_broadcast(ROCSHMEM_CTX_DEFAULT, dst, src, nLongs, 1, 0,
|
||||
0, num_pes, pSync);
|
||||
|
||||
for (i = 0; i < nLongs; i++) {
|
||||
@@ -124,21 +124,21 @@ int main(int argc, char *argv[]) {
|
||||
if (1 != mpe && dst[i] != src[i]) {
|
||||
fprintf(stderr, "[%d] dst[%d] %ld != expected %ld\n", mpe, i, dst[i],
|
||||
src[i]);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
} else if (1 == mpe && dst[i] != 0) {
|
||||
fprintf(stderr, "[%d] dst[%d] %ld != expected 0\n", mpe, i, dst[i]);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_free(dst);
|
||||
rocshmem_free(dst);
|
||||
if (Verbose && mpe == 0)
|
||||
fprintf(stderr, "loop %2d Bcast %d, Done.\n", cloop, nBytes);
|
||||
nBytes += BCAST_INCR;
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -68,9 +68,9 @@ int main(int argc, char **argv) {
|
||||
char *pgm;
|
||||
double start_time, time_taken;
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if ((pgm = strrchr(argv[0], '/'))) {
|
||||
pgm++;
|
||||
@@ -86,21 +86,21 @@ int main(int argc, char **argv) {
|
||||
case 'e':
|
||||
if ((elements = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad elements count %d\n", elements);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if ((loops = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad loop count %d\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
if ((ps_cnt = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad pSync[] elements %d\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -115,32 +115,32 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: unknown switch '-%c'?\n", pgm, i);
|
||||
usage(pgm);
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ps_cnt *= ROC_SHMEM_BCAST_SYNC_SIZE;
|
||||
pSync = (long *)roc_shmem_malloc(ps_cnt * sizeof(long));
|
||||
ps_cnt *= ROCSHMEM_BCAST_SYNC_SIZE;
|
||||
pSync = (long *)rocshmem_malloc(ps_cnt * sizeof(long));
|
||||
if (!pSync) {
|
||||
fprintf(stderr, "ERR - null pSync pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < ps_cnt; i++) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
source = (int *)roc_shmem_malloc(elements * sizeof(*source));
|
||||
source = (int *)rocshmem_malloc(elements * sizeof(*source));
|
||||
if (!source) {
|
||||
fprintf(stderr, "ERR - null source pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
target = (int *)roc_shmem_malloc(elements * sizeof(*target));
|
||||
target = (int *)rocshmem_malloc(elements * sizeof(*target));
|
||||
if (!target) {
|
||||
fprintf(stderr, "ERR - null target pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
for (i = 0; i < elements; i += 1) {
|
||||
source[i] = i + 1;
|
||||
@@ -151,20 +151,20 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "ps_cnt %d loops %d nElems %d\n", ps_cnt, loops, elements);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (time_taken = 0.0, ps = i = 0; i < loops; i++) {
|
||||
start_time = shmem_wtime();
|
||||
|
||||
roc_shmem_ctx_int_broadcast(ROC_SHMEM_CTX_DEFAULT, target, source, elements,
|
||||
rocshmem_ctx_int_broadcast(ROCSHMEM_CTX_DEFAULT, target, source, elements,
|
||||
0, 0, 0, npes, &pSync[ps]);
|
||||
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
time_taken += (shmem_wtime() - start_time);
|
||||
|
||||
if (ps_cnt > 1) {
|
||||
ps += ROC_SHMEM_BCAST_SYNC_SIZE;
|
||||
ps += ROCSHMEM_BCAST_SYNC_SIZE;
|
||||
if (ps >= ps_cnt) ps = 0;
|
||||
}
|
||||
}
|
||||
@@ -179,15 +179,15 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (Verbose > 1) fprintf(stderr, "[%d] pre B1\n", me);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (Verbose > 1) fprintf(stderr, "[%d] post B1\n", me);
|
||||
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(target);
|
||||
roc_shmem_free(source);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(target);
|
||||
rocshmem_free(source);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* reduce across PEs with roc_shmem_max_to_all()
|
||||
* reduce across PEs with rocshmem_max_to_all()
|
||||
*
|
||||
* usage: big_reduction {-v|h}
|
||||
*/
|
||||
@@ -39,14 +39,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define N 128
|
||||
|
||||
#define MAX(a, b) ((a) > (b)) ? (a) : (b)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, Verbose = 0;
|
||||
@@ -65,33 +65,33 @@ int main(int argc, char *argv[]) {
|
||||
Verbose = 1;
|
||||
} else if (strncmp(argv[1], "-h", 3) == 0) {
|
||||
fprintf(stderr, "usage: %s {-v(verbose)|h(help)}\n", pgm);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
src = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
src = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
for (i = 0; i < N; i += 1) {
|
||||
src[i] = roc_shmem_my_pe() + i;
|
||||
src[i] = rocshmem_my_pe() + i;
|
||||
}
|
||||
dst = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
dst = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
|
||||
pSync = (long *)roc_shmem_malloc(ROC_SHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync = (long *)rocshmem_malloc(ROCSHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
pWrk = (long *)roc_shmem_malloc(WRK_SIZE * sizeof(long));
|
||||
pWrk = (long *)rocshmem_malloc(WRK_SIZE * sizeof(long));
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_long_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst, src, N, 0, 0,
|
||||
roc_shmem_n_pes(), pWrk, pSync);
|
||||
rocshmem_ctx_long_max_to_all(ROCSHMEM_CTX_DEFAULT, dst, src, N, 0, 0,
|
||||
rocshmem_n_pes(), pWrk, pSync);
|
||||
|
||||
if (Verbose) {
|
||||
printf("%d/%d\tdst =", roc_shmem_my_pe(), roc_shmem_n_pes());
|
||||
printf("%d/%d\tdst =", rocshmem_my_pe(), rocshmem_n_pes());
|
||||
for (i = 0; i < N; i += 1) {
|
||||
printf(" %ld", dst[i]);
|
||||
}
|
||||
@@ -99,19 +99,19 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
for (i = 0; i < N; i += 1) {
|
||||
if (dst[i] != roc_shmem_n_pes() - 1 + i) {
|
||||
printf("[%3d] Error: dst[%d] == %ld, expected %ld\n", roc_shmem_my_pe(),
|
||||
i, dst[i], roc_shmem_n_pes() - 1 + (long)i);
|
||||
roc_shmem_global_exit(1);
|
||||
if (dst[i] != rocshmem_n_pes() - 1 + i) {
|
||||
printf("[%3d] Error: dst[%d] == %ld, expected %ld\n", rocshmem_my_pe(),
|
||||
i, dst[i], rocshmem_n_pes() - 1 + (long)i);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(dst);
|
||||
roc_shmem_free(src);
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
rocshmem_free(dst);
|
||||
rocshmem_free(src);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -78,8 +78,8 @@ static void usage(char *pgm) {
|
||||
" -v be verbose, multiple 'v' more verbose\n"
|
||||
" -e element-cnt (%d) # of int sized elements to get\n"
|
||||
" -l loops (%d) loop count.\n"
|
||||
" -s synchronize: barrier after each roc_shmem_get()\n"
|
||||
" -t track: output '.' for every 200 roc_shmem_get()s\n",
|
||||
" -s synchronize: barrier after each rocshmem_get()\n"
|
||||
" -t track: output '.' for every 200 rocshmem_get()s\n",
|
||||
pgm, NUM_ELEMENTS, DFLT_LOOPS);
|
||||
}
|
||||
|
||||
@@ -99,9 +99,9 @@ int main(int argc, char **argv) {
|
||||
long bytes;
|
||||
double time_taken = 0.0, start_time;
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if ((pgm = strrchr(argv[0], '/')))
|
||||
pgm++;
|
||||
@@ -116,14 +116,14 @@ int main(int argc, char **argv) {
|
||||
case 'e':
|
||||
if ((elements = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad elements count %d\n", elements);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if ((loops = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad loop count %d\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -141,35 +141,35 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: unknown switch '-%c'?\n", pgm, i);
|
||||
usage(pgm);
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
target_pe = (me + 1) % npes;
|
||||
|
||||
total_time = (double *)roc_shmem_malloc(npes * sizeof(double));
|
||||
total_time = (double *)rocshmem_malloc(npes * sizeof(double));
|
||||
if (!total_time) {
|
||||
fprintf(stderr, "ERR: bad total_time roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad total_time rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(double)));
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
Source = (int *)roc_shmem_malloc(elements * sizeof(*Source));
|
||||
Source = (int *)rocshmem_malloc(elements * sizeof(*Source));
|
||||
if (!Source) {
|
||||
fprintf(stderr, "ERR: bad Source roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad Source rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(*Target)));
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
Target = (int *)roc_shmem_malloc(elements * sizeof(*Target));
|
||||
Target = (int *)rocshmem_malloc(elements * sizeof(*Target));
|
||||
if (!Target) {
|
||||
fprintf(stderr, "ERR: bad Target roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad Target rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(*Target)));
|
||||
roc_shmem_free(Source);
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_free(Source);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < elements; i++) {
|
||||
@@ -183,31 +183,31 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: INFO - %d loops, get %d (int) elements from PE+1\n",
|
||||
pgm, loops, elements);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < loops; i++) {
|
||||
start_time = shmem_wtime();
|
||||
|
||||
roc_shmem_int_get(Target, Source, elements, target_pe);
|
||||
rocshmem_int_get(Target, Source, elements, target_pe);
|
||||
|
||||
time_taken += shmem_wtime() - start_time;
|
||||
|
||||
if (me == 0) {
|
||||
if (Track && i > 0 && ((i % 200) == 0)) fprintf(stderr, ".%d", i);
|
||||
}
|
||||
if (Sync) roc_shmem_barrier_all();
|
||||
if (Sync) rocshmem_barrier_all();
|
||||
}
|
||||
|
||||
// collect time per node elapsed time.
|
||||
roc_shmem_double_put(&total_time[me], &time_taken, 1, 0);
|
||||
rocshmem_double_put(&total_time[me], &time_taken, 1, 0);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < elements; i++) {
|
||||
if (Target[i] != i + 1) {
|
||||
printf("%d: Error Target[%d] = %d, expected %d\n", me, i, Target[i],
|
||||
i + 1);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,11 +224,11 @@ int main(int argc, char **argv) {
|
||||
secs);
|
||||
}
|
||||
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_free(Target);
|
||||
roc_shmem_free(Source);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_free(Target);
|
||||
rocshmem_free(Source);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -78,8 +78,8 @@ static void usage(char *pgm) {
|
||||
" -v be verbose, multiple 'v' more verbose\n"
|
||||
" -e element-cnt (%d) # of int sized elements to put\n"
|
||||
" -l loops (%d) loop count.\n"
|
||||
" -s synchronize: barrier after each roc_shmem_put()\n"
|
||||
" -t track: output '.' for every 200 roc_shmem_put()s\n",
|
||||
" -s synchronize: barrier after each rocshmem_put()\n"
|
||||
" -t track: output '.' for every 200 rocshmem_put()s\n",
|
||||
pgm, NUM_ELEMENTS, DFLT_LOOPS);
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ int main(int argc, char **argv) {
|
||||
long *pSync;
|
||||
double *pWrk;
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if ((pgm = strrchr(argv[0], '/')))
|
||||
pgm++;
|
||||
@@ -118,14 +118,14 @@ int main(int argc, char **argv) {
|
||||
case 'e':
|
||||
if ((elements = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad elements count %d\n", elements);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if ((loops = atoi_scaled(optarg)) <= 0) {
|
||||
fprintf(stderr, "ERR: Bad loop count %d\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -143,60 +143,60 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "%s: unknown switch '-%c'?\n", pgm, i);
|
||||
usage(pgm);
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
pSync = (long *)roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE);
|
||||
pSync = (long *)rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE);
|
||||
if (!pSync) {
|
||||
fprintf(stderr, "ERR: bad pSync roc_shmem_malloc(%ld)\n",
|
||||
ROC_SHMEM_BCAST_SYNC_SIZE);
|
||||
roc_shmem_global_exit(1);
|
||||
fprintf(stderr, "ERR: bad pSync rocshmem_malloc(%ld)\n",
|
||||
ROCSHMEM_BCAST_SYNC_SIZE);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i++)
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i++)
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
|
||||
pWrk = (double *)roc_shmem_malloc(ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
pWrk = (double *)rocshmem_malloc(ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
if (!pWrk) {
|
||||
fprintf(stderr, "ERR: bad pWrk roc_shmem_malloc(%ld)\n",
|
||||
ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_global_exit(1);
|
||||
fprintf(stderr, "ERR: bad pWrk rocshmem_malloc(%ld)\n",
|
||||
ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
target_PE = (me + 1) % npes;
|
||||
|
||||
total_time = (double *)roc_shmem_malloc(npes * sizeof(double));
|
||||
total_time = (double *)rocshmem_malloc(npes * sizeof(double));
|
||||
if (!total_time) {
|
||||
fprintf(stderr, "ERR: bad total_time roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad total_time rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(double)));
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
for (i = 0; i < npes; i++) total_time[i] = -1.0;
|
||||
|
||||
Source = (int *)roc_shmem_malloc(elements * sizeof(*Source));
|
||||
Source = (int *)rocshmem_malloc(elements * sizeof(*Source));
|
||||
if (!Source) {
|
||||
fprintf(stderr, "ERR: bad Source roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad Source rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(*Target)));
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
Target = (int *)roc_shmem_malloc(elements * sizeof(*Target));
|
||||
Target = (int *)rocshmem_malloc(elements * sizeof(*Target));
|
||||
if (!Target) {
|
||||
fprintf(stderr, "ERR: bad Target roc_shmem_malloc(%ld)\n",
|
||||
fprintf(stderr, "ERR: bad Target rocshmem_malloc(%ld)\n",
|
||||
(elements * sizeof(*Target)));
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
roc_shmem_free(Source);
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
rocshmem_free(Source);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < elements; i++) {
|
||||
@@ -211,33 +211,33 @@ int main(int argc, char **argv) {
|
||||
"%s: INFO - %d loops, put %d (int) elements to PE+1 Max put ??\n",
|
||||
pgm, loops, elements);
|
||||
}
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < loops; i++) {
|
||||
start_time = shmem_wtime();
|
||||
|
||||
roc_shmem_int_put(Target, Source, elements, target_PE);
|
||||
rocshmem_int_put(Target, Source, elements, target_PE);
|
||||
|
||||
time_taken += (shmem_wtime() - start_time);
|
||||
|
||||
if (me == 0) {
|
||||
if (Track && i > 0 && ((i % 200) == 0)) fprintf(stderr, ".%d", i);
|
||||
}
|
||||
if (Sync) roc_shmem_barrier_all();
|
||||
if (Sync) rocshmem_barrier_all();
|
||||
}
|
||||
|
||||
// collect time per node.
|
||||
roc_shmem_double_put(&total_time[me], &time_taken, 1, 0);
|
||||
roc_shmem_ctx_double_sum_to_all(ROC_SHMEM_CTX_DEFAULT, &sum_time, &time_taken,
|
||||
rocshmem_double_put(&total_time[me], &time_taken, 1, 0);
|
||||
rocshmem_ctx_double_sum_to_all(ROCSHMEM_CTX_DEFAULT, &sum_time, &time_taken,
|
||||
1, 0, 0, npes, pWrk, pSync);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < elements; i++) {
|
||||
if (Target[i] != i + 1) {
|
||||
printf("%d: Error Target[%d] = %d, expected %d\n", me, i, Target[i],
|
||||
i + 1);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,17 +259,17 @@ int main(int argc, char **argv) {
|
||||
comp_time, sum_time);
|
||||
|
||||
rate = ((double)bytes / (1024.0 * 1024.0)) / comp_time;
|
||||
printf("%s: roc_shmem_int_put() %7.4f MB/sec (bytes %ld secs %7.4f)\n", pgm,
|
||||
printf("%s: rocshmem_int_put() %7.4f MB/sec (bytes %ld secs %7.4f)\n", pgm,
|
||||
rate, bytes, sum_time);
|
||||
}
|
||||
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
roc_shmem_free(total_time);
|
||||
roc_shmem_free(Target);
|
||||
roc_shmem_free(Source);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
rocshmem_free(total_time);
|
||||
rocshmem_free(Target);
|
||||
rocshmem_free(Source);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -44,35 +44,35 @@ int main(void) {
|
||||
// long *barrier_psync0, *barrier_psync1;
|
||||
long long *src, *dst;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
src = (long long *)roc_shmem_malloc(NELEM * sizeof(long long));
|
||||
dst = (long long *)roc_shmem_malloc(NELEM * sizeof(long long));
|
||||
src = (long long *)rocshmem_malloc(NELEM * sizeof(long long));
|
||||
dst = (long long *)rocshmem_malloc(NELEM * sizeof(long long));
|
||||
for (i = 0; i < NELEM; i++) {
|
||||
src[i] = me;
|
||||
dst[i] = -1;
|
||||
}
|
||||
|
||||
bcast_psync =
|
||||
(long *)roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROC_SHMEM_BCAST_SYNC_SIZE; i++)
|
||||
bcast_psync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
(long *)rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROCSHMEM_BCAST_SYNC_SIZE; i++)
|
||||
bcast_psync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
|
||||
/*
|
||||
barrier_psync0 = (long *) roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE *
|
||||
barrier_psync0 = (long *) rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE *
|
||||
sizeof(long)); barrier_psync1 = (long *)
|
||||
roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE * sizeof(long)); for (i = 0; i <
|
||||
ROC_SHMEM_BARRIER_SYNC_SIZE; i++) { barrier_psync0[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
barrier_psync1[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE * sizeof(long)); for (i = 0; i <
|
||||
ROCSHMEM_BARRIER_SYNC_SIZE; i++) { barrier_psync0[i] = ROCSHMEM_SYNC_VALUE;
|
||||
barrier_psync1[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
*/
|
||||
|
||||
if (me == 0) printf("Shrinking active set test\n");
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* A total of npes tests are performed, where the active set in each test
|
||||
* includes PEs i..npes-1 */
|
||||
@@ -81,7 +81,7 @@ int main(void) {
|
||||
|
||||
if (me == i) printf(" + active set size %d\n", npes - i);
|
||||
|
||||
roc_shmem_ctx_longlong_broadcast(ROC_SHMEM_CTX_DEFAULT, dst, src, NELEM, 0,
|
||||
rocshmem_ctx_longlong_broadcast(ROCSHMEM_CTX_DEFAULT, dst, src, NELEM, 0,
|
||||
i, 0, npes - i, bcast_psync);
|
||||
|
||||
/* Validate broadcasted data */
|
||||
@@ -95,17 +95,17 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// roc_shmem_barrier(i, 0, npes-i, (i % 2) ? barrier_psync0 :
|
||||
// rocshmem_barrier(i, 0, npes-i, (i % 2) ? barrier_psync0 :
|
||||
// barrier_psync1);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < NELEM; i++) dst[i] = -1;
|
||||
|
||||
if (me == 0) printf("Changing root test\n");
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* A total of npes tests are performed, where the root changes each time */
|
||||
for (i = 0; i < npes; i++) {
|
||||
@@ -113,7 +113,7 @@ int main(void) {
|
||||
|
||||
if (me == i) printf(" + root %d\n", i);
|
||||
|
||||
roc_shmem_ctx_longlong_broadcast(ROC_SHMEM_CTX_DEFAULT, dst, src, NELEM, i,
|
||||
rocshmem_ctx_longlong_broadcast(ROCSHMEM_CTX_DEFAULT, dst, src, NELEM, i,
|
||||
0, 0, npes, bcast_psync);
|
||||
|
||||
/* Validate broadcasted data */
|
||||
@@ -127,15 +127,15 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// roc_shmem_barrier(0, 0, npes, barrier_psync0);
|
||||
// rocshmem_barrier(0, 0, npes, barrier_psync0);
|
||||
}
|
||||
|
||||
roc_shmem_free(src);
|
||||
roc_shmem_free(dst);
|
||||
rocshmem_free(src);
|
||||
rocshmem_free(dst);
|
||||
|
||||
roc_shmem_free(bcast_psync);
|
||||
rocshmem_free(bcast_psync);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return errors != 0;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/* circular shift bbb into aaa */
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -40,24 +40,24 @@ int main(int argc, char* argv[]) {
|
||||
int ret = 0;
|
||||
int aaa, *bbb;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
bbb = (int*)roc_shmem_malloc(sizeof(int));
|
||||
bbb = (int*)rocshmem_malloc(sizeof(int));
|
||||
|
||||
*bbb = me = roc_shmem_my_pe();
|
||||
neighbor = (me + 1) % roc_shmem_n_pes();
|
||||
*bbb = me = rocshmem_my_pe();
|
||||
neighbor = (me + 1) % rocshmem_n_pes();
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_int_get(&aaa, bbb, 1, neighbor);
|
||||
rocshmem_int_get(&aaa, bbb, 1, neighbor);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (aaa != neighbor) ret = 1;
|
||||
|
||||
roc_shmem_free(bbb);
|
||||
rocshmem_free(bbb);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -51,100 +51,100 @@ enum op {
|
||||
};
|
||||
|
||||
#ifdef ENABLE_DEPRECATED_TESTS
|
||||
#define DEPRECATED_ADD(TYPENAME, ...) roc_shmem_##TYPENAME##_add(__VA_ARGS__)
|
||||
#define DEPRECATED_FADD(TYPENAME, ...) roc_shmem_##TYPENAME##_fadd(__VA_ARGS__)
|
||||
#define DEPRECATED_ADD(TYPENAME, ...) rocshmem_##TYPENAME##_add(__VA_ARGS__)
|
||||
#define DEPRECATED_FADD(TYPENAME, ...) rocshmem_##TYPENAME##_fadd(__VA_ARGS__)
|
||||
#else
|
||||
#define DEPRECATED_ADD(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_add(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_add(__VA_ARGS__)
|
||||
#define DEPRECATED_FADD(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch_add(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_fetch_add(__VA_ARGS__)
|
||||
#endif /* ENABLE_DEPRECATED_TESTS */
|
||||
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_FETCH_ADD_NBI: \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch_add_nbi(&old, remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
roc_shmem_quiet(); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_ADD_NBI: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_fetch_add_nbi( \
|
||||
ROC_SHMEM_CTX_DEFAULT, &old, remote, (TYPE)(mype + 1), i); \
|
||||
roc_shmem_quiet(); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_FETCH_ADD_NBI: \
|
||||
rocshmem_##TYPENAME##_atomic_fetch_add_nbi(&old, remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
rocshmem_quiet(); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_ADD_NBI: \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_fetch_add_nbi( \
|
||||
ROCSHMEM_CTX_DEFAULT, &old, remote, (TYPE)(mype + 1), i); \
|
||||
rocshmem_quiet(); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break;
|
||||
|
||||
#define TEST_SHMEM_ADD(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
*remote = (TYPE)0; \
|
||||
roc_shmem_barrier_all(); \
|
||||
for (int i = 0; i < npes; i++) switch (OP) { \
|
||||
case ADD: \
|
||||
DEPRECATED_ADD(TYPENAME, remote, (TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case ATOMIC_ADD: \
|
||||
roc_shmem_##TYPENAME##_atomic_add(remote, (TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case CTX_ATOMIC_ADD: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_add(ROC_SHMEM_CTX_DEFAULT, remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case FADD: \
|
||||
old = DEPRECATED_FADD(TYPENAME, remote, (TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case ATOMIC_FETCH_ADD: \
|
||||
old = roc_shmem_##TYPENAME##_atomic_fetch_add(remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_ADD: \
|
||||
old = roc_shmem_ctx_##TYPENAME##_atomic_fetch_add( \
|
||||
ROC_SHMEM_CTX_DEFAULT, remote, (TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
/*SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME)*/ \
|
||||
default: \
|
||||
printf("Invalid operation (%d)\n", OP); \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
roc_shmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_ADD(%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) roc_shmem_global_exit(1); \
|
||||
#define TEST_SHMEM_ADD(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = (TYPE)0; \
|
||||
rocshmem_barrier_all(); \
|
||||
for (int i = 0; i < npes; i++) switch (OP) { \
|
||||
case ADD: \
|
||||
DEPRECATED_ADD(TYPENAME, remote, (TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case ATOMIC_ADD: \
|
||||
rocshmem_##TYPENAME##_atomic_add(remote, (TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case CTX_ATOMIC_ADD: \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_add(ROCSHMEM_CTX_DEFAULT, remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
break; \
|
||||
case FADD: \
|
||||
old = DEPRECATED_FADD(TYPENAME, remote, (TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case ATOMIC_FETCH_ADD: \
|
||||
old = rocshmem_##TYPENAME##_atomic_fetch_add(remote, \
|
||||
(TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_ADD: \
|
||||
old = rocshmem_ctx_##TYPENAME##_atomic_fetch_add( \
|
||||
ROCSHMEM_CTX_DEFAULT, remote, (TYPE)(mype + 1), i); \
|
||||
if (old > (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
/*SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME)*/ \
|
||||
default: \
|
||||
printf("Invalid operation (%d)\n", OP); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
rocshmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)(npes * (npes + 1) / 2)) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_ADD(%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
rocshmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) rocshmem_global_exit(1); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
@@ -256,6 +256,6 @@ int main(int argc, char *argv[]) {
|
||||
TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, ptrdiff_t, ptrdiff);
|
||||
*/
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -49,68 +49,68 @@ enum op {
|
||||
|
||||
#ifdef ENABLE_DEPRECATED_TESTS
|
||||
#define DEPRECATED_CSWAP(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_cswap(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_cswap(__VA_ARGS__)
|
||||
#else
|
||||
#define DEPRECATED_CSWAP(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_compare_swap(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_compare_swap(__VA_ARGS__)
|
||||
#endif /* ENABLE_DEPRECATED_TESTS */
|
||||
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_COMPARE_SWAP_NBI: \
|
||||
roc_shmem_##TYPENAME##_atomic_compare_swap_nbi( \
|
||||
&old, remote, (TYPE)npes, (TYPE)mype, (mype + 1) % npes); \
|
||||
break; \
|
||||
case CTX_ATOMIC_COMPARE_SWAP_NBI: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_compare_swap_nbi( \
|
||||
ROC_SHMEM_CTX_DEFAULT, &old, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_COMPARE_SWAP_NBI: \
|
||||
rocshmem_##TYPENAME##_atomic_compare_swap_nbi( \
|
||||
&old, remote, (TYPE)npes, (TYPE)mype, (mype + 1) % npes); \
|
||||
break; \
|
||||
case CTX_ATOMIC_COMPARE_SWAP_NBI: \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_compare_swap_nbi( \
|
||||
ROCSHMEM_CTX_DEFAULT, &old, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
break;
|
||||
|
||||
#define TEST_SHMEM_CSWAP(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
*remote = npes; \
|
||||
roc_shmem_barrier_all(); \
|
||||
switch (OP) { \
|
||||
case CSWAP: \
|
||||
old = DEPRECATED_CSWAP(TYPENAME, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
break; \
|
||||
case ATOMIC_COMPARE_SWAP: \
|
||||
old = roc_shmem_##TYPENAME##_atomic_compare_swap( \
|
||||
remote, (TYPE)npes, (TYPE)mype, (mype + 1) % npes); \
|
||||
break; \
|
||||
case CTX_ATOMIC_COMPARE_SWAP: \
|
||||
old = roc_shmem_ctx_##TYPENAME##_atomic_compare_swap( \
|
||||
ROC_SHMEM_CTX_DEFAULT, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
break; \
|
||||
/* SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) */ \
|
||||
default: \
|
||||
printf("invalid operation (%d)\n", OP); \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
roc_shmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes)) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_CSWAP(%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
if (old != (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) roc_shmem_global_exit(1); \
|
||||
#define TEST_SHMEM_CSWAP(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = npes; \
|
||||
rocshmem_barrier_all(); \
|
||||
switch (OP) { \
|
||||
case CSWAP: \
|
||||
old = DEPRECATED_CSWAP(TYPENAME, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
break; \
|
||||
case ATOMIC_COMPARE_SWAP: \
|
||||
old = rocshmem_##TYPENAME##_atomic_compare_swap( \
|
||||
remote, (TYPE)npes, (TYPE)mype, (mype + 1) % npes); \
|
||||
break; \
|
||||
case CTX_ATOMIC_COMPARE_SWAP: \
|
||||
old = rocshmem_ctx_##TYPENAME##_atomic_compare_swap( \
|
||||
ROCSHMEM_CTX_DEFAULT, remote, (TYPE)npes, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
break; \
|
||||
/* SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) */ \
|
||||
default: \
|
||||
printf("invalid operation (%d)\n", OP); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
rocshmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes)) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_CSWAP(%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
if (old != (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
rocshmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) rocshmem_global_exit(1); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
@@ -181,6 +181,6 @@ int main(int argc, char *argv[]) {
|
||||
// TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, size_t, size);
|
||||
// TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, ptrdiff_t, ptrdiff);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -49,47 +49,47 @@ enum op {
|
||||
|
||||
#ifdef ENABLE_DEPRECATED_TESTS
|
||||
#define DEPRECATED_FETCH(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_fetch(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_fetch(__VA_ARGS__)
|
||||
#else
|
||||
#define DEPRECATED_FETCH(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_fetch(__VA_ARGS__)
|
||||
#endif /* ENABLE_DEPRECATED_TESTS */
|
||||
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_FETCH_NBI: \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch_nbi(&val, remote, (mype + 1) % npes); \
|
||||
roc_shmem_quiet(); \
|
||||
rocshmem_##TYPENAME##_atomic_fetch_nbi(&val, remote, (mype + 1) % npes); \
|
||||
rocshmem_quiet(); \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_NBI: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_fetch_nbi(ROC_SHMEM_CTX_DEFAULT, &val, \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_fetch_nbi(ROCSHMEM_CTX_DEFAULT, &val, \
|
||||
remote, (mype + 1) % npes); \
|
||||
roc_shmem_quiet(); \
|
||||
rocshmem_quiet(); \
|
||||
break;
|
||||
|
||||
#define TEST_SHMEM_FETCH(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE val; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = (TYPE)mype; \
|
||||
roc_shmem_barrier_all(); \
|
||||
rocshmem_barrier_all(); \
|
||||
switch (OP) { \
|
||||
case FETCH: \
|
||||
val = DEPRECATED_FETCH(TYPENAME, remote, (mype + 1) % npes); \
|
||||
break; \
|
||||
case ATOMIC_FETCH: \
|
||||
val = roc_shmem_##TYPENAME##_atomic_fetch(remote, (mype + 1) % npes); \
|
||||
val = rocshmem_##TYPENAME##_atomic_fetch(remote, (mype + 1) % npes); \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH: \
|
||||
val = roc_shmem_ctx_##TYPENAME##_atomic_fetch( \
|
||||
ROC_SHMEM_CTX_DEFAULT, remote, (mype + 1) % npes); \
|
||||
val = rocshmem_ctx_##TYPENAME##_atomic_fetch( \
|
||||
ROCSHMEM_CTX_DEFAULT, remote, (mype + 1) % npes); \
|
||||
break; \
|
||||
/* SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) */ \
|
||||
default: \
|
||||
printf("Invalid operation (%d)\n", OP); \
|
||||
roc_shmem_global_exit(1); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
if (val != (TYPE)((mype + 1) % npes)) { \
|
||||
printf( \
|
||||
@@ -98,12 +98,12 @@ enum op {
|
||||
mype, #OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) roc_shmem_global_exit(1); \
|
||||
rocshmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) rocshmem_global_exit(1); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
@@ -186,6 +186,6 @@ int main(int argc, char *argv[]) {
|
||||
TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, ptrdiff_t, ptrdiff);
|
||||
*/
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -51,98 +51,98 @@ enum op {
|
||||
};
|
||||
|
||||
#ifdef ENABLE_DEPRECATED_TESTS
|
||||
#define DEPRECATED_INC(TYPENAME, ...) roc_shmem_##TYPENAME##_inc(__VA_ARGS__)
|
||||
#define DEPRECATED_FINC(TYPENAME, ...) roc_shmem_##TYPENAME##_finc(__VA_ARGS__)
|
||||
#define DEPRECATED_INC(TYPENAME, ...) rocshmem_##TYPENAME##_inc(__VA_ARGS__)
|
||||
#define DEPRECATED_FINC(TYPENAME, ...) rocshmem_##TYPENAME##_finc(__VA_ARGS__)
|
||||
#else
|
||||
#define DEPRECATED_INC(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_inc(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_inc(__VA_ARGS__)
|
||||
#define DEPRECATED_FINC(TYPENAME, ...) \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch_inc(__VA_ARGS__)
|
||||
rocshmem_##TYPENAME##_atomic_fetch_inc(__VA_ARGS__)
|
||||
#endif /* ENABLE_DEPRECATED_TESTS */
|
||||
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_FETCH_INC_NBI: \
|
||||
roc_shmem_##TYPENAME##_atomic_fetch_inc_nbi(&old, remote, i); \
|
||||
roc_shmem_quiet(); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_INC_NBI: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_fetch_inc_nbi(ROC_SHMEM_CTX_DEFAULT, \
|
||||
&old, remote, i); \
|
||||
roc_shmem_quiet(); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \
|
||||
case ATOMIC_FETCH_INC_NBI: \
|
||||
rocshmem_##TYPENAME##_atomic_fetch_inc_nbi(&old, remote, i); \
|
||||
rocshmem_quiet(); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_INC_NBI: \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_fetch_inc_nbi(ROCSHMEM_CTX_DEFAULT, \
|
||||
&old, remote, i); \
|
||||
rocshmem_quiet(); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break;
|
||||
|
||||
#define TEST_SHMEM_INC(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
*remote = (TYPE)0; \
|
||||
roc_shmem_barrier_all(); \
|
||||
for (int i = 0; i < npes; i++) switch (OP) { \
|
||||
case INC: \
|
||||
DEPRECATED_INC(TYPENAME, remote, i); \
|
||||
break; \
|
||||
case ATOMIC_INC: \
|
||||
roc_shmem_##TYPENAME##_atomic_inc(remote, i); \
|
||||
break; \
|
||||
case CTX_ATOMIC_INC: \
|
||||
roc_shmem_ctx_##TYPENAME##_atomic_inc(ROC_SHMEM_CTX_DEFAULT, remote, \
|
||||
i); \
|
||||
break; \
|
||||
case FINC: \
|
||||
old = DEPRECATED_FINC(TYPENAME, remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case ATOMIC_FETCH_INC: \
|
||||
old = roc_shmem_##TYPENAME##_atomic_fetch_inc(remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_INC: \
|
||||
old = roc_shmem_ctx_##TYPENAME##_atomic_fetch_inc( \
|
||||
ROC_SHMEM_CTX_DEFAULT, remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
/*SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME)*/ \
|
||||
default: \
|
||||
printf("Invalid operation (%d)\n", OP); \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
roc_shmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)npes) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_INC(%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) roc_shmem_global_exit(1); \
|
||||
#define TEST_SHMEM_INC(OP, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
TYPE old; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = (TYPE)0; \
|
||||
rocshmem_barrier_all(); \
|
||||
for (int i = 0; i < npes; i++) switch (OP) { \
|
||||
case INC: \
|
||||
DEPRECATED_INC(TYPENAME, remote, i); \
|
||||
break; \
|
||||
case ATOMIC_INC: \
|
||||
rocshmem_##TYPENAME##_atomic_inc(remote, i); \
|
||||
break; \
|
||||
case CTX_ATOMIC_INC: \
|
||||
rocshmem_ctx_##TYPENAME##_atomic_inc(ROCSHMEM_CTX_DEFAULT, remote, \
|
||||
i); \
|
||||
break; \
|
||||
case FINC: \
|
||||
old = DEPRECATED_FINC(TYPENAME, remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case ATOMIC_FETCH_INC: \
|
||||
old = rocshmem_##TYPENAME##_atomic_fetch_inc(remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
case CTX_ATOMIC_FETCH_INC: \
|
||||
old = rocshmem_ctx_##TYPENAME##_atomic_fetch_inc( \
|
||||
ROCSHMEM_CTX_DEFAULT, remote, i); \
|
||||
if (old > (TYPE)npes) { \
|
||||
printf("PE %i error inconsistent value of old (%s, %s)\n", mype, \
|
||||
#OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
break; \
|
||||
/*SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME)*/ \
|
||||
default: \
|
||||
printf("Invalid operation (%d)\n", OP); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
rocshmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)npes) { \
|
||||
printf("PE %i observed error with TEST_SHMEM_INC(%s, %s)\n", mype, #OP, \
|
||||
#TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
rocshmem_free(remote); \
|
||||
if (rc == EXIT_FAILURE) rocshmem_global_exit(1); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
@@ -254,6 +254,6 @@ int main(int argc, char *argv[]) {
|
||||
TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, ptrdiff_t, ptrdiff);
|
||||
*/
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,36 +35,36 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define TEST_SHMEM_G(USE_CTX, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE* remote; \
|
||||
remote = (TYPE*)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
TYPE val; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
*remote = (TYPE)mype; \
|
||||
roc_shmem_barrier_all(); \
|
||||
if (USE_CTX) \
|
||||
val = roc_shmem_ctx_##TYPENAME##_g(ROC_SHMEM_CTX_DEFAULT, remote, \
|
||||
(mype + 1) % npes); \
|
||||
else \
|
||||
val = roc_shmem_##TYPENAME##_g(remote, (mype + 1) % npes); \
|
||||
if (val != (TYPE)((mype + 1) % npes)) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with" \
|
||||
"TEST_SHMEM_G(%d, %s)\n", \
|
||||
mype, (int)(USE_CTX), #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
#define TEST_SHMEM_G(USE_CTX, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE* remote; \
|
||||
remote = (TYPE*)rocshmem_malloc(sizeof(TYPE)); \
|
||||
TYPE val; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
*remote = (TYPE)mype; \
|
||||
rocshmem_barrier_all(); \
|
||||
if (USE_CTX) \
|
||||
val = rocshmem_ctx_##TYPENAME##_g(ROCSHMEM_CTX_DEFAULT, remote, \
|
||||
(mype + 1) % npes); \
|
||||
else \
|
||||
val = rocshmem_##TYPENAME##_g(remote, (mype + 1) % npes); \
|
||||
if (val != (TYPE)((mype + 1) % npes)) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with" \
|
||||
"TEST_SHMEM_G(%d, %s)\n", \
|
||||
mype, (int)(USE_CTX), #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
TEST_SHMEM_G(0, float, float);
|
||||
@@ -117,6 +117,6 @@ int main(int argc, char* argv[]) {
|
||||
// TEST_SHMEM_G(1, size_t, size);
|
||||
// TEST_SHMEM_G(1, ptrdiff_t, ptrdiff);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,34 +35,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define TEST_SHMEM_P(USE_CTX, TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE* remote; \
|
||||
remote = (TYPE*)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
remote = (TYPE*)rocshmem_malloc(sizeof(TYPE)); \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
if (USE_CTX) \
|
||||
roc_shmem_ctx_##TYPENAME##_p(ROC_SHMEM_CTX_DEFAULT, remote, (TYPE)mype, \
|
||||
rocshmem_ctx_##TYPENAME##_p(ROCSHMEM_CTX_DEFAULT, remote, (TYPE)mype, \
|
||||
(mype + 1) % npes); \
|
||||
else \
|
||||
roc_shmem_##TYPENAME##_p(remote, (TYPE)mype, (mype + 1) % npes); \
|
||||
roc_shmem_barrier_all(); \
|
||||
rocshmem_##TYPENAME##_p(remote, (TYPE)mype, (mype + 1) % npes); \
|
||||
rocshmem_barrier_all(); \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes)) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_P(%d, %s)\n", \
|
||||
mype, (int)(USE_CTX), #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
roc_shmem_global_exit(1); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
TEST_SHMEM_P(0, float, float);
|
||||
@@ -115,6 +115,6 @@ int main(int argc, char* argv[]) {
|
||||
// TEST_SHMEM_P(1, size_t, size);
|
||||
// TEST_SHMEM_P(1, ptrdiff_t, ptrdiff);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,33 +35,33 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define TEST_SHMEM_TEST(TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
*remote = 0; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
roc_shmem_##TYPENAME##_p(remote, (TYPE)mype + 1, (mype + 1) % npes); \
|
||||
while (!roc_shmem_##TYPENAME##_test(remote, ROC_SHMEM_CMP_NE, 0)) \
|
||||
; \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes) + 1) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_TEST(%s)\n", \
|
||||
mype, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
#define TEST_SHMEM_TEST(TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote; \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = 0; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
rocshmem_##TYPENAME##_p(remote, (TYPE)mype + 1, (mype + 1) % npes); \
|
||||
while (!rocshmem_##TYPENAME##_test(remote, ROCSHMEM_CMP_NE, 0)) \
|
||||
; \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes) + 1) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_TEST(%s)\n", \
|
||||
mype, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
rocshmem_free(remote); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
TEST_SHMEM_TEST(short, short);
|
||||
@@ -79,6 +79,6 @@ int main(int argc, char *argv[]) {
|
||||
// TEST_SHMEM_TEST(size_t, size);
|
||||
// TEST_SHMEM_TEST(ptrdiff_t, ptrdiff);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -35,32 +35,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define TEST_SHMEM_WAIT_UNTIL(TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote = 0; \
|
||||
remote = (TYPE *)roc_shmem_malloc(sizeof(TYPE)); \
|
||||
*remote = 0; \
|
||||
const int mype = roc_shmem_my_pe(); \
|
||||
const int npes = roc_shmem_n_pes(); \
|
||||
roc_shmem_##TYPENAME##_p(remote, (TYPE)mype + 1, (mype + 1) % npes); \
|
||||
roc_shmem_##TYPENAME##_wait_until(remote, ROC_SHMEM_CMP_NE, 0); \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes) + 1) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_WAIT_UNTIL(%s)\n", \
|
||||
mype, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
roc_shmem_free(remote); \
|
||||
#define TEST_SHMEM_WAIT_UNTIL(TYPE, TYPENAME) \
|
||||
do { \
|
||||
TYPE *remote = 0; \
|
||||
remote = (TYPE *)rocshmem_malloc(sizeof(TYPE)); \
|
||||
*remote = 0; \
|
||||
const int mype = rocshmem_my_pe(); \
|
||||
const int npes = rocshmem_n_pes(); \
|
||||
rocshmem_##TYPENAME##_p(remote, (TYPE)mype + 1, (mype + 1) % npes); \
|
||||
rocshmem_##TYPENAME##_wait_until(remote, ROCSHMEM_CMP_NE, 0); \
|
||||
if ((*remote) != (TYPE)((mype + npes - 1) % npes) + 1) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_WAIT_UNTIL(%s)\n", \
|
||||
mype, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
rocshmem_free(remote); \
|
||||
} while (false)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
TEST_SHMEM_WAIT_UNTIL(short, short);
|
||||
@@ -78,6 +78,6 @@ int main(int argc, char *argv[]) {
|
||||
// TEST_SHMEM_WAIT_UNTIL(size_t, size);
|
||||
// TEST_SHMEM_WAIT_UNTIL(ptrdiff_t, ptrdiff);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -42,43 +42,43 @@ int main(int argc, char *argv[]) {
|
||||
int i;
|
||||
long *source;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
if (roc_shmem_n_pes() == 1) {
|
||||
if (rocshmem_n_pes() == 1) {
|
||||
printf("%s: Requires number of PEs > 1\n", argv[0]);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
source = (long *)roc_shmem_malloc(10 * sizeof(long));
|
||||
source = (long *)rocshmem_malloc(10 * sizeof(long));
|
||||
for (i = 0; i < 10; i++) {
|
||||
source[i] = i + 1;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
memset(target, 0, sizeof(target));
|
||||
/* put 10 elements into target on PE 1 */
|
||||
roc_shmem_long_get(target, source, 10, 1);
|
||||
rocshmem_long_get(target, source, 10, 1);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
if (0 != memcmp(source, target, sizeof(long) * 10)) {
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", roc_shmem_my_pe());
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", rocshmem_my_pe());
|
||||
for (i = 0; i < 10; ++i) {
|
||||
printf("%ld,%ld ", source[i], target[i]);
|
||||
}
|
||||
printf("\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(source);
|
||||
rocshmem_free(source);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -47,39 +47,39 @@ int main(int argc, char *argv[]) {
|
||||
int failed = 0;
|
||||
long *source;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
source = (long *)roc_shmem_malloc(10 * sizeof(long));
|
||||
source = (long *)rocshmem_malloc(10 * sizeof(long));
|
||||
for (i = 0; i < 10; i++) {
|
||||
source[i] = i + 1;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
num_pes = roc_shmem_n_pes();
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
num_pes = rocshmem_n_pes();
|
||||
|
||||
for (j = 0; j < num_pes; j++) {
|
||||
memset(target, 0, sizeof(long) * 10);
|
||||
roc_shmem_long_get_nbi(target, source, 10, j);
|
||||
roc_shmem_quiet();
|
||||
rocshmem_long_get_nbi(target, source, 10, j);
|
||||
rocshmem_quiet();
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (source[i] != target[i]) {
|
||||
fprintf(stderr,
|
||||
"[%d] get_nbi from PE %d: target[%d] = %ld, expected %ld\n",
|
||||
roc_shmem_my_pe(), j, i, target[i], source[i]);
|
||||
rocshmem_my_pe(), j, i, target[i], source[i]);
|
||||
failed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) roc_shmem_global_exit(1);
|
||||
if (failed) rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(source);
|
||||
rocshmem_free(source);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,22 +29,22 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
roc_shmem_global_exit(0);
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
rocshmem_global_exit(0);
|
||||
abort();
|
||||
}
|
||||
|
||||
/* All other PEs wait in this barrier */
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -41,22 +41,22 @@ int main(int argc, char* argv[], char* envp[]) {
|
||||
/*
|
||||
** Starts/Initializes SHMEM/OpenSHMEM
|
||||
*/
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
/*
|
||||
** Fetch the number or processes
|
||||
** Some implementations use num_pes();
|
||||
*/
|
||||
myshmem_n_pes = roc_shmem_n_pes();
|
||||
myshmem_n_pes = rocshmem_n_pes();
|
||||
/*
|
||||
** Assign my process ID to me
|
||||
*/
|
||||
me = roc_shmem_my_pe();
|
||||
me = rocshmem_my_pe();
|
||||
|
||||
if (NULL == getenv("MAKELEVEL")) {
|
||||
printf("Hello World from %d of %d\n", me, myshmem_n_pes);
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/* long_finc neighbor - Perf test roc_shmem_atomic_fetch_inc(); */
|
||||
/* long_finc neighbor - Perf test rocshmem_atomic_fetch_inc(); */
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -63,41 +63,41 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc > 1) loops = atoi(argv[1]);
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
my_pe = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
my_pe = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if (loops <= 0) {
|
||||
if (my_pe == 0) printf("Error: loops must be greater than 0\n");
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
|
||||
data = (long *)roc_shmem_malloc(data_sz);
|
||||
data = (long *)rocshmem_malloc(data_sz);
|
||||
if (!data) {
|
||||
fprintf(stderr, "[%d] roc_shmem_malloc(%ld) failure? %d\n", my_pe, data_sz,
|
||||
fprintf(stderr, "[%d] rocshmem_malloc(%ld) failure? %d\n", my_pe, data_sz,
|
||||
errno);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
memset((void *)data, 0, data_sz);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
neighbor = (my_pe + 1) % npes;
|
||||
start_time = shmem_wtime();
|
||||
for (j = 0, elapsed = 0.0; j < loops; j++) {
|
||||
start_time = shmem_wtime();
|
||||
lval = roc_shmem_int64_atomic_fetch_inc((int64_t *)&data[1], neighbor);
|
||||
lval = rocshmem_int64_atomic_fetch_inc((int64_t *)&data[1], neighbor);
|
||||
elapsed += shmem_wtime() - start_time;
|
||||
if (lval != (long)j) {
|
||||
fprintf(stderr, "[%d] Test: FAIL previous val %ld != %d Exit.\n", my_pe,
|
||||
lval, j);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
rc = 0;
|
||||
if (data[1] != (long)loops) {
|
||||
@@ -115,13 +115,13 @@ int main(int argc, char *argv[]) {
|
||||
fprintf(stderr, "[%d] finc neighbor: PASSED.\n", my_pe);
|
||||
fprintf(
|
||||
stderr,
|
||||
"[%d] %d loops of roc_shmem_int64_atomic_fetch_inc() in %6.4f secs\n"
|
||||
" %2.6f usecs per roc_shmem_int64_atomic_fetch_inc()\n",
|
||||
"[%d] %d loops of rocshmem_int64_atomic_fetch_inc() in %6.4f secs\n"
|
||||
" %2.6f usecs per rocshmem_int64_atomic_fetch_inc()\n",
|
||||
my_pe, loops, elapsed, ((elapsed * 100000.0) / (double)loops));
|
||||
}
|
||||
roc_shmem_free(data);
|
||||
rocshmem_free(data);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
#define NUM_CTX 32
|
||||
|
||||
@@ -37,42 +37,42 @@ using namespace rocshmem;
|
||||
int main(int argc, char **argv) {
|
||||
int me, npes, i;
|
||||
int errors = 0;
|
||||
roc_shmem_ctx_t ctx[NUM_CTX];
|
||||
rocshmem_ctx_t ctx[NUM_CTX];
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
int64_t *data = (int64_t *)roc_shmem_malloc(sizeof(int64_t));
|
||||
int64_t *data = (int64_t *)rocshmem_malloc(sizeof(int64_t));
|
||||
|
||||
/* Initialize the counter */
|
||||
memset(data, 0, sizeof(int64_t));
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < NUM_CTX; i++) {
|
||||
int err = roc_shmem_ctx_create(0, &ctx[i]);
|
||||
int err = rocshmem_ctx_create(0, &ctx[i]);
|
||||
|
||||
if (err) {
|
||||
printf("%d: Warning, could not create context %d (%d)\n", me, i, err);
|
||||
ctx[i] = ROC_SHMEM_CTX_DEFAULT;
|
||||
ctx[i] = ROCSHMEM_CTX_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_CTX; i++)
|
||||
roc_shmem_ctx_int64_atomic_inc(ctx[i], data, (me + 1) % npes);
|
||||
rocshmem_ctx_int64_atomic_inc(ctx[i], data, (me + 1) % npes);
|
||||
|
||||
for (i = 0; i < NUM_CTX; i++) roc_shmem_ctx_quiet(ctx[i]);
|
||||
for (i = 0; i < NUM_CTX; i++) rocshmem_ctx_quiet(ctx[i]);
|
||||
|
||||
roc_shmem_sync_all();
|
||||
rocshmem_sync_all();
|
||||
|
||||
if ((*data) != NUM_CTX) {
|
||||
printf("%d: error expected %d, got %ld\n", me, NUM_CTX, (*data));
|
||||
++errors;
|
||||
}
|
||||
|
||||
roc_shmem_free(data);
|
||||
rocshmem_free(data);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return errors;
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define N 3
|
||||
|
||||
#define MAX(a, b) ((a) > (b)) ? (a) : (b)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int i, Verbose = 0;
|
||||
@@ -63,34 +63,34 @@ int main(int argc, char *argv[]) {
|
||||
Verbose = 1;
|
||||
} else if (strncmp(argv[1], "-h", 3) == 0) {
|
||||
fprintf(stderr, "usage: %s {v(verbose)|h(help)}\n", pgm);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
src = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
src = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
for (i = 0; i < N; i += 1) {
|
||||
src[i] = roc_shmem_my_pe() + i;
|
||||
src[i] = rocshmem_my_pe() + i;
|
||||
}
|
||||
|
||||
dst = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
dst = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
|
||||
pSync = (long *)roc_shmem_malloc(ROC_SHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync = (long *)rocshmem_malloc(ROCSHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i += 1) {
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
pWrk = (long *)roc_shmem_malloc(WRK_SIZE * sizeof(long));
|
||||
pWrk = (long *)rocshmem_malloc(WRK_SIZE * sizeof(long));
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_long_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst, src, N, 0, 0,
|
||||
roc_shmem_n_pes(), pWrk, pSync);
|
||||
rocshmem_ctx_long_max_to_all(ROCSHMEM_CTX_DEFAULT, dst, src, N, 0, 0,
|
||||
rocshmem_n_pes(), pWrk, pSync);
|
||||
|
||||
if (Verbose) {
|
||||
printf("%d/%d\tdst =", roc_shmem_my_pe(), roc_shmem_n_pes());
|
||||
printf("%d/%d\tdst =", rocshmem_my_pe(), rocshmem_n_pes());
|
||||
for (i = 0; i < N; i += 1) {
|
||||
printf(" %ld", dst[i]);
|
||||
}
|
||||
@@ -98,19 +98,19 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
for (i = 0; i < N; i += 1) {
|
||||
if (dst[i] != roc_shmem_n_pes() - 1 + i) {
|
||||
printf("[%3d] Error: dst[%d] == %ld, expected %ld\n", roc_shmem_my_pe(),
|
||||
i, dst[i], roc_shmem_n_pes() - 1 + (long)i);
|
||||
roc_shmem_global_exit(1);
|
||||
if (dst[i] != rocshmem_n_pes() - 1 + i) {
|
||||
printf("[%3d] Error: dst[%d] == %ld, expected %ld\n", rocshmem_my_pe(),
|
||||
i, dst[i], rocshmem_n_pes() - 1 + (long)i);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(dst);
|
||||
roc_shmem_free(src);
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pWrk);
|
||||
rocshmem_free(dst);
|
||||
rocshmem_free(src);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pWrk);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -54,7 +54,7 @@ int debug;
|
||||
static inline void wait_until(long *wait_var, int iterations, int pe) {
|
||||
if (debug) printf("PE %d waiting...%ld\n", pe, *wait_var);
|
||||
|
||||
roc_shmem_long_wait_until(wait_var, ROC_SHMEM_CMP_EQ, iterations);
|
||||
rocshmem_long_wait_until(wait_var, ROCSHMEM_CMP_EQ, iterations);
|
||||
|
||||
if (debug) printf("PE %d wait_until passed\n", pe);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static inline void post_op_check(const char *op, int check_var, int iterations,
|
||||
if (check_var != iterations) {
|
||||
fprintf(stderr, "%s ERR: PE %d source = %d != %d\n", op, pe, check_var,
|
||||
iterations);
|
||||
roc_shmem_global_exit(EXIT_FAILURE);
|
||||
rocshmem_global_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ static inline void putfence(int me, int iterations, int T) {
|
||||
|
||||
if (me == 0) {
|
||||
for (i = 1; i < iterations; i++) {
|
||||
roc_shmem_long_p(&target[T], i, 1);
|
||||
roc_shmem_fence();
|
||||
rocshmem_long_p(&target[T], i, 1);
|
||||
rocshmem_fence();
|
||||
}
|
||||
|
||||
roc_shmem_long_p(&target[T], i, 1);
|
||||
rocshmem_long_p(&target[T], i, 1);
|
||||
|
||||
} else
|
||||
wait_until(&target[T], iterations, 1);
|
||||
@@ -101,13 +101,13 @@ static inline void gettest(int me, int iterations, int T, int S, int P) {
|
||||
if (me == 1) {
|
||||
pre_op_check(__func__, target[T], iterations, 1);
|
||||
|
||||
roc_shmem_long_p(&source[S], iterations, 0);
|
||||
roc_shmem_fence();
|
||||
rocshmem_long_p(&source[S], iterations, 0);
|
||||
rocshmem_fence();
|
||||
|
||||
for (i = 0; i < iterations; i++)
|
||||
target[T] = roc_shmem_long_g(&source[S], 0);
|
||||
target[T] = rocshmem_long_g(&source[S], 0);
|
||||
|
||||
roc_shmem_long_p(&sync_pes[P], iterations, 0);
|
||||
rocshmem_long_p(&sync_pes[P], iterations, 0);
|
||||
|
||||
post_op_check("get", target[T], iterations, 1);
|
||||
|
||||
@@ -125,14 +125,14 @@ static inline void atomic_inc(int me, int iterations, int T) {
|
||||
if (me == 1) pre_op_check(__func__, target[T], iterations, 1);
|
||||
|
||||
target[T] = 0;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 0) {
|
||||
for (i = 0; i < iterations; i++) {
|
||||
roc_shmem_int64_atomic_inc((int64_t *)&target[T], 1);
|
||||
roc_shmem_fence();
|
||||
rocshmem_int64_atomic_inc((int64_t *)&target[T], 1);
|
||||
rocshmem_fence();
|
||||
}
|
||||
roc_shmem_int64_atomic_inc((int64_t *)&target[T], 1);
|
||||
rocshmem_int64_atomic_inc((int64_t *)&target[T], 1);
|
||||
|
||||
if (debug) printf("PE 0 done with operation\n");
|
||||
|
||||
@@ -150,14 +150,14 @@ static inline void atomic_add(int me, int iterations, int T) {
|
||||
if (me == 0) pre_op_check(__func__, target[T], iterations, 0);
|
||||
|
||||
target[T] = 0;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 1) {
|
||||
for (i = 0; i < iterations; i++) {
|
||||
roc_shmem_int64_atomic_add((int64_t *)&target[T], 1, 0);
|
||||
roc_shmem_fence();
|
||||
rocshmem_int64_atomic_add((int64_t *)&target[T], 1, 0);
|
||||
rocshmem_fence();
|
||||
}
|
||||
roc_shmem_int64_atomic_add((int64_t *)&target[T], 1, 0);
|
||||
rocshmem_int64_atomic_add((int64_t *)&target[T], 1, 0);
|
||||
|
||||
if (debug) printf("PE 1 done with operation\n");
|
||||
|
||||
@@ -178,7 +178,7 @@ static inline void swaptest(int me, int iterations, int T, int S, int P)
|
||||
target[T] = tswap;
|
||||
source[S] = sswap;
|
||||
|
||||
roc_shmem_barrier_all(); /* Ensure target/source initialization completed */
|
||||
rocshmem_barrier_all(); /* Ensure target/source initialization completed */
|
||||
/*
|
||||
|
||||
if (me == 0)
|
||||
@@ -186,9 +186,9 @@ static inline void swaptest(int me, int iterations, int T, int S, int P)
|
||||
|
||||
if (me == 0) {
|
||||
for (i = 0; i < iterations; i++)
|
||||
source[S] = roc_shmem_long_atomic_swap(&target[T], source[S], 1);
|
||||
source[S] = rocshmem_long_atomic_swap(&target[T], source[S], 1);
|
||||
|
||||
roc_shmem_long_p(&sync_pes[P], i, 1);
|
||||
rocshmem_long_p(&sync_pes[P], i, 1);
|
||||
|
||||
if (debug)
|
||||
printf("AFTER flag PE 0 value of source is %d"
|
||||
@@ -199,7 +199,7 @@ static inline void swaptest(int me, int iterations, int T, int S, int P)
|
||||
(source[S] != sswap))) {
|
||||
fprintf(stderr, "swap ERR: PE 0 source = %d\n",
|
||||
source[S]);
|
||||
roc_shmem_global_exit(EXIT_FAILURE);
|
||||
rocshmem_global_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -210,7 +210,7 @@ static inline void swaptest(int me, int iterations, int T, int S, int P)
|
||||
(target[T] != tswap))) {
|
||||
fprintf(stderr, "swap ERR: PE 0 target = %d \n",
|
||||
target[T]);
|
||||
roc_shmem_global_exit(EXIT_FAILURE);
|
||||
rocshmem_global_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -227,16 +227,16 @@ static inline void cswaptest(int me, int iterations, int T, int S, int P) {
|
||||
source[S] = -100;
|
||||
|
||||
target[T] = 0;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 1) {
|
||||
pre_op_check(__func__, source[S], iterations, 1);
|
||||
|
||||
for (i = 0; i < iterations; i++)
|
||||
source[S] = roc_shmem_int64_atomic_compare_swap((int64_t *)&(target[T]),
|
||||
source[S] = rocshmem_int64_atomic_compare_swap((int64_t *)&(target[T]),
|
||||
i, (i + 1), 0);
|
||||
|
||||
roc_shmem_long_p(&sync_pes[P], i, 0);
|
||||
rocshmem_long_p(&sync_pes[P], i, 0);
|
||||
|
||||
post_op_check("compare_swap", source[S], (iterations - 1), 1);
|
||||
|
||||
@@ -246,7 +246,7 @@ static inline void cswaptest(int me, int iterations, int T, int S, int P) {
|
||||
if (target[T] != iterations) {
|
||||
fprintf(stderr, "compare_swap ERR: PE 1 target = %ld != %d\n", target[T],
|
||||
iterations);
|
||||
roc_shmem_global_exit(EXIT_FAILURE);
|
||||
rocshmem_global_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ static inline void fetchatomic_add(int me, int iterations, int T, int S) {
|
||||
if (me == 1) pre_op_check(__func__, target[T], iterations, 1);
|
||||
|
||||
target[T] = 0;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 0) {
|
||||
if (debug) {
|
||||
@@ -272,10 +272,10 @@ static inline void fetchatomic_add(int me, int iterations, int T, int S) {
|
||||
}
|
||||
|
||||
for (i = 0; i < iterations; i++) {
|
||||
source[S] = roc_shmem_int64_atomic_fetch_add((int64_t *)&target[T], 1, 1);
|
||||
roc_shmem_fence();
|
||||
source[S] = rocshmem_int64_atomic_fetch_add((int64_t *)&target[T], 1, 1);
|
||||
rocshmem_fence();
|
||||
}
|
||||
source[S] = roc_shmem_int64_atomic_fetch_add((int64_t *)&target[T], 1, 1);
|
||||
source[S] = rocshmem_int64_atomic_fetch_add((int64_t *)&target[T], 1, 1);
|
||||
|
||||
post_op_check("fetch_add", source[S], iterations, 0);
|
||||
|
||||
@@ -293,7 +293,7 @@ static inline void fetchatomic_inc(int me, int iterations, int T, int S) {
|
||||
if (me == 0) pre_op_check(__func__, target[T], iterations, 0);
|
||||
|
||||
target[T] = 0;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 1) {
|
||||
if (debug) {
|
||||
@@ -301,8 +301,8 @@ static inline void fetchatomic_inc(int me, int iterations, int T, int S) {
|
||||
}
|
||||
|
||||
for (i = 0; i < iterations; i++) {
|
||||
source[S] = roc_shmem_int64_atomic_fetch_inc((int64_t *)&target[T], 0);
|
||||
roc_shmem_fence();
|
||||
source[S] = rocshmem_int64_atomic_fetch_inc((int64_t *)&target[T], 0);
|
||||
rocshmem_fence();
|
||||
}
|
||||
|
||||
post_op_check("fetch_inc", source[S], (iterations - 1), 1);
|
||||
@@ -321,20 +321,20 @@ int main(int argc, char **argv) {
|
||||
const int DEFAULT_ITR = 7;
|
||||
int iterations = DEFAULT_ITR;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
nproc = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
nproc = rocshmem_n_pes();
|
||||
|
||||
target = (long *)roc_shmem_malloc(NUM_WRITE * sizeof(long));
|
||||
source = (long *)roc_shmem_malloc(NUM_READ * sizeof(long));
|
||||
sync_pes = (long *)roc_shmem_malloc(NUM_SYNC * sizeof(long));
|
||||
target = (long *)rocshmem_malloc(NUM_WRITE * sizeof(long));
|
||||
source = (long *)rocshmem_malloc(NUM_READ * sizeof(long));
|
||||
sync_pes = (long *)rocshmem_malloc(NUM_SYNC * sizeof(long));
|
||||
|
||||
memset(target, -1, NUM_WRITE * sizeof(int));
|
||||
memset(source, -1, NUM_READ * sizeof(int));
|
||||
memset(sync_pes, -1, NUM_SYNC * sizeof(int));
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (nproc != 2) {
|
||||
if (me == 0) {
|
||||
@@ -344,7 +344,7 @@ int main(int argc, char **argv) {
|
||||
" are using %d\n",
|
||||
nproc);
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ int main(int argc, char **argv) {
|
||||
"to run individual tests: -i <iterations>, -v"
|
||||
", -d, -p, -g, -a, -A, -s, -c, -f, -F, -h\n");
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -425,11 +425,11 @@ int main(int argc, char **argv) {
|
||||
printf("PE 0 Successful exit\n");
|
||||
}
|
||||
|
||||
roc_shmem_free(target);
|
||||
roc_shmem_free(source);
|
||||
roc_shmem_free(sync_pes);
|
||||
rocshmem_free(target);
|
||||
rocshmem_free(source);
|
||||
rocshmem_free(sync_pes);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -57,17 +57,17 @@ static void *thread_main(void *arg) {
|
||||
/* TEST CONCURRENT ATOMICS */
|
||||
val = me;
|
||||
for (i = 1; i <= npes; i++)
|
||||
roc_shmem_int64_atomic_add(&dest[tid], val, (me + i) % npes);
|
||||
rocshmem_int64_atomic_add(&dest[tid], val, (me + i) % npes);
|
||||
|
||||
/* Ensure that fence does not overlap with communication calls */
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (tid == 0) roc_shmem_fence();
|
||||
if (tid == 0) rocshmem_fence();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
|
||||
for (i = 1; i <= npes; i++)
|
||||
roc_shmem_int64_atomic_inc(&flag[tid], (me + i) % npes);
|
||||
rocshmem_int64_atomic_inc(&flag[tid], (me + i) % npes);
|
||||
|
||||
roc_shmem_long_wait_until(&flag[tid], ROC_SHMEM_CMP_EQ, npes);
|
||||
rocshmem_long_wait_until(&flag[tid], ROCSHMEM_CMP_EQ, npes);
|
||||
|
||||
expected = (npes - 1) * npes / 2;
|
||||
if (dest[tid] != expected || flag[tid] != npes) {
|
||||
@@ -81,21 +81,21 @@ static void *thread_main(void *arg) {
|
||||
}
|
||||
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (0 == tid) roc_shmem_barrier_all();
|
||||
if (0 == tid) rocshmem_barrier_all();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
|
||||
/* TEST CONCURRENT PUTS */
|
||||
val = -1;
|
||||
roc_shmem_long_put(&dest[tid], &val, 1, (me + 1) % npes);
|
||||
rocshmem_long_put(&dest[tid], &val, 1, (me + 1) % npes);
|
||||
|
||||
/* Ensure that all puts are issued before the shmem barrier is called. */
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (0 == tid) roc_shmem_barrier_all();
|
||||
if (0 == tid) rocshmem_barrier_all();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
|
||||
/* TEST CONCURRENT GETS */
|
||||
for (i = 1; i <= npes; i++) {
|
||||
roc_shmem_long_get(&val, &dest[tid], 1, (me + i) % npes);
|
||||
rocshmem_long_get(&val, &dest[tid], 1, (me + i) % npes);
|
||||
|
||||
expected = -1;
|
||||
if (val != expected) {
|
||||
@@ -110,7 +110,7 @@ static void *thread_main(void *arg) {
|
||||
}
|
||||
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (0 == tid) roc_shmem_barrier_all();
|
||||
if (0 == tid) rocshmem_barrier_all();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -120,21 +120,21 @@ int main(int argc, char **argv) {
|
||||
pthread_t threads[T];
|
||||
int t_arg[T];
|
||||
|
||||
roc_shmem_init_thread(ROC_SHMEM_THREAD_MULTIPLE, &tl);
|
||||
rocshmem_init_thread(ROCSHMEM_THREAD_MULTIPLE, &tl);
|
||||
|
||||
if (tl != ROC_SHMEM_THREAD_MULTIPLE) {
|
||||
if (tl != ROCSHMEM_THREAD_MULTIPLE) {
|
||||
printf("Init failed (requested thread level %d, got %d)\n",
|
||||
ROC_SHMEM_THREAD_MULTIPLE, tl);
|
||||
roc_shmem_global_exit(1);
|
||||
ROCSHMEM_THREAD_MULTIPLE, tl);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
pthread_barrier_init(&fencebar, NULL, T);
|
||||
|
||||
dest = (long *)roc_shmem_malloc(sizeof(long) * T);
|
||||
flag = (long *)roc_shmem_malloc(sizeof(long) * T);
|
||||
dest = (long *)rocshmem_malloc(sizeof(long) * T);
|
||||
flag = (long *)rocshmem_malloc(sizeof(long) * T);
|
||||
|
||||
if (me == 0)
|
||||
printf("Starting multithreaded test on %d PEs, %d threads/PE\n", npes, T);
|
||||
@@ -163,9 +163,9 @@ int main(int argc, char **argv) {
|
||||
printf("Success\n");
|
||||
}
|
||||
|
||||
roc_shmem_free(dest);
|
||||
roc_shmem_free(flag);
|
||||
rocshmem_free(dest);
|
||||
rocshmem_free(flag);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return (errors == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -53,9 +53,9 @@ static void *thread_main(void *arg) {
|
||||
* with overlapping AMOs behaves correctly. */
|
||||
|
||||
for (i = 1; i <= npes; i++)
|
||||
roc_shmem_int64_atomic_add(dest, tid, (me + i) % npes);
|
||||
rocshmem_int64_atomic_add(dest, tid, (me + i) % npes);
|
||||
|
||||
roc_shmem_quiet();
|
||||
rocshmem_quiet();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -65,21 +65,21 @@ int main(int argc, char **argv) {
|
||||
pthread_t threads[T];
|
||||
int t_arg[T];
|
||||
|
||||
roc_shmem_init_thread(ROC_SHMEM_THREAD_MULTIPLE, &tl);
|
||||
rocshmem_init_thread(ROCSHMEM_THREAD_MULTIPLE, &tl);
|
||||
|
||||
if (tl != ROC_SHMEM_THREAD_MULTIPLE) {
|
||||
if (tl != ROCSHMEM_THREAD_MULTIPLE) {
|
||||
printf("Init failed (requested thread level %d, got %d)\n",
|
||||
ROC_SHMEM_THREAD_MULTIPLE, tl);
|
||||
roc_shmem_global_exit(1);
|
||||
ROCSHMEM_THREAD_MULTIPLE, tl);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if (me == 0)
|
||||
printf("Starting multithreaded test on %d PEs, %d threads/PE\n", npes, T);
|
||||
|
||||
dest = (long *)roc_shmem_malloc(sizeof(long));
|
||||
dest = (long *)rocshmem_malloc(sizeof(long));
|
||||
*dest = 0;
|
||||
|
||||
for (i = 0; i < T; i++) {
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char **argv) {
|
||||
assert(0 == err);
|
||||
}
|
||||
|
||||
roc_shmem_sync_all();
|
||||
rocshmem_sync_all();
|
||||
|
||||
if ((*dest) != ((T - 1) * T / 2) * npes) {
|
||||
printf("%d: dest = %ld, expected %d\n", me, *dest,
|
||||
@@ -103,8 +103,8 @@ int main(int argc, char **argv) {
|
||||
errors++;
|
||||
}
|
||||
|
||||
roc_shmem_free(dest);
|
||||
rocshmem_free(dest);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return (errors == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -31,32 +31,32 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define NUM_POINTS 10000
|
||||
|
||||
int main(int argc, char *argv[], char *envp[]) {
|
||||
int me, myroc_shmem_n_pes;
|
||||
int me, myrocshmem_n_pes;
|
||||
long long *inside, *total;
|
||||
|
||||
/*
|
||||
** Starts/Initializes SHMEM/OpenSHMEM
|
||||
*/
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
/*
|
||||
** Fetch the number or processes
|
||||
** Some implementations use num_pes();
|
||||
*/
|
||||
myroc_shmem_n_pes = roc_shmem_n_pes();
|
||||
myrocshmem_n_pes = rocshmem_n_pes();
|
||||
/*
|
||||
** Assign my process ID to me
|
||||
*/
|
||||
me = roc_shmem_my_pe();
|
||||
me = rocshmem_my_pe();
|
||||
|
||||
inside = (long long *)roc_shmem_malloc(sizeof(long long));
|
||||
total = (long long *)roc_shmem_malloc(sizeof(long long));
|
||||
inside = (long long *)rocshmem_malloc(sizeof(long long));
|
||||
total = (long long *)rocshmem_malloc(sizeof(long long));
|
||||
*inside = *total = 0;
|
||||
|
||||
srand(1 + me);
|
||||
@@ -71,15 +71,15 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
int errors = 0;
|
||||
|
||||
if (me == 0) {
|
||||
for (int i = 1; i < myroc_shmem_n_pes; ++i) {
|
||||
for (int i = 1; i < myrocshmem_n_pes; ++i) {
|
||||
long long remoteInside, remoteTotal;
|
||||
roc_shmem_longlong_get(&remoteInside, inside, 1, i);
|
||||
roc_shmem_longlong_get(&remoteTotal, total, 1, i);
|
||||
rocshmem_longlong_get(&remoteInside, inside, 1, i);
|
||||
rocshmem_longlong_get(&remoteTotal, total, 1, i);
|
||||
(*total) += remoteTotal;
|
||||
(*inside) += remoteInside;
|
||||
}
|
||||
@@ -91,15 +91,15 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
|
||||
if (NULL == getenv("MAKELEVEL")) {
|
||||
printf("Pi from %llu points on %d PEs: %lf\n", *total, myroc_shmem_n_pes,
|
||||
printf("Pi from %llu points on %d PEs: %lf\n", *total, myrocshmem_n_pes,
|
||||
approx_pi);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(inside);
|
||||
roc_shmem_free(total);
|
||||
rocshmem_free(inside);
|
||||
rocshmem_free(total);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
@@ -41,19 +41,19 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define Rfprintf \
|
||||
if (roc_shmem_my_pe() == 0) fprintf
|
||||
if (rocshmem_my_pe() == 0) fprintf
|
||||
#define Rprintf \
|
||||
if (roc_shmem_my_pe() == 0) printf
|
||||
if (rocshmem_my_pe() == 0) printf
|
||||
|
||||
#define RDprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) printf
|
||||
if (Verbose && rocshmem_my_pe() == 0) printf
|
||||
#define RDfprintf \
|
||||
if (Verbose && roc_shmem_my_pe() == 0) fprintf
|
||||
if (Verbose && rocshmem_my_pe() == 0) fprintf
|
||||
|
||||
/* option flags */
|
||||
#define OUTPUT_MOD 1 // output debug every X loops
|
||||
@@ -75,13 +75,13 @@ int main(int argc, char *argv[]) {
|
||||
char *prog_name;
|
||||
long *Target;
|
||||
|
||||
roc_shmem_init();
|
||||
proc = roc_shmem_my_pe();
|
||||
num_procs = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
proc = rocshmem_my_pe();
|
||||
num_procs = rocshmem_n_pes();
|
||||
|
||||
if (num_procs == 1) {
|
||||
Rfprintf(stderr, "ERR - Requires > 1 PEs\n");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -106,17 +106,17 @@ int main(int argc, char *argv[]) {
|
||||
"ERR - output modulo arg out of "
|
||||
"bounds '%d'?]\n",
|
||||
output_mod);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
Rfprintf(stderr, "%s: output modulo %d\n", prog_name, output_mod);
|
||||
break;
|
||||
case 'h':
|
||||
Rfprintf(stderr, "usage: %s {nWords-2-put} {Loop-count}\n", prog_name);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
default:
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ int main(int argc, char *argv[]) {
|
||||
if (nWords <= 0 || nWords > TARGET_SZ) {
|
||||
Rfprintf(stderr, "ERR - nWords arg out of bounds '%d' [1..%d]?\n", nWords,
|
||||
TARGET_SZ);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) {
|
||||
loops = atoi(argv[optind++]);
|
||||
if (loops <= 0 || loops > 1000000) {
|
||||
Rfprintf(stderr, "ERR - loops arg out of bounds '%d'?\n", loops);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -148,33 +148,33 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
for (j = 0; j < nWords; j++) src[j] = VAL;
|
||||
|
||||
Target = (long *)roc_shmem_malloc(TARGET_SZ * sizeof(long));
|
||||
Target = (long *)rocshmem_malloc(TARGET_SZ * sizeof(long));
|
||||
|
||||
for (j = 0; j < loops; j++) {
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (Verbose && (j == 0 || (j % output_mod) == 0))
|
||||
fprintf(stderr, "[%d] +(%d)\n", roc_shmem_my_pe(), j);
|
||||
fprintf(stderr, "[%d] +(%d)\n", rocshmem_my_pe(), j);
|
||||
|
||||
if (proc == 0) {
|
||||
int p;
|
||||
for (p = 1; p < num_procs; p++)
|
||||
roc_shmem_long_put(Target, src, nWords, p);
|
||||
rocshmem_long_put(Target, src, nWords, p);
|
||||
} else {
|
||||
if (Slow) {
|
||||
/* wait for each put to complete */
|
||||
for (k = 0; k < nWords; k++)
|
||||
roc_shmem_long_wait_until(&Target[k], ROC_SHMEM_CMP_NE, proc);
|
||||
rocshmem_long_wait_until(&Target[k], ROCSHMEM_CMP_NE, proc);
|
||||
} else {
|
||||
/* wait for last word to be written */
|
||||
roc_shmem_long_wait_until(&Target[nWords - 1], ROC_SHMEM_CMP_NE, proc);
|
||||
rocshmem_long_wait_until(&Target[nWords - 1], ROCSHMEM_CMP_NE, proc);
|
||||
}
|
||||
}
|
||||
|
||||
if (Verbose && (j == 0 || (j % output_mod) == 0))
|
||||
fprintf(stderr, "[%d] -(%d)\n", roc_shmem_my_pe(), j);
|
||||
fprintf(stderr, "[%d] -(%d)\n", rocshmem_my_pe(), j);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (proc != 0) {
|
||||
for (k = 0; k < nWords; k++) {
|
||||
@@ -192,14 +192,14 @@ int main(int argc, char *argv[]) {
|
||||
memset(Target, 0, TARGET_SZ);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (failures || Verbose)
|
||||
Rprintf("%d(%d) Exit(%d)\n", proc, num_procs, failures);
|
||||
|
||||
roc_shmem_free(Target);
|
||||
rocshmem_free(Target);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return failures;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -40,38 +40,38 @@ int main(int argc, char *argv[]) {
|
||||
long source[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
long *target;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
if (roc_shmem_n_pes() == 1) {
|
||||
if (rocshmem_n_pes() == 1) {
|
||||
printf("%s: Requires number of PEs > 1\n", argv[0]);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
target = (long *)roc_shmem_malloc(10 * sizeof(long));
|
||||
target = (long *)rocshmem_malloc(10 * sizeof(long));
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
/* put 10 elements into target on PE 1 */
|
||||
roc_shmem_long_put(target, source, 10, 1);
|
||||
rocshmem_long_put(target, source, 10, 1);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
if (roc_shmem_my_pe() == 1) {
|
||||
if (rocshmem_my_pe() == 1) {
|
||||
if (0 != memcmp(source, target, sizeof(long) * 10)) {
|
||||
int i;
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", roc_shmem_my_pe());
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", rocshmem_my_pe());
|
||||
for (i = 0; i < 10; ++i) {
|
||||
printf("%ld,%ld ", source[i], target[i]);
|
||||
}
|
||||
printf("\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(target);
|
||||
rocshmem_free(target);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -16,7 +16,7 @@ using namespace rocshmem;
|
||||
#define LARGE_MSG_TH 16384
|
||||
#define DEF_LARGE_NUM_MESSAGES 64000
|
||||
|
||||
/* An ROC_SHMEM+threads put message-rate
|
||||
/* An rocSHMEM+threads put message-rate
|
||||
* and bandwidth benchmark.
|
||||
*
|
||||
* Always with 2 processes
|
||||
@@ -46,7 +46,7 @@ int run_bench(int rank, int size) {
|
||||
size_t buffer_size, contig_buffer_size;
|
||||
double *t_elapsed;
|
||||
double msg_rate, my_msg_rate, bandwidth, my_bandwidth;
|
||||
roc_shmem_ctx_t *ctx;
|
||||
rocshmem_ctx_t *ctx;
|
||||
char *dest_buf, *source_buf;
|
||||
|
||||
num_messages = WINDOW_SIZE * (num_messages / num_threads / WINDOW_SIZE);
|
||||
@@ -54,7 +54,7 @@ int run_bench(int rank, int size) {
|
||||
t_elapsed = (double *)calloc(num_threads, sizeof(double));
|
||||
|
||||
/* Allocate array of ctxs */
|
||||
ctx = (roc_shmem_ctx_t *)malloc(sizeof(roc_shmem_ctx_t) * num_threads);
|
||||
ctx = (rocshmem_ctx_t *)malloc(sizeof(rocshmem_ctx_t) * num_threads);
|
||||
|
||||
/**
|
||||
* Allocate contiguous buffer for all the threads on the target.
|
||||
@@ -63,17 +63,17 @@ int run_bench(int rank, int size) {
|
||||
buffer_size = (message_size + CACHE_LINE_SIZE) * sizeof(char);
|
||||
contig_buffer_size = buffer_size * num_threads;
|
||||
|
||||
dest_buf = (char *)roc_shmem_malloc(contig_buffer_size);
|
||||
dest_buf = (char *)rocshmem_malloc(contig_buffer_size);
|
||||
memset(dest_buf, 0, sizeof(contig_buffer_size));
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* Create windows */
|
||||
for (i = 0; i < num_threads; i++) {
|
||||
int err = roc_shmem_ctx_create(0, &ctx[i]);
|
||||
int err = rocshmem_ctx_create(0, &ctx[i]);
|
||||
if (err) {
|
||||
printf("PE %d: Warning, could not create context %d (%d)\n", rank, i,
|
||||
err);
|
||||
ctx[i] = ROC_SHMEM_CTX_DEFAULT;
|
||||
ctx[i] = ROCSHMEM_CTX_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int run_bench(int rank, int size) {
|
||||
int tid;
|
||||
int win_i, win_post_i, win_posts;
|
||||
int my_message_size;
|
||||
roc_shmem_ctx_t my_ctx;
|
||||
rocshmem_ctx_t my_ctx;
|
||||
|
||||
tid = omp_get_thread_num();
|
||||
my_message_size = message_size;
|
||||
@@ -107,14 +107,14 @@ int run_bench(int rank, int size) {
|
||||
/* Warmup */
|
||||
for (win_post_i = 0; win_post_i < win_posts; win_post_i++) {
|
||||
for (win_i = 0; win_i < WINDOW_SIZE; win_i++) {
|
||||
roc_shmem_ctx_putmem_nbi(my_ctx, my_dest_buf, my_source_buf,
|
||||
rocshmem_ctx_putmem_nbi(my_ctx, my_dest_buf, my_source_buf,
|
||||
my_message_size, rank + 1);
|
||||
}
|
||||
roc_shmem_ctx_quiet(my_ctx);
|
||||
rocshmem_ctx_quiet(my_ctx);
|
||||
}
|
||||
|
||||
#pragma omp master
|
||||
{ roc_shmem_barrier_all(); }
|
||||
{ rocshmem_barrier_all(); }
|
||||
#pragma omp barrier
|
||||
|
||||
/* Benchmark */
|
||||
@@ -122,10 +122,10 @@ int run_bench(int rank, int size) {
|
||||
|
||||
for (win_post_i = 0; win_post_i < win_posts; win_post_i++) {
|
||||
for (win_i = 0; win_i < WINDOW_SIZE; win_i++) {
|
||||
roc_shmem_ctx_putmem_nbi(my_ctx, my_dest_buf, my_source_buf,
|
||||
rocshmem_ctx_putmem_nbi(my_ctx, my_dest_buf, my_source_buf,
|
||||
my_message_size, rank + 1);
|
||||
}
|
||||
roc_shmem_ctx_quiet(my_ctx);
|
||||
rocshmem_ctx_quiet(my_ctx);
|
||||
}
|
||||
|
||||
t_end = get_time();
|
||||
@@ -138,14 +138,14 @@ int run_bench(int rank, int size) {
|
||||
/* Warmup */
|
||||
|
||||
#pragma omp master
|
||||
{ roc_shmem_barrier_all(); }
|
||||
{ rocshmem_barrier_all(); }
|
||||
#pragma omp barrier
|
||||
|
||||
/* Benchmark */
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (rank % 2 == 0) {
|
||||
int thread_i;
|
||||
@@ -169,9 +169,9 @@ int run_bench(int rank, int size) {
|
||||
printf("%f\n", bandwidth);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
for (i = 0; i < num_threads; i++) roc_shmem_ctx_destroy(ctx[i]);
|
||||
for (i = 0; i < num_threads; i++) rocshmem_ctx_destroy(ctx[i]);
|
||||
free(ctx);
|
||||
free(t_elapsed);
|
||||
hipFree(source_buf);
|
||||
@@ -227,17 +227,17 @@ int main(int argc, char *argv[]) {
|
||||
if (num_messages == DEF_NUM_MESSAGES) num_messages = DEF_LARGE_NUM_MESSAGES;
|
||||
}
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
size = roc_shmem_n_pes();
|
||||
size = rocshmem_n_pes();
|
||||
if (size != 2) {
|
||||
printf("Run with only two processes.\n");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
}
|
||||
|
||||
omp_set_num_threads(num_threads);
|
||||
|
||||
rank = roc_shmem_my_pe();
|
||||
rank = rocshmem_my_pe();
|
||||
|
||||
ret = run_bench(rank, size);
|
||||
if (ret) {
|
||||
@@ -245,7 +245,7 @@ int main(int argc, char *argv[]) {
|
||||
ret = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -47,49 +47,49 @@ int main(int argc, char *argv[]) {
|
||||
int i, num_pes;
|
||||
int failed = 0;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
target = (long *)roc_shmem_malloc(sizeof(long) * 10);
|
||||
flag = (int *)roc_shmem_malloc(sizeof(int));
|
||||
target = (long *)rocshmem_malloc(sizeof(long) * 10);
|
||||
flag = (int *)rocshmem_malloc(sizeof(int));
|
||||
if (!flag) {
|
||||
fprintf(stderr, "ERR - null flag pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
*flag = 0;
|
||||
|
||||
num_pes = roc_shmem_n_pes();
|
||||
num_pes = rocshmem_n_pes();
|
||||
|
||||
if (target) {
|
||||
memset(target, 0, sizeof(long) * 10);
|
||||
} else {
|
||||
fprintf(stderr, "ERR - null target pointer\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
for (i = 0; i < num_pes; i++) {
|
||||
roc_shmem_long_put_nbi(target, source, 10, i);
|
||||
roc_shmem_fence();
|
||||
roc_shmem_int64_atomic_inc((int64_t *)flag, i);
|
||||
rocshmem_long_put_nbi(target, source, 10, i);
|
||||
rocshmem_fence();
|
||||
rocshmem_int64_atomic_inc((int64_t *)flag, i);
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_int_wait_until(flag, ROC_SHMEM_CMP_EQ, 1);
|
||||
rocshmem_int_wait_until(flag, ROCSHMEM_CMP_EQ, 1);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (target[i] != source[i]) {
|
||||
fprintf(stderr, "[%d] target[%d] = %ld, expected %ld\n",
|
||||
roc_shmem_my_pe(), i, target[i], source[i]);
|
||||
rocshmem_my_pe(), i, target[i], source[i]);
|
||||
failed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(target);
|
||||
roc_shmem_free(flag);
|
||||
rocshmem_free(target);
|
||||
rocshmem_free(flag);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -35,22 +35,22 @@ int main(int argc, char* argv[]) {
|
||||
int provided;
|
||||
|
||||
int tl, ret;
|
||||
roc_shmem_init_thread(ROC_SHMEM_THREAD_FUNNELED, &tl);
|
||||
rocshmem_init_thread(ROCSHMEM_THREAD_FUNNELED, &tl);
|
||||
|
||||
if (tl < ROC_SHMEM_THREAD_FUNNELED || ret != 0) {
|
||||
if (tl < ROCSHMEM_THREAD_FUNNELED || ret != 0) {
|
||||
printf("Init failed (requested thread level %d, got %d)\n",
|
||||
ROC_SHMEM_THREAD_FUNNELED, tl);
|
||||
roc_shmem_global_exit(1);
|
||||
ROCSHMEM_THREAD_FUNNELED, tl);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
roc_shmem_query_thread(&provided);
|
||||
printf("%d: Query result for thread level %d\n", roc_shmem_my_pe(), provided);
|
||||
rocshmem_query_thread(&provided);
|
||||
printf("%d: Query result for thread level %d\n", rocshmem_my_pe(), provided);
|
||||
|
||||
if (provided < ROC_SHMEM_THREAD_FUNNELED) {
|
||||
if (provided < ROCSHMEM_THREAD_FUNNELED) {
|
||||
printf("Error: thread support changed to an invalid level after init\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -40,14 +40,14 @@ int main(void) {
|
||||
long *min_psync, *max_psync;
|
||||
long *min_pwrk, *max_pwrk;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
src = (long *)roc_shmem_malloc(NELEM * sizeof(long));
|
||||
dst_max = (long *)roc_shmem_malloc(NELEM * sizeof(long));
|
||||
dst_min = (long *)roc_shmem_malloc(NELEM * sizeof(long));
|
||||
src = (long *)rocshmem_malloc(NELEM * sizeof(long));
|
||||
dst_max = (long *)rocshmem_malloc(NELEM * sizeof(long));
|
||||
dst_min = (long *)rocshmem_malloc(NELEM * sizeof(long));
|
||||
|
||||
for (i = 0; i < NELEM; i++) {
|
||||
src[i] = me;
|
||||
@@ -56,22 +56,22 @@ int main(void) {
|
||||
}
|
||||
|
||||
max_psync =
|
||||
(long *)roc_shmem_malloc(ROC_SHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
(long *)rocshmem_malloc(ROCSHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
min_psync =
|
||||
(long *)roc_shmem_malloc(ROC_SHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
max_psync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
min_psync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
(long *)rocshmem_malloc(ROCSHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
max_psync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
min_psync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
max_pwrk = (long *)roc_shmem_malloc(
|
||||
(NELEM / 2 + ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
min_pwrk = (long *)roc_shmem_malloc(
|
||||
(NELEM / 2 + ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
max_pwrk = (long *)rocshmem_malloc(
|
||||
(NELEM / 2 + ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
min_pwrk = (long *)rocshmem_malloc(
|
||||
(NELEM / 2 + ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
|
||||
if (me == 0) printf("Shrinking active set test\n");
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
/* A total of npes tests are performed, where the active set in each test
|
||||
* includes PEs i..npes-1 */
|
||||
@@ -81,7 +81,7 @@ int main(void) {
|
||||
if (me == i)
|
||||
printf(" + PE_start=%d, logPE_stride=0, PE_size=%d\n", i, npes - i);
|
||||
|
||||
roc_shmem_ctx_long_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst_max, src, NELEM, i,
|
||||
rocshmem_ctx_long_max_to_all(ROCSHMEM_CTX_DEFAULT, dst_max, src, NELEM, i,
|
||||
0, npes - i, max_pwrk, max_psync);
|
||||
|
||||
/* Validate reduced data */
|
||||
@@ -96,7 +96,7 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_ctx_long_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst_min, src, NELEM, i,
|
||||
rocshmem_ctx_long_min_to_all(ROCSHMEM_CTX_DEFAULT, dst_min, src, NELEM, i,
|
||||
0, npes - i, min_pwrk, min_psync);
|
||||
|
||||
/* Validate reduced data */
|
||||
@@ -112,17 +112,17 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(src);
|
||||
roc_shmem_free(dst_max);
|
||||
roc_shmem_free(dst_min);
|
||||
rocshmem_free(src);
|
||||
rocshmem_free(dst_max);
|
||||
rocshmem_free(dst_min);
|
||||
|
||||
roc_shmem_free(max_psync);
|
||||
roc_shmem_free(min_psync);
|
||||
rocshmem_free(max_psync);
|
||||
rocshmem_free(min_psync);
|
||||
|
||||
roc_shmem_free(max_pwrk);
|
||||
roc_shmem_free(min_pwrk);
|
||||
rocshmem_free(max_pwrk);
|
||||
rocshmem_free(min_pwrk);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return errors != 0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -38,24 +38,24 @@ int main(void) {
|
||||
int errors = 0;
|
||||
long *psync, *pwrk, *src;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
src = (long *)roc_shmem_malloc(NELEM * sizeof(long));
|
||||
src = (long *)rocshmem_malloc(NELEM * sizeof(long));
|
||||
for (int i = 0; i < NELEM; i++) src[i] = me;
|
||||
|
||||
psync = (long *)roc_shmem_malloc(ROC_SHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (int i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i++)
|
||||
psync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
psync = (long *)rocshmem_malloc(ROCSHMEM_REDUCE_SYNC_SIZE * sizeof(long));
|
||||
for (int i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i++)
|
||||
psync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
|
||||
pwrk = (long *)roc_shmem_malloc(
|
||||
(NELEM / 2 + ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
pwrk = (long *)rocshmem_malloc(
|
||||
(NELEM / 2 + ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE) * sizeof(long));
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_long_max_to_all(ROC_SHMEM_CTX_DEFAULT, src, src, NELEM, 0, 0,
|
||||
rocshmem_ctx_long_max_to_all(ROCSHMEM_CTX_DEFAULT, src, src, NELEM, 0, 0,
|
||||
npes, pwrk, psync);
|
||||
|
||||
/* Validate reduced data */
|
||||
@@ -68,11 +68,11 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_free(src);
|
||||
roc_shmem_free(psync);
|
||||
roc_shmem_free(pwrk);
|
||||
rocshmem_free(src);
|
||||
rocshmem_free(psync);
|
||||
rocshmem_free(pwrk);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return errors != 0;
|
||||
}
|
||||
|
||||
@@ -33,20 +33,20 @@
|
||||
/*
|
||||
* usage: shmalloc [-p] [nWords] [loops] [incWords-per-loop]
|
||||
* where: -p == power-of-two allocation bump per loop
|
||||
* [nWords] # of longs to roc_shmem_malloc()\n"
|
||||
* [nWords] # of longs to rocshmem_malloc()\n"
|
||||
* [loops(1)] # of loops\n"
|
||||
* [incWords(2)] nWords += incWords per loop\n");
|
||||
* Loop:
|
||||
* PE* roc_shmem_malloc(nWords)
|
||||
* PE* rocshmem_malloc(nWords)
|
||||
* set *DataType = 1
|
||||
* PE* roc_shmem_malloc(nWords)
|
||||
* PE* rocshmem_malloc(nWords)
|
||||
* set *DataType = 2
|
||||
* PE* roc_shmem_malloc(nWords)
|
||||
* PE* rocshmem_malloc(nWords)
|
||||
* set *DataType = 3
|
||||
*
|
||||
* for(1...3) allocated ranges
|
||||
* verify
|
||||
* roc_shmem_free()
|
||||
* rocshmem_free()
|
||||
* end-loop
|
||||
*/
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -80,17 +80,17 @@ void usage(void);
|
||||
int getSize(char *);
|
||||
|
||||
void usage(void) {
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
fprintf(stderr, "Usage: %s [-p] [nWords(%d)] [loops(%d)] [incWords(%d)]\n",
|
||||
pgm, DFLT_NWORDS, DFLT_LOOPS, DFLT_INCR);
|
||||
fprintf(stderr,
|
||||
" -p == (2**0 ... 2**22) roc_shmem_malloc(), other args ignored\n"
|
||||
" -p == (2**0 ... 2**22) rocshmem_malloc(), other args ignored\n"
|
||||
" -v == Verbose output\n"
|
||||
" [nWords] # of longs to roc_shmem_malloc()\n"
|
||||
" [nWords] # of longs to rocshmem_malloc()\n"
|
||||
" [loops] # of loops\n"
|
||||
" [incWords] nWords += incWords per loop\n");
|
||||
}
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ int main(int argc, char **argv) {
|
||||
else
|
||||
pgm = argv[0];
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
nProcs = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
nProcs = rocshmem_n_pes();
|
||||
|
||||
while ((c = getopt(argc, argv, "hpv")) != -1) switch (c) {
|
||||
case 'p':
|
||||
@@ -181,61 +181,61 @@ int main(int argc, char **argv) {
|
||||
|
||||
for (l = 0; l < loops; l++) {
|
||||
/*
|
||||
result = (DataType *)roc_shmem_malloc(0);
|
||||
result = (DataType *)rocshmem_malloc(0);
|
||||
if (result != NULL) {
|
||||
perror ("Zero-length memory allocation has non-null result");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit (1);
|
||||
}
|
||||
*/
|
||||
|
||||
result_sz = nProcs * (nWords * sizeof(DataType));
|
||||
result = (DataType *)roc_shmem_malloc(result_sz);
|
||||
result = (DataType *)rocshmem_malloc(result_sz);
|
||||
if (!result) {
|
||||
perror("Failed result memory allocation");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
for (dp = result; dp < &result[(result_sz / sizeof(DataType))];) *dp++ = 1;
|
||||
|
||||
target_sz = nWords * sizeof(DataType);
|
||||
if (!(target = (DataType *)roc_shmem_malloc(target_sz))) {
|
||||
if (!(target = (DataType *)rocshmem_malloc(target_sz))) {
|
||||
perror("Failed target memory allocation");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
for (dp = target; dp < &target[(target_sz / sizeof(DataType))];) *dp++ = 2;
|
||||
|
||||
source_sz = 2 * nWords * sizeof(DataType);
|
||||
if (!(source = (DataType *)roc_shmem_malloc(source_sz))) {
|
||||
if (!(source = (DataType *)rocshmem_malloc(source_sz))) {
|
||||
perror("Failed source memory allocation");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
exit(1);
|
||||
}
|
||||
for (dp = source; dp < &source[(source_sz / sizeof(DataType))];) *dp++ = 3;
|
||||
|
||||
roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
for (dp = source; dp < &source[(source_sz / sizeof(DataType))]; dp++)
|
||||
if (*dp != 3) {
|
||||
printf("source not consistent @ 3?\n");
|
||||
break;
|
||||
}
|
||||
roc_shmem_free(source);
|
||||
rocshmem_free(source);
|
||||
|
||||
for (dp = target; dp < &target[(target_sz / sizeof(DataType))]; dp++)
|
||||
if (*dp != 2) {
|
||||
printf("target not consistent @ 2?\n");
|
||||
break;
|
||||
}
|
||||
roc_shmem_free(target);
|
||||
rocshmem_free(target);
|
||||
|
||||
for (dp = result; dp < &result[(result_sz / sizeof(DataType))]; dp++)
|
||||
if (*dp != 1) {
|
||||
printf("result not consistent @ 1?\n");
|
||||
break;
|
||||
}
|
||||
roc_shmem_free(result);
|
||||
rocshmem_free(result);
|
||||
|
||||
if (loops > 1) {
|
||||
if (Verbose && me == 0) {
|
||||
@@ -249,7 +249,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -68,33 +68,33 @@ static void error_check(int *errors, int *total_errors, char *routine, int me) {
|
||||
|
||||
int main(void) {
|
||||
int errors = 0, total_errors = 0;
|
||||
roc_shmem_init();
|
||||
int me = roc_shmem_my_pe();
|
||||
rocshmem_init();
|
||||
int me = rocshmem_my_pe();
|
||||
|
||||
long *dest = (long *)roc_shmem_malloc(NELEMS * sizeof(long));
|
||||
long *src = (long *)roc_shmem_malloc(NELEMS * sizeof(long));
|
||||
long *dest = (long *)rocshmem_malloc(NELEMS * sizeof(long));
|
||||
long *src = (long *)rocshmem_malloc(NELEMS * sizeof(long));
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < NELEMS; i++) {
|
||||
src[i] = me;
|
||||
}
|
||||
|
||||
TEST_B2B_COLLECTIVE("broadcast", roc_shmem_ctx_long_broadcast,
|
||||
ROC_SHMEM_CTX_DEFAULT, ROC_SHMEM_TEAM_WORLD, dest, src,
|
||||
TEST_B2B_COLLECTIVE("broadcast", rocshmem_ctx_long_broadcast,
|
||||
ROCSHMEM_CTX_DEFAULT, ROCSHMEM_TEAM_WORLD, dest, src,
|
||||
NELEMS, 0);
|
||||
TEST_B2B_COLLECTIVE("reduce", roc_shmem_ctx_long_sum_to_all,
|
||||
ROC_SHMEM_CTX_DEFAULT, ROC_SHMEM_TEAM_WORLD, dest, src,
|
||||
TEST_B2B_COLLECTIVE("reduce", rocshmem_ctx_long_sum_to_all,
|
||||
ROCSHMEM_CTX_DEFAULT, ROCSHMEM_TEAM_WORLD, dest, src,
|
||||
NELEMS);
|
||||
// TEST_B2B_COLLECTIVE("collect", roc_shmem_long_collect, SHMEM_TEAM_WORLD,
|
||||
// dest, src, NELEMS); TEST_B2B_COLLECTIVE("fcollect", roc_shmem_long_fcollect,
|
||||
// TEST_B2B_COLLECTIVE("collect", rocshmem_long_collect, SHMEM_TEAM_WORLD,
|
||||
// dest, src, NELEMS); TEST_B2B_COLLECTIVE("fcollect", rocshmem_long_fcollect,
|
||||
// SHMEM_TEAM_WORLD, dest, src, NELEMS); TEST_B2B_COLLECTIVE("alltoall",
|
||||
// roc_shmem_long_alltoall, SHMEM_TEAM_WORLD, dest, src, NELEMS);
|
||||
// TEST_B2B_COLLECTIVE("alltoalls", roc_shmem_long_alltoalls,
|
||||
// rocshmem_long_alltoall, SHMEM_TEAM_WORLD, dest, src, NELEMS);
|
||||
// TEST_B2B_COLLECTIVE("alltoalls", rocshmem_long_alltoalls,
|
||||
// SHMEM_TEAM_WORLD, dest, src, 1, 1, NELEMS);
|
||||
|
||||
roc_shmem_free(dest);
|
||||
roc_shmem_free(src);
|
||||
rocshmem_free(dest);
|
||||
rocshmem_free(src);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return total_errors;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
//#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -45,82 +45,82 @@ using namespace rocshmem;
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
#define REDUCTION(OP, TYPE) \
|
||||
do { \
|
||||
roc_shmem_ctx_##TYPE##_##OP##_to_all( \
|
||||
ROC_SHMEM_CTX_DEFAULT, ROC_SHMEM_TEAM_WORLD, dest, src, npes); \
|
||||
#define REDUCTION(OP, TYPE) \
|
||||
do { \
|
||||
rocshmem_ctx_##TYPE##_##OP##_to_all( \
|
||||
ROCSHMEM_CTX_DEFAULT, ROCSHMEM_TEAM_WORLD, dest, src, npes); \
|
||||
} while (0)
|
||||
|
||||
#define INIT_SRC_BUFFER(TYPE) \
|
||||
do { \
|
||||
for (int i = 0; i < MAX_NPES; i++) { \
|
||||
src[i] = (TYPE)1ULL; \
|
||||
} \
|
||||
#define INIT_SRC_BUFFER(TYPE) \
|
||||
do { \
|
||||
for (int i = 0; i < MAX_NPES; i++) { \
|
||||
src[i] = (TYPE)1ULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_DEST_BUFFER(OP, TYPE, CORRECT_VAL) \
|
||||
do { \
|
||||
for (int i = 0; i < npes; i++) { \
|
||||
if (dest[i] != (TYPE)CORRECT_VAL) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_REDUCE(%s, %s)\n", \
|
||||
mype, #OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
} \
|
||||
#define CHECK_DEST_BUFFER(OP, TYPE, CORRECT_VAL) \
|
||||
do { \
|
||||
for (int i = 0; i < npes; i++) { \
|
||||
if (dest[i] != (TYPE)CORRECT_VAL) { \
|
||||
printf( \
|
||||
"PE %i received incorrect value with " \
|
||||
"TEST_SHMEM_REDUCE(%s, %s)\n", \
|
||||
mype, #OP, #TYPE); \
|
||||
rc = EXIT_FAILURE; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TEST_SHMEM_REDUCE(OP, TYPENAME, TYPE) \
|
||||
do { \
|
||||
TYPE *src, *dest; \
|
||||
src = dest = nullptr; \
|
||||
src = (TYPE *)roc_shmem_malloc(sizeof(TYPE) * MAX_NPES); \
|
||||
dest = (TYPE *)roc_shmem_malloc(sizeof(TYPE) * MAX_NPES); \
|
||||
\
|
||||
INIT_SRC_BUFFER(TYPE); \
|
||||
\
|
||||
REDUCTION(OP, TYPENAME); \
|
||||
\
|
||||
roc_shmem_barrier_all(); \
|
||||
\
|
||||
std::string op = STRINGIFY(OP); \
|
||||
if (op.compare("and") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("or") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("xor") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, (TYPE)(npes % 2 ? 1ULL : 0ULL)); \
|
||||
} else if (op.compare("max") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("min") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("sum") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, npes); \
|
||||
} else if (op.compare("prod") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else { \
|
||||
printf("Invalid operation (%s)\n", STRINGIFY(OP)); \
|
||||
roc_shmem_global_exit(1); \
|
||||
} \
|
||||
\
|
||||
roc_shmem_free(src); \
|
||||
roc_shmem_free(dest); \
|
||||
\
|
||||
#define TEST_SHMEM_REDUCE(OP, TYPENAME, TYPE) \
|
||||
do { \
|
||||
TYPE *src, *dest; \
|
||||
src = dest = nullptr; \
|
||||
src = (TYPE *)rocshmem_malloc(sizeof(TYPE) * MAX_NPES); \
|
||||
dest = (TYPE *)rocshmem_malloc(sizeof(TYPE) * MAX_NPES); \
|
||||
\
|
||||
INIT_SRC_BUFFER(TYPE); \
|
||||
\
|
||||
REDUCTION(OP, TYPENAME); \
|
||||
\
|
||||
rocshmem_barrier_all(); \
|
||||
\
|
||||
std::string op = STRINGIFY(OP); \
|
||||
if (op.compare("and") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("or") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("xor") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, (TYPE)(npes % 2 ? 1ULL : 0ULL)); \
|
||||
} else if (op.compare("max") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("min") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else if (op.compare("sum") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, npes); \
|
||||
} else if (op.compare("prod") == 0) { \
|
||||
CHECK_DEST_BUFFER(OP, TYPE, 1ULL); \
|
||||
} else { \
|
||||
printf("Invalid operation (%s)\n", STRINGIFY(OP)); \
|
||||
rocshmem_global_exit(1); \
|
||||
} \
|
||||
\
|
||||
rocshmem_free(src); \
|
||||
rocshmem_free(dest); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
int main(void) {
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
int rc = EXIT_SUCCESS;
|
||||
|
||||
const int mype = roc_shmem_my_pe();
|
||||
const int npes = roc_shmem_n_pes();
|
||||
const int mype = rocshmem_my_pe();
|
||||
const int npes = rocshmem_n_pes();
|
||||
|
||||
if (npes > MAX_NPES) {
|
||||
if (mype == 0)
|
||||
fprintf(stderr, "ERR - Requires less than %d PEs\n", MAX_NPES);
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
// TEST_SHMEM_REDUCE(and, uchar, unsigned char);
|
||||
@@ -284,6 +284,6 @@ int main(void) {
|
||||
// TEST_SHMEM_REDUCE(prod, complexd, double _Complex);
|
||||
// TEST_SHMEM_REDUCE(prod, complexf, float _Complex);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -35,15 +35,15 @@ int main(void) {
|
||||
int i, me, npes;
|
||||
int ret = 0, errors = 0;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
|
||||
me = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
me = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
if (me == 0) printf("Reuse teams test\n");
|
||||
|
||||
roc_shmem_team_t old_team, new_team;
|
||||
ret = roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, npes, NULL, 0,
|
||||
rocshmem_team_t old_team, new_team;
|
||||
ret = rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, npes, NULL, 0,
|
||||
&old_team);
|
||||
if (ret) ++errors;
|
||||
|
||||
@@ -53,20 +53,20 @@ int main(void) {
|
||||
for (i = 1; i < npes; i++) {
|
||||
if (me == i) {
|
||||
printf("%3d: creating new team (start, stride, size): %3d, %3d, %3d\n",
|
||||
me, roc_shmem_team_translate_pe(old_team, 1, ROC_SHMEM_TEAM_WORLD),
|
||||
1, roc_shmem_team_n_pes(old_team) - 1);
|
||||
me, rocshmem_team_translate_pe(old_team, 1, ROCSHMEM_TEAM_WORLD),
|
||||
1, rocshmem_team_n_pes(old_team) - 1);
|
||||
}
|
||||
|
||||
ret = roc_shmem_team_split_strided(
|
||||
old_team, 1, 1, roc_shmem_team_n_pes(old_team) - 1, NULL, 0, &new_team);
|
||||
if (old_team != ROC_SHMEM_TEAM_INVALID && ret) ++errors;
|
||||
ret = rocshmem_team_split_strided(
|
||||
old_team, 1, 1, rocshmem_team_n_pes(old_team) - 1, NULL, 0, &new_team);
|
||||
if (old_team != ROCSHMEM_TEAM_INVALID && ret) ++errors;
|
||||
|
||||
roc_shmem_team_destroy(old_team);
|
||||
rocshmem_team_destroy(old_team);
|
||||
old_team = new_team;
|
||||
}
|
||||
|
||||
roc_shmem_team_destroy(old_team);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_team_destroy(old_team);
|
||||
rocshmem_finalize();
|
||||
|
||||
return errors != 0;
|
||||
}
|
||||
|
||||
@@ -21,38 +21,38 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ROC_SHMEM roc_shmem_team_translate example to verify the team formed by even
|
||||
* ranked PEs from ROC_SHMEM_TEAM_WORLD using the team created from
|
||||
* roc_shmem_team_split_stride operation
|
||||
* rocSHMEM rocshmem_team_translate example to verify the team formed by even
|
||||
* ranked PEs from ROCSHMEM_TEAM_WORLD using the team created from
|
||||
* rocshmem_team_split_stride operation
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
int main(void) {
|
||||
int my_pe, npes, errors = 0;
|
||||
int t_pe_2, t_pe_3, t_pe_2_to_3, t_pe_3_to_2;
|
||||
roc_shmem_team_t team_2s;
|
||||
roc_shmem_team_t team_3s;
|
||||
roc_shmem_team_config_t *config;
|
||||
rocshmem_team_t team_2s;
|
||||
rocshmem_team_t team_3s;
|
||||
rocshmem_team_config_t *config;
|
||||
|
||||
roc_shmem_init();
|
||||
rocshmem_init();
|
||||
config = NULL;
|
||||
my_pe = roc_shmem_my_pe();
|
||||
npes = roc_shmem_n_pes();
|
||||
my_pe = rocshmem_my_pe();
|
||||
npes = rocshmem_n_pes();
|
||||
|
||||
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 2, ((npes - 1) / 2) + 1,
|
||||
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 2, ((npes - 1) / 2) + 1,
|
||||
config, 0, &team_2s);
|
||||
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 3, ((npes - 1) / 3) + 1,
|
||||
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 3, ((npes - 1) / 3) + 1,
|
||||
config, 0, &team_3s);
|
||||
|
||||
t_pe_3 = roc_shmem_team_my_pe(team_3s);
|
||||
t_pe_2 = roc_shmem_team_my_pe(team_2s);
|
||||
t_pe_3_to_2 = roc_shmem_team_translate_pe(team_3s, t_pe_3, team_2s);
|
||||
t_pe_2_to_3 = roc_shmem_team_translate_pe(team_2s, t_pe_2, team_3s);
|
||||
t_pe_3 = rocshmem_team_my_pe(team_3s);
|
||||
t_pe_2 = rocshmem_team_my_pe(team_2s);
|
||||
t_pe_3_to_2 = rocshmem_team_translate_pe(team_3s, t_pe_3, team_2s);
|
||||
t_pe_2_to_3 = rocshmem_team_translate_pe(team_2s, t_pe_2, team_3s);
|
||||
|
||||
if (my_pe % 2 == 0 && my_pe % 3 == 0) {
|
||||
if (t_pe_2 == -1 || t_pe_3 == -1 || t_pe_2_to_3 == -1 ||
|
||||
@@ -92,6 +92,6 @@ int main(void) {
|
||||
}
|
||||
}
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return errors != 0;
|
||||
}
|
||||
|
||||
@@ -27,41 +27,41 @@
|
||||
*/
|
||||
|
||||
/* Each PE sends a message to every PE. PEs wait for all messages to
|
||||
* arrive using roc_shmem_test to poll the array. */
|
||||
* arrive using rocshmem_test to poll the array. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
/* Wait for any entry in the given ivar array to match the wait criteria and
|
||||
* return the index of the entry that satisfied the test. */
|
||||
static int wait_any(long *ivar, int count, roc_shmem_cmps cmp, long value) {
|
||||
static int wait_any(long *ivar, int count, rocshmem_cmps cmp, long value) {
|
||||
int idx = 0;
|
||||
while (!roc_shmem_long_test(&ivar[idx], cmp, value)) idx = (idx + 1) % count;
|
||||
while (!rocshmem_long_test(&ivar[idx], cmp, value)) idx = (idx + 1) % count;
|
||||
return idx;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
roc_shmem_init();
|
||||
const int mype = roc_shmem_my_pe();
|
||||
const int npes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
const int mype = rocshmem_my_pe();
|
||||
const int npes = rocshmem_n_pes();
|
||||
|
||||
long *wait_vars = (long *)roc_shmem_malloc(npes * sizeof(long));
|
||||
long *wait_vars = (long *)rocshmem_malloc(npes * sizeof(long));
|
||||
for (int i = 0; i < npes; i++) {
|
||||
wait_vars[i] = 0;
|
||||
}
|
||||
|
||||
/* Put mype+1 to every PE */
|
||||
for (int i = 0; i < npes; i++)
|
||||
roc_shmem_long_p(&wait_vars[mype], mype + 1, i);
|
||||
rocshmem_long_p(&wait_vars[mype], mype + 1, i);
|
||||
|
||||
int nrecv = 0, errors = 0;
|
||||
|
||||
/* Wait for all messages to arrive */
|
||||
while (nrecv < npes) {
|
||||
int who = wait_any(wait_vars, npes, ROC_SHMEM_CMP_NE, 0);
|
||||
int who = wait_any(wait_vars, npes, ROCSHMEM_CMP_NE, 0);
|
||||
if (wait_vars[who] != who + 1) {
|
||||
printf("%d: wait_vars[%d] = %ld, expected %d\n", mype, who,
|
||||
wait_vars[who], who + 1);
|
||||
@@ -71,7 +71,7 @@ int main(void) {
|
||||
nrecv++;
|
||||
}
|
||||
|
||||
roc_shmem_free(wait_vars);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_free(wait_vars);
|
||||
rocshmem_finalize();
|
||||
return errors;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void printStats(int, int, int, int, double);
|
||||
|
||||
int Verbose = 0;
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -99,7 +99,7 @@ void usage(char *name) {
|
||||
}
|
||||
|
||||
void help(char *name) {
|
||||
if (roc_shmem_my_pe() == 0) {
|
||||
if (rocshmem_my_pe() == 0) {
|
||||
printf("Usage: %s [flags] nwords [maxWords] [incWords]\n\n", name);
|
||||
printf(" Flags may be any of\n");
|
||||
printf(" -n number repititions\n");
|
||||
@@ -107,7 +107,7 @@ void help(char *name) {
|
||||
printf(" -h print this info\n\n");
|
||||
printf(" Numbers may be postfixed with 'k' or 'm'\n\n");
|
||||
}
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ int main(int argc, char *argv[]) {
|
||||
long *rbuf; /* remote buffer - sink */
|
||||
long *tbuf; /* transmit buffer - src */
|
||||
|
||||
roc_shmem_init();
|
||||
proc = roc_shmem_my_pe();
|
||||
nproc = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
proc = rocshmem_my_pe();
|
||||
nproc = rocshmem_n_pes();
|
||||
if (nproc == 1) {
|
||||
fprintf(stderr, "ERR - Requires > 1 Processing Elements\n");
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -172,13 +172,13 @@ int main(int argc, char *argv[]) {
|
||||
else if ((incWords = getSize(argv[optind++])) < 0)
|
||||
usage(progName);
|
||||
|
||||
if (!(rbuf = (long *)roc_shmem_malloc(maxWords * sizeof(long)))) {
|
||||
if (!(rbuf = (long *)rocshmem_malloc(maxWords * sizeof(long)))) {
|
||||
perror("Failed memory allocation");
|
||||
exit(1);
|
||||
}
|
||||
memset(rbuf, 0, maxWords * sizeof(long));
|
||||
|
||||
if (!(tbuf = (long *)roc_shmem_malloc(maxWords * sizeof(long)))) {
|
||||
if (!(tbuf = (long *)rocshmem_malloc(maxWords * sizeof(long)))) {
|
||||
perror("Failed memory allocation");
|
||||
exit(1);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
dprint("[%d] rbuf: %ld\n", proc, (unsigned long)rbuf);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
peer = proc ^ 1;
|
||||
if (peer >= nproc) doprint = 0;
|
||||
@@ -201,37 +201,37 @@ int main(int argc, char *argv[]) {
|
||||
for (nwords = minWords; nwords <= maxWords;
|
||||
nwords = incWords ? nwords + incWords : nwords ? 2 * nwords : 1) {
|
||||
r = reps;
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
tv[0] = gettime();
|
||||
if (peer < nproc) {
|
||||
if (proc & 1) {
|
||||
r--;
|
||||
roc_shmem_long_wait_until(&rbuf[nwords - 1], ROC_SHMEM_CMP_NE, 0);
|
||||
rocshmem_long_wait_until(&rbuf[nwords - 1], ROCSHMEM_CMP_NE, 0);
|
||||
rbuf[nwords - 1] = 0;
|
||||
}
|
||||
|
||||
while (r-- > 0) {
|
||||
roc_shmem_long_put(rbuf, tbuf, nwords, peer);
|
||||
roc_shmem_long_wait_until(&rbuf[nwords - 1], ROC_SHMEM_CMP_NE, 0);
|
||||
rocshmem_long_put(rbuf, tbuf, nwords, peer);
|
||||
rocshmem_long_wait_until(&rbuf[nwords - 1], ROCSHMEM_CMP_NE, 0);
|
||||
rbuf[nwords - 1] = 0;
|
||||
}
|
||||
|
||||
if (proc & 1) {
|
||||
roc_shmem_long_put(rbuf, tbuf, nwords, peer);
|
||||
rocshmem_long_put(rbuf, tbuf, nwords, peer);
|
||||
}
|
||||
}
|
||||
tv[1] = gettime();
|
||||
t = dt(&tv[1], &tv[0]) / (2 * reps);
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
printStats(proc, peer, doprint, nwords, t);
|
||||
}
|
||||
|
||||
roc_shmem_free(rbuf);
|
||||
roc_shmem_free(tbuf);
|
||||
rocshmem_free(rbuf);
|
||||
rocshmem_free(tbuf);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
*/
|
||||
|
||||
/* Thread wait test: Test whether a store performed by one thead will wake up a
|
||||
* second thread from a call to roc_shmem_wait. */
|
||||
* second thread from a call to rocshmem_wait. */
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -46,12 +46,12 @@ static void *src_thread_fn(void *arg) {
|
||||
*shr_var = 1;
|
||||
|
||||
/* Quiet should provide a store fence */
|
||||
roc_shmem_quiet();
|
||||
rocshmem_quiet();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *dst_thread_fn(void *arg) {
|
||||
roc_shmem_long_wait_until(shr_var, ROC_SHMEM_CMP_NE, 0);
|
||||
rocshmem_long_wait_until(shr_var, ROCSHMEM_CMP_NE, 0);
|
||||
printf("shr_var is now %ld\n", *shr_var);
|
||||
return NULL;
|
||||
}
|
||||
@@ -60,15 +60,15 @@ int main(int argc, char *argv[]) {
|
||||
int tl, ret;
|
||||
pthread_t src_thread, dst_thread;
|
||||
|
||||
roc_shmem_init_thread(ROC_SHMEM_THREAD_MULTIPLE, &tl);
|
||||
rocshmem_init_thread(ROCSHMEM_THREAD_MULTIPLE, &tl);
|
||||
|
||||
if (tl != ROC_SHMEM_THREAD_MULTIPLE) {
|
||||
if (tl != ROCSHMEM_THREAD_MULTIPLE) {
|
||||
printf("Init failed (requested thread level %d, got %d)\n",
|
||||
ROC_SHMEM_THREAD_MULTIPLE, tl);
|
||||
roc_shmem_global_exit(1);
|
||||
ROCSHMEM_THREAD_MULTIPLE, tl);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
shr_var = (long *)roc_shmem_malloc(sizeof(long));
|
||||
shr_var = (long *)rocshmem_malloc(sizeof(long));
|
||||
*shr_var = 0;
|
||||
|
||||
pthread_create(&dst_thread, NULL, &dst_thread_fn, NULL);
|
||||
@@ -77,9 +77,9 @@ int main(int argc, char *argv[]) {
|
||||
pthread_join(dst_thread, NULL);
|
||||
pthread_join(src_thread, NULL);
|
||||
|
||||
roc_shmem_free(shr_var);
|
||||
rocshmem_free(shr_var);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
@@ -48,27 +48,27 @@ static void *roundrobin(void *tparam) {
|
||||
int offset = tid * N_ELEMS;
|
||||
/* fprintf(stderr,"Starting thread %lu with offset %d\n",tid,offset); */
|
||||
|
||||
int nextpe = (roc_shmem_my_pe() + 1) % roc_shmem_n_pes();
|
||||
int prevpe = (roc_shmem_my_pe() - 1 + roc_shmem_n_pes()) % roc_shmem_n_pes();
|
||||
roc_shmem_long_put(target + offset, source + offset, N_ELEMS, nextpe);
|
||||
int nextpe = (rocshmem_my_pe() + 1) % rocshmem_n_pes();
|
||||
int prevpe = (rocshmem_my_pe() - 1 + rocshmem_n_pes()) % rocshmem_n_pes();
|
||||
rocshmem_long_put(target + offset, source + offset, N_ELEMS, nextpe);
|
||||
|
||||
/* fprintf(stderr,"Thread %lu done first put\n",tid); */
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (tid == 0) roc_shmem_barrier_all();
|
||||
if (tid == 0) rocshmem_barrier_all();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
|
||||
roc_shmem_long_get(source + offset, target + offset, N_ELEMS, prevpe);
|
||||
rocshmem_long_get(source + offset, target + offset, N_ELEMS, prevpe);
|
||||
|
||||
/* fprintf(stderr,"Thread %lu done first get\n",tid); */
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (tid == 0) roc_shmem_barrier_all();
|
||||
if (tid == 0) rocshmem_barrier_all();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
|
||||
roc_shmem_long_get(target + offset, source + offset, N_ELEMS, nextpe);
|
||||
rocshmem_long_get(target + offset, source + offset, N_ELEMS, nextpe);
|
||||
|
||||
/* fprintf(stderr,"Thread %lu done second get\n",tid); */
|
||||
pthread_barrier_wait(&fencebar);
|
||||
if (tid == 0) roc_shmem_barrier_all();
|
||||
if (tid == 0) rocshmem_barrier_all();
|
||||
pthread_barrier_wait(&fencebar);
|
||||
/* fprintf(stderr,"Done thread %lu\n",tid); */
|
||||
|
||||
@@ -79,22 +79,22 @@ int main(int argc, char *argv[]) {
|
||||
int i;
|
||||
|
||||
int tl;
|
||||
roc_shmem_init_thread(ROC_SHMEM_THREAD_MULTIPLE, &tl);
|
||||
rocshmem_init_thread(ROCSHMEM_THREAD_MULTIPLE, &tl);
|
||||
|
||||
if (tl != ROC_SHMEM_THREAD_MULTIPLE) {
|
||||
if (tl != ROCSHMEM_THREAD_MULTIPLE) {
|
||||
printf("Init failed (requested thread level %d, got %d)\n",
|
||||
ROC_SHMEM_THREAD_MULTIPLE, tl);
|
||||
roc_shmem_global_exit(1);
|
||||
ROCSHMEM_THREAD_MULTIPLE, tl);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
if (roc_shmem_n_pes() == 1) {
|
||||
if (rocshmem_n_pes() == 1) {
|
||||
printf("%s: Requires number of PEs > 1\n", argv[0]);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
source = (long *)roc_shmem_malloc(N_THREADS * N_ELEMS * sizeof(long));
|
||||
target = (long *)roc_shmem_malloc(N_THREADS * N_ELEMS * sizeof(long));
|
||||
source = (long *)rocshmem_malloc(N_THREADS * N_ELEMS * sizeof(long));
|
||||
target = (long *)rocshmem_malloc(N_THREADS * N_ELEMS * sizeof(long));
|
||||
|
||||
for (i = 0; i < N_THREADS * N_ELEMS; ++i) {
|
||||
source[i] = i + 1;
|
||||
@@ -117,18 +117,18 @@ int main(int argc, char *argv[]) {
|
||||
pthread_barrier_destroy(&fencebar);
|
||||
|
||||
if (0 != memcmp(source, target, sizeof(long) * N_THREADS * N_ELEMS)) {
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", roc_shmem_my_pe());
|
||||
fprintf(stderr, "[%d] Src & Target mismatch?\n", rocshmem_my_pe());
|
||||
for (i = 0; i < 10; ++i) {
|
||||
printf("%ld,%ld ", source[i], target[i]);
|
||||
}
|
||||
printf("\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
|
||||
roc_shmem_free(source);
|
||||
roc_shmem_free(target);
|
||||
rocshmem_free(source);
|
||||
rocshmem_free(target);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+196
-196
@@ -65,14 +65,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define Rprintf \
|
||||
if (roc_shmem_my_pe() == 0) printf
|
||||
if (rocshmem_my_pe() == 0) printf
|
||||
#define Rfprintf \
|
||||
if (roc_shmem_my_pe() == 0) fprintf
|
||||
if (rocshmem_my_pe() == 0) fprintf
|
||||
#define Vprintf \
|
||||
if (Verbose > 1) printf
|
||||
|
||||
@@ -95,7 +95,7 @@ long *pSync1;
|
||||
#define N 128
|
||||
|
||||
#define MAX(a, b) ((a) > (b)) ? (a) : (b)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROC_SHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
#define WRK_SIZE MAX(N / 2 + 1, ROCSHMEM_REDUCE_MIN_WRKDATA_SIZE)
|
||||
|
||||
short *src0, *dst0, *pWrk0;
|
||||
int *src1, *dst1, *pWrk1;
|
||||
@@ -124,21 +124,21 @@ int max_to_all(int me, int npes) {
|
||||
src0[i] = src1[i] = src2[i] = src3[i] = src4[i] = src5[i] = src6[i] =
|
||||
me + i;
|
||||
}
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_max_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
rocshmem_ctx_int_max_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_max_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
npes, pWrk2, pSync);
|
||||
roc_shmem_ctx_float_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
rocshmem_ctx_float_max_to_all(ROCSHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
npes, pWrk3, pSync1);
|
||||
roc_shmem_ctx_double_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
rocshmem_ctx_double_max_to_all(ROCSHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
npes, pWrk4, pSync);
|
||||
// roc_shmem_ctx_longdouble_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// rocshmem_ctx_longdouble_max_to_all(ROCSHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// 0, 0, npes, pWrk5, pSync1);
|
||||
roc_shmem_ctx_longlong_max_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_max_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -153,54 +153,54 @@ int max_to_all(int me, int npes) {
|
||||
}
|
||||
|
||||
if (ok[0] == 1) {
|
||||
printf("Reduction operation roc_shmem_short_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_short_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[1] == 1) {
|
||||
printf("Reduction operation roc_shmem_int_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_int_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[2] == 1) {
|
||||
printf("Reduction operation roc_shmem_long_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_long_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[3] == 1) {
|
||||
printf("Reduction operation roc_shmem_float_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_float_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_float_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_float_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[4] == 1) {
|
||||
printf("Reduction operation roc_shmem_double_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_double_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_double_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_double_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
/*
|
||||
if(ok[5]==1){
|
||||
printf("Reduction operation roc_shmem_longdouble_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longdouble_max_to_all: Failed\n");
|
||||
}
|
||||
else{
|
||||
Vprintf("Reduction operation roc_shmem_longdouble_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longdouble_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
*/
|
||||
pass++;
|
||||
if (ok[6] == 1) {
|
||||
printf("Reduction operation roc_shmem_longlong_max_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_max_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_max_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_max_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 7 ? 1 : 0);
|
||||
}
|
||||
@@ -222,21 +222,21 @@ int min_to_all(int me, int npes) {
|
||||
dst6[i] = -9;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_min_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
rocshmem_ctx_int_min_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_min_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
npes, pWrk2, pSync);
|
||||
roc_shmem_ctx_float_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
rocshmem_ctx_float_min_to_all(ROCSHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
npes, pWrk3, pSync1);
|
||||
roc_shmem_ctx_double_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
rocshmem_ctx_double_min_to_all(ROCSHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
npes, pWrk4, pSync);
|
||||
// roc_shmem_ctx_longdouble_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// rocshmem_ctx_longdouble_min_to_all(ROCSHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// 0, 0, npes, pWrk5, pSync1);
|
||||
roc_shmem_ctx_longlong_min_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_min_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -250,54 +250,54 @@ int min_to_all(int me, int npes) {
|
||||
if (dst6[i] != i) ok[6] = 1;
|
||||
}
|
||||
if (ok[0] == 1) {
|
||||
printf("Reduction operation roc_shmem_short_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_short_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[1] == 1) {
|
||||
printf("Reduction operation roc_shmem_int_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_int_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[2] == 1) {
|
||||
printf("Reduction operation roc_shmem_long_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_long_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[3] == 1) {
|
||||
printf("Reduction operation roc_shmem_float_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_float_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_float_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_float_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[4] == 1) {
|
||||
printf("Reduction operation roc_shmem_double_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_double_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_double_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_double_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
/*
|
||||
if(ok[5]==1){
|
||||
printf("Reduction operation roc_shmem_longdouble_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longdouble_min_to_all: Failed\n");
|
||||
}
|
||||
else{
|
||||
Vprintf("Reduction operation roc_shmem_longdouble_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longdouble_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
*/
|
||||
pass++;
|
||||
if (ok[6] == 1) {
|
||||
printf("Reduction operation roc_shmem_longlong_min_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_min_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_min_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_min_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 7 ? 1 : 0);
|
||||
}
|
||||
@@ -318,21 +318,21 @@ int sum_to_all(int me, int npes) {
|
||||
dst6[i] = -9;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
rocshmem_ctx_int_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
npes, pWrk2, pSync);
|
||||
roc_shmem_ctx_float_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
rocshmem_ctx_float_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
npes, pWrk3, pSync1);
|
||||
roc_shmem_ctx_double_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
rocshmem_ctx_double_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
npes, pWrk4, pSync);
|
||||
// roc_shmem_ctx_longdouble_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// rocshmem_ctx_longdouble_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// 0, 0, npes, pWrk5, pSync1);
|
||||
roc_shmem_ctx_longlong_sum_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_sum_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -346,55 +346,55 @@ int sum_to_all(int me, int npes) {
|
||||
if (dst6[i] != (long long)(npes * (npes - 1) / 2)) ok[6] = 1;
|
||||
}
|
||||
if (ok[0] == 1) {
|
||||
printf("Reduction operation roc_shmem_short_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_short_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[1] == 1) {
|
||||
printf("Reduction operation roc_shmem_int_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_int_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[2] == 1) {
|
||||
printf("Reduction operation roc_shmem_long_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_long_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[3] == 1) {
|
||||
printf("Reduction operation roc_shmem_float_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_float_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_float_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_float_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[4] == 1) {
|
||||
printf("Reduction operation roc_shmem_double_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_double_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_double_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_double_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
/*
|
||||
if(ok[5]==1){
|
||||
printf("Reduction operation roc_shmem_longdouble_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longdouble_sum_to_all: Failed\n");
|
||||
}
|
||||
else{
|
||||
Vprintf("Reduction operation roc_shmem_longdouble_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longdouble_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
*/
|
||||
pass++;
|
||||
if (ok[6] == 1) {
|
||||
printf("Reduction operation roc_shmem_longlong_sum_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_sum_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_sum_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_sum_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 7 ? 1 : 0);
|
||||
}
|
||||
@@ -409,15 +409,15 @@ int and_to_all(int me, int num_pes) {
|
||||
dst0[i] = dst1[i] = dst2[i] = dst6[i] = -9;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_and_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_and_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
num_pes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_and_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0,
|
||||
rocshmem_ctx_int_and_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0,
|
||||
num_pes, pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_and_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_and_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
num_pes, pWrk2, pSync);
|
||||
roc_shmem_ctx_longlong_and_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_and_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
num_pes, pWrk6, pSync1);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -429,33 +429,33 @@ int and_to_all(int me, int num_pes) {
|
||||
}
|
||||
|
||||
if (ok[0] == 1) {
|
||||
printf("Reduction operation roc_shmem_short_and_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_and_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_short_and_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_and_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[1] == 1) {
|
||||
printf("Reduction operation roc_shmem_int_and_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_and_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_int_and_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_and_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[2] == 1) {
|
||||
printf("Reduction operation roc_shmem_long_and_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_and_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_long_and_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_and_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
if (ok[3] == 1) {
|
||||
printf("Reduction operation roc_shmem_longlong_and_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_and_to_all: Failed\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_and_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_and_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 4 ? 1 : 0);
|
||||
}
|
||||
@@ -503,21 +503,21 @@ int prod_to_all(int me, int npes) {
|
||||
expected_result6 *= i;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0,
|
||||
rocshmem_ctx_int_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0,
|
||||
npes, pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
npes, pWrk2, pSync);
|
||||
roc_shmem_ctx_float_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
rocshmem_ctx_float_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst3, src3, N, 0, 0,
|
||||
npes, pWrk3, pSync1);
|
||||
roc_shmem_ctx_double_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
rocshmem_ctx_double_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst4, src4, N, 0, 0,
|
||||
npes, pWrk4, pSync);
|
||||
// roc_shmem_ctx_longdouble_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// rocshmem_ctx_longdouble_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst5, src5, N,
|
||||
// 0, 0, npes, pWrk5, pSync1);
|
||||
roc_shmem_ctx_longlong_prod_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_prod_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -547,62 +547,62 @@ int prod_to_all(int me, int npes) {
|
||||
}
|
||||
|
||||
if (ok[0] == 1)
|
||||
printf("Reduction operation roc_shmem_short_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_prod_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_short_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_prod_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[1] == 1)
|
||||
printf("Reduction operation roc_shmem_int_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_prod_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_int_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_prod_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[2] == 1)
|
||||
printf("Reduction operation roc_shmem_long_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_prod_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_long_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_prod_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[3] == 1)
|
||||
printf("Reduction operation roc_shmem_float_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_float_prod_to_all: Failed\n");
|
||||
else {
|
||||
if (float_rounding_err) {
|
||||
Vprintf(
|
||||
"Reduction operation roc_shmem_float_prod_to_all: skipped due to "
|
||||
"Reduction operation rocshmem_float_prod_to_all: skipped due to "
|
||||
"float rounding error\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_float_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_float_prod_to_all: Passed\n");
|
||||
}
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[4] == 1)
|
||||
printf("Reduction operation roc_shmem_double_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_double_prod_to_all: Failed\n");
|
||||
else {
|
||||
if (double_rounding_err) {
|
||||
Vprintf(
|
||||
"Reduction operation roc_shmem_double_prod_to_all: skipped due to "
|
||||
"Reduction operation rocshmem_double_prod_to_all: skipped due to "
|
||||
"double rounding error\n");
|
||||
} else {
|
||||
Vprintf("Reduction operation roc_shmem_double_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_double_prod_to_all: Passed\n");
|
||||
}
|
||||
pass++;
|
||||
}
|
||||
|
||||
/*
|
||||
if(ok[5]==1)
|
||||
printf("Reduction operation roc_shmem_longdouble_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longdouble_prod_to_all: Failed\n");
|
||||
else {
|
||||
if (double_rounding_err) {
|
||||
Vprintf("Reduction operation roc_shmem_longdouble_prod_to_all: skipped
|
||||
Vprintf("Reduction operation rocshmem_longdouble_prod_to_all: skipped
|
||||
due to long double rounding error\n");
|
||||
}
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_longdouble_prod_to_all:
|
||||
Vprintf("Reduction operation rocshmem_longdouble_prod_to_all:
|
||||
Passed\n");
|
||||
}
|
||||
pass++;
|
||||
@@ -611,14 +611,14 @@ int prod_to_all(int me, int npes) {
|
||||
pass++;
|
||||
|
||||
if (ok[6] == 1)
|
||||
printf("Reduction operation roc_shmem_longlong_prod_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_prod_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_prod_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_prod_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 7 ? 1 : 0);
|
||||
}
|
||||
@@ -636,15 +636,15 @@ int or_to_all(int me, int npes) {
|
||||
dst6[i] = -9;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_or_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_or_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_or_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
rocshmem_ctx_int_or_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_or_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0, npes,
|
||||
rocshmem_ctx_long_or_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0, npes,
|
||||
pWrk2, pSync);
|
||||
roc_shmem_ctx_longlong_or_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_or_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync1);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -658,35 +658,35 @@ int or_to_all(int me, int npes) {
|
||||
}
|
||||
|
||||
if (ok[0] == 1)
|
||||
printf("Reduction operation roc_shmem_short_or_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_or_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_short_or_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_or_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[1] == 1)
|
||||
printf("Reduction operation roc_shmem_int_or_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_or_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_int_or_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_or_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[2] == 1)
|
||||
printf("Reduction operation roc_shmem_long_or_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_or_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_long_or_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_or_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[6] == 1)
|
||||
printf("Reduction operation roc_shmem_longlong_or_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_or_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_or_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_or_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
Vprintf("\n");
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 4 ? 1 : 0);
|
||||
}
|
||||
@@ -705,15 +705,15 @@ int xor_to_all(int me, int npes) {
|
||||
dst6[i] = -9;
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
roc_shmem_ctx_short_xor_to_all(ROC_SHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
rocshmem_ctx_short_xor_to_all(ROCSHMEM_CTX_DEFAULT, dst0, src0, N, 0, 0,
|
||||
npes, pWrk0, pSync);
|
||||
roc_shmem_ctx_int_xor_to_all(ROC_SHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
rocshmem_ctx_int_xor_to_all(ROCSHMEM_CTX_DEFAULT, dst1, src1, N, 0, 0, npes,
|
||||
pWrk1, pSync1);
|
||||
roc_shmem_ctx_long_xor_to_all(ROC_SHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
rocshmem_ctx_long_xor_to_all(ROCSHMEM_CTX_DEFAULT, dst2, src2, N, 0, 0,
|
||||
npes, pWrk2, pSync);
|
||||
roc_shmem_ctx_longlong_xor_to_all(ROC_SHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
rocshmem_ctx_longlong_xor_to_all(ROCSHMEM_CTX_DEFAULT, dst6, src6, N, 0, 0,
|
||||
npes, pWrk6, pSync1);
|
||||
|
||||
if (me == 0) {
|
||||
@@ -725,36 +725,36 @@ int xor_to_all(int me, int npes) {
|
||||
}
|
||||
|
||||
if (ok[0] == 1)
|
||||
printf("Reduction operation roc_shmem_short_xor_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_short_xor_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_short_xor_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_short_xor_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[1] == 1)
|
||||
printf("Reduction operation roc_shmem_int_xor_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_int_xor_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_int_xor_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_int_xor_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[2] == 1)
|
||||
printf("Reduction operation roc_shmem_long_xor_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_long_xor_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_long_xor_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_long_xor_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
if (ok[6] == 1)
|
||||
printf("Reduction operation roc_shmem_longlong_xor_to_all: Failed\n");
|
||||
printf("Reduction operation rocshmem_longlong_xor_to_all: Failed\n");
|
||||
else {
|
||||
Vprintf("Reduction operation roc_shmem_longlong_xor_to_all: Passed\n");
|
||||
Vprintf("Reduction operation rocshmem_longlong_xor_to_all: Passed\n");
|
||||
pass++;
|
||||
}
|
||||
|
||||
Vprintf("\n");
|
||||
}
|
||||
if (Serialize) roc_shmem_barrier_all();
|
||||
if (Serialize) rocshmem_barrier_all();
|
||||
|
||||
return (pass == 4 ? 1 : 0);
|
||||
}
|
||||
@@ -763,9 +763,9 @@ int main(int argc, char *argv[]) {
|
||||
int c, i, mype, num_pes, tests, passed;
|
||||
char *pgm;
|
||||
|
||||
roc_shmem_init();
|
||||
mype = roc_shmem_my_pe();
|
||||
num_pes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
mype = rocshmem_my_pe();
|
||||
num_pes = rocshmem_n_pes();
|
||||
|
||||
if ((pgm = strrchr(argv[0], '/'))) {
|
||||
pgm++;
|
||||
@@ -802,58 +802,58 @@ int main(int argc, char *argv[]) {
|
||||
case 'h':
|
||||
default:
|
||||
Rfprintf(stderr, "usage: %s {-v(verbose)|h(help)}\n", pgm);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
tests = passed = 0;
|
||||
|
||||
pSync = (long *)roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
pSync1 = (long *)roc_shmem_malloc(ROC_SHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
pSync = (long *)rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
pSync1 = (long *)rocshmem_malloc(ROCSHMEM_BCAST_SYNC_SIZE * sizeof(long));
|
||||
if (!pSync || !pSync1) {
|
||||
fprintf(stderr, "ERR: cannot allocate one of the pSync arrays\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < ROC_SHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
pSync[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
pSync1[i] = ROC_SHMEM_SYNC_VALUE;
|
||||
for (i = 0; i < ROCSHMEM_REDUCE_SYNC_SIZE; i++) {
|
||||
pSync[i] = ROCSHMEM_SYNC_VALUE;
|
||||
pSync1[i] = ROCSHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
pWrk0 = (short *)roc_shmem_malloc(WRK_SIZE * sizeof(short));
|
||||
pWrk1 = (int *)roc_shmem_malloc(WRK_SIZE * sizeof(int));
|
||||
pWrk2 = (long *)roc_shmem_malloc(WRK_SIZE * sizeof(long));
|
||||
pWrk3 = (float *)roc_shmem_malloc(WRK_SIZE * sizeof(float));
|
||||
pWrk4 = (double *)roc_shmem_malloc(WRK_SIZE * sizeof(double));
|
||||
pWrk5 = (long double *)roc_shmem_malloc(WRK_SIZE * sizeof(long double));
|
||||
pWrk6 = (long long *)roc_shmem_malloc(WRK_SIZE * sizeof(long long));
|
||||
pWrk0 = (short *)rocshmem_malloc(WRK_SIZE * sizeof(short));
|
||||
pWrk1 = (int *)rocshmem_malloc(WRK_SIZE * sizeof(int));
|
||||
pWrk2 = (long *)rocshmem_malloc(WRK_SIZE * sizeof(long));
|
||||
pWrk3 = (float *)rocshmem_malloc(WRK_SIZE * sizeof(float));
|
||||
pWrk4 = (double *)rocshmem_malloc(WRK_SIZE * sizeof(double));
|
||||
pWrk5 = (long double *)rocshmem_malloc(WRK_SIZE * sizeof(long double));
|
||||
pWrk6 = (long long *)rocshmem_malloc(WRK_SIZE * sizeof(long long));
|
||||
if (!pWrk0 || !pWrk1 || !pWrk2 || !pWrk3 || !pWrk4 || !pWrk5 || !pWrk6) {
|
||||
fprintf(stderr, "ERR: cannot allocate one of the pWrk arrays\n");
|
||||
}
|
||||
|
||||
src0 = (short *)roc_shmem_malloc(N * sizeof(short));
|
||||
src1 = (int *)roc_shmem_malloc(N * sizeof(int));
|
||||
src2 = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
src3 = (float *)roc_shmem_malloc(N * sizeof(float));
|
||||
src4 = (double *)roc_shmem_malloc(N * sizeof(double));
|
||||
src5 = (long double *)roc_shmem_malloc(N * sizeof(long double));
|
||||
src6 = (long long *)roc_shmem_malloc(N * sizeof(long long));
|
||||
src0 = (short *)rocshmem_malloc(N * sizeof(short));
|
||||
src1 = (int *)rocshmem_malloc(N * sizeof(int));
|
||||
src2 = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
src3 = (float *)rocshmem_malloc(N * sizeof(float));
|
||||
src4 = (double *)rocshmem_malloc(N * sizeof(double));
|
||||
src5 = (long double *)rocshmem_malloc(N * sizeof(long double));
|
||||
src6 = (long long *)rocshmem_malloc(N * sizeof(long long));
|
||||
if (!src0 || !src1 || !src2 || !src3 || !src4 || !src5 || !src6) {
|
||||
fprintf(stderr, "ERR: cannot allocate one of the src arrays\n");
|
||||
}
|
||||
|
||||
dst0 = (short *)roc_shmem_malloc(N * sizeof(short));
|
||||
dst1 = (int *)roc_shmem_malloc(N * sizeof(int));
|
||||
dst2 = (long *)roc_shmem_malloc(N * sizeof(long));
|
||||
dst3 = (float *)roc_shmem_malloc(N * sizeof(float));
|
||||
dst4 = (double *)roc_shmem_malloc(N * sizeof(double));
|
||||
dst5 = (long double *)roc_shmem_malloc(N * sizeof(long double));
|
||||
dst6 = (long long *)roc_shmem_malloc(N * sizeof(long long));
|
||||
dst0 = (short *)rocshmem_malloc(N * sizeof(short));
|
||||
dst1 = (int *)rocshmem_malloc(N * sizeof(int));
|
||||
dst2 = (long *)rocshmem_malloc(N * sizeof(long));
|
||||
dst3 = (float *)rocshmem_malloc(N * sizeof(float));
|
||||
dst4 = (double *)rocshmem_malloc(N * sizeof(double));
|
||||
dst5 = (long double *)rocshmem_malloc(N * sizeof(long double));
|
||||
dst6 = (long long *)rocshmem_malloc(N * sizeof(long long));
|
||||
if (!dst0 || !dst1 || !dst2 || !dst3 || !dst4 || !dst5 || !dst6) {
|
||||
fprintf(stderr, "ERR: cannot allocate one of the dst arrays\n");
|
||||
}
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
passed += max_to_all(mype, num_pes);
|
||||
tests++;
|
||||
@@ -896,34 +896,34 @@ int main(int argc, char *argv[]) {
|
||||
c = (tests == passed ? 0 : 1);
|
||||
}
|
||||
|
||||
roc_shmem_free(pSync);
|
||||
roc_shmem_free(pSync1);
|
||||
rocshmem_free(pSync);
|
||||
rocshmem_free(pSync1);
|
||||
|
||||
roc_shmem_free(pWrk0);
|
||||
roc_shmem_free(pWrk1);
|
||||
roc_shmem_free(pWrk2);
|
||||
roc_shmem_free(pWrk3);
|
||||
roc_shmem_free(pWrk4);
|
||||
roc_shmem_free(pWrk5);
|
||||
roc_shmem_free(pWrk6);
|
||||
rocshmem_free(pWrk0);
|
||||
rocshmem_free(pWrk1);
|
||||
rocshmem_free(pWrk2);
|
||||
rocshmem_free(pWrk3);
|
||||
rocshmem_free(pWrk4);
|
||||
rocshmem_free(pWrk5);
|
||||
rocshmem_free(pWrk6);
|
||||
|
||||
roc_shmem_free(src0);
|
||||
roc_shmem_free(src1);
|
||||
roc_shmem_free(src2);
|
||||
roc_shmem_free(src3);
|
||||
roc_shmem_free(src4);
|
||||
roc_shmem_free(src5);
|
||||
roc_shmem_free(src6);
|
||||
rocshmem_free(src0);
|
||||
rocshmem_free(src1);
|
||||
rocshmem_free(src2);
|
||||
rocshmem_free(src3);
|
||||
rocshmem_free(src4);
|
||||
rocshmem_free(src5);
|
||||
rocshmem_free(src6);
|
||||
|
||||
roc_shmem_free(dst0);
|
||||
roc_shmem_free(dst1);
|
||||
roc_shmem_free(dst2);
|
||||
roc_shmem_free(dst3);
|
||||
roc_shmem_free(dst4);
|
||||
roc_shmem_free(dst5);
|
||||
roc_shmem_free(dst6);
|
||||
rocshmem_free(dst0);
|
||||
rocshmem_free(dst1);
|
||||
rocshmem_free(dst2);
|
||||
rocshmem_free(dst3);
|
||||
rocshmem_free(dst4);
|
||||
rocshmem_free(dst5);
|
||||
rocshmem_free(dst6);
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* exercise roc_shmem_short_wait() and roc_shmem_short_wait_until() functions.
|
||||
* exercise rocshmem_short_wait() and rocshmem_short_wait_until() functions.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -38,17 +38,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <roc_shmem/roc_shmem.hpp>
|
||||
#include <rocshmem/rocshmem.hpp>
|
||||
|
||||
using namespace rocshmem;
|
||||
|
||||
#define DataType long
|
||||
|
||||
#define SHM_PUT roc_shmem_long_put
|
||||
#define SHM_PUTP roc_shmem_long_p
|
||||
#define SHM_GETP roc_shmem_long_g
|
||||
#define SHM_PUT rocshmem_long_put
|
||||
#define SHM_PUTP rocshmem_long_p
|
||||
#define SHM_GETP rocshmem_long_g
|
||||
|
||||
#define SHM_WAITU roc_shmem_long_wait_until
|
||||
#define SHM_WAITU rocshmem_long_wait_until
|
||||
#define PF "%ld"
|
||||
|
||||
#define Vprintf \
|
||||
@@ -65,29 +65,29 @@ int main(int argc, char *argv[]) {
|
||||
Verbose++;
|
||||
}
|
||||
|
||||
roc_shmem_init();
|
||||
me = roc_shmem_my_pe();
|
||||
num_pes = roc_shmem_n_pes();
|
||||
rocshmem_init();
|
||||
me = rocshmem_my_pe();
|
||||
num_pes = rocshmem_n_pes();
|
||||
|
||||
if (num_pes == 1) {
|
||||
printf("%s: Requires number of PEs > 1\n", argv[0]);
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
target = (DataType *)roc_shmem_malloc(10 * sizeof(DataType));
|
||||
target = (DataType *)rocshmem_malloc(10 * sizeof(DataType));
|
||||
|
||||
pong = (DataType *)roc_shmem_malloc(sizeof(DataType));
|
||||
pong = (DataType *)rocshmem_malloc(sizeof(DataType));
|
||||
*pong = 666;
|
||||
|
||||
t2 = (DataType *)roc_shmem_malloc(10 * sizeof(DataType));
|
||||
t2 = (DataType *)rocshmem_malloc(10 * sizeof(DataType));
|
||||
if (!t2) {
|
||||
if (me == 0) printf("roc_shmem_malloc() failed?\n");
|
||||
roc_shmem_global_exit(1);
|
||||
if (me == 0) printf("rocshmem_malloc() failed?\n");
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
t2[9] = target[9] = 0xFF;
|
||||
|
||||
roc_shmem_barrier_all();
|
||||
rocshmem_barrier_all();
|
||||
|
||||
if (me == 0) {
|
||||
memset(target, 0, 10 * sizeof(DataType));
|
||||
@@ -96,17 +96,17 @@ int main(int argc, char *argv[]) {
|
||||
for (pe = 1; pe < num_pes; pe++) /* put 10 elements into target on PE 1 */
|
||||
SHM_PUT(target, source, 10, pe);
|
||||
|
||||
SHM_WAITU(pong, ROC_SHMEM_CMP_GT, 666);
|
||||
SHM_WAITU(pong, ROCSHMEM_CMP_GT, 666);
|
||||
Vprintf("PE[%d] pong now " PF "\n", me, *pong);
|
||||
|
||||
for (pe = 1; pe < num_pes; pe++) /* put 1 element into t2 on PE 1 */
|
||||
SHM_PUTP(&t2[9], 0xDD, pe);
|
||||
} else {
|
||||
/* wait for 10th element write of 'target' */
|
||||
SHM_WAITU(&target[9], ROC_SHMEM_CMP_NE, 0xFF);
|
||||
SHM_WAITU(&target[9], ROCSHMEM_CMP_NE, 0xFF);
|
||||
Vprintf("PE[%d] target[9] was 255 now " PF ", success.\n", me, target[9]);
|
||||
|
||||
SHM_WAITU(&target[9], ROC_SHMEM_CMP_EQ, 10);
|
||||
SHM_WAITU(&target[9], ROCSHMEM_CMP_EQ, 10);
|
||||
Vprintf("PE[%d] expected target[9] == 10 now " PF "\n", me, target[9]);
|
||||
|
||||
if (me == 1) {
|
||||
@@ -117,10 +117,10 @@ int main(int argc, char *argv[]) {
|
||||
SHM_PUTP(pong, 999, 0);
|
||||
}
|
||||
|
||||
SHM_WAITU(&t2[9], ROC_SHMEM_CMP_NE, 0xFF);
|
||||
SHM_WAITU(&t2[9], ROCSHMEM_CMP_NE, 0xFF);
|
||||
}
|
||||
|
||||
// roc_shmem_barrier_all(); /* sync sender and receiver */
|
||||
// rocshmem_barrier_all(); /* sync sender and receiver */
|
||||
|
||||
if (me != 0) {
|
||||
if (memcmp(source, target, sizeof(DataType) * 10) != 0) {
|
||||
@@ -130,13 +130,13 @@ int main(int argc, char *argv[]) {
|
||||
printf(PF "," PF " ", source[i], target[i]);
|
||||
}
|
||||
printf("\n");
|
||||
roc_shmem_global_exit(1);
|
||||
rocshmem_global_exit(1);
|
||||
}
|
||||
}
|
||||
roc_shmem_free(t2);
|
||||
rocshmem_free(t2);
|
||||
|
||||
if (Verbose) fprintf(stderr, "[%d] exit\n", roc_shmem_my_pe());
|
||||
if (Verbose) fprintf(stderr, "[%d] exit\n", rocshmem_my_pe());
|
||||
|
||||
roc_shmem_finalize();
|
||||
rocshmem_finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user