Merge branch PR #55 into naming_scheme

This commit is contained in:
avinashkethineedi
2024-12-04 21:46:38 +00:00
180 changed files with 4436 additions and 4437 deletions
+23 -23
View File
@@ -10,14 +10,14 @@ hipcc -fgpu-rdc --hip-link rocshmem_allreduce_test.o -o rocshmem_allreduce_test
$OPENMPI_UCX_INSTALL_DIR/lib/libmpi.so \
-L/opt/rocm/lib -lamdhip64 -lhsa-runtime64
ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_allreduce_test
ROCSHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_allreduce_test
*/
#include <iostream>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#define CHECK_HIP(condition) { \
hipError_t error = condition; \
@@ -30,21 +30,21 @@ ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_allreduce_test
using namespace rocshmem;
__global__ void allreduce_test(int *source, int *dest, size_t nelem,
roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
int64_t ctx_type = 0;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = roc_shmem_ctx_n_pes(ctx);
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = rocshmem_ctx_n_pes(ctx);
roc_shmem_ctx_int_sum_wg_reduce(ctx, team, dest, source, nelem);
rocshmem_ctx_int_sum_wg_reduce(ctx, team, dest, source, nelem);
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
__syncthreads();
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
static void init_sendbuf (int *source, int nelem, int my_pe)
@@ -82,23 +82,23 @@ int main (int argc, char **argv)
nelem = atoi(argv[1]);
}
int my_pe = roc_shmem_my_pe();
int npes = roc_shmem_n_pes();
int my_pe = rocshmem_my_pe();
int npes = rocshmem_n_pes();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = my_pe % ndevices;
CHECK_HIP(hipSetDevice(my_device));
roc_shmem_init();
rocshmem_init();
int *source = (int *)roc_shmem_malloc(nelem * sizeof(int));
int *dest = (int *)roc_shmem_malloc(nelem * sizeof(int));
int *source = (int *)rocshmem_malloc(nelem * sizeof(int));
int *dest = (int *)rocshmem_malloc(nelem * sizeof(int));
if (NULL == source || NULL == dest) {
std::cout << "Error allocating memory from symmetric heap" << std::endl;
std::cout << "source: " << source << ", dest: " << dest << ", size: "
<< sizeof(int) * nelem << std::endl;
roc_shmem_global_exit(1);
rocshmem_global_exit(1);
}
init_sendbuf(source, nelem, my_pe);
@@ -106,9 +106,9 @@ int main (int argc, char **argv)
dest[i] = -1;
}
roc_shmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
rocshmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
&team_reduce_world_dup);
CHECK_HIP(hipDeviceSynchronize());
@@ -121,9 +121,9 @@ int main (int argc, char **argv)
bool pass = check_recvbuf(dest, nelem, my_pe, npes);
printf("Test %s \t nelem %d %s\n", argv[0], nelem, pass ? "[PASS]" : "[FAIL]");
roc_shmem_free(source);
roc_shmem_free(dest);
rocshmem_free(source);
rocshmem_free(dest);
roc_shmem_finalize();
rocshmem_finalize();
return 0;
}
+24 -24
View File
@@ -10,14 +10,14 @@ hipcc -fgpu-rdc --hip-link rocshmem_alltoall_test.o -o rocshmem_alltoall_test \
$OPENMPI_UCX_INSTALL_DIR/lib/libmpi.so \
-L/opt/rocm/lib -lamdhip64 -lhsa-runtime64
ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_alltoall_test
ROCSHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_alltoall_test
*/
#include <iostream>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#define CHECK_HIP(condition) { \
hipError_t error = condition; \
@@ -30,21 +30,21 @@ ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_alltoall_test
using namespace rocshmem;
__global__ void alltoall_test(int *source, int *dest, size_t nelem,
roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
int64_t ctx_type = 0;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = roc_shmem_ctx_n_pes(ctx);
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = rocshmem_ctx_n_pes(ctx);
roc_shmem_ctx_int_wg_alltoall(ctx, team, dest, source, nelem);
rocshmem_ctx_int_wg_alltoall(ctx, team, dest, source, nelem);
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
__syncthreads();
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
static void init_sendbuf (int *source, int nelem, int my_pe, int npes)
@@ -87,23 +87,23 @@ int main (int argc, char **argv)
nelem = atoi(argv[1]);
}
int my_pe = roc_shmem_my_pe();
int npes = roc_shmem_n_pes();
int my_pe = rocshmem_my_pe();
int npes = rocshmem_n_pes();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = my_pe % ndevices;
CHECK_HIP(hipSetDevice(my_device));
roc_shmem_init();
rocshmem_init();
int *source = (int *)roc_shmem_malloc(nelem * npes * sizeof(int));
int *dest = (int *)roc_shmem_malloc(nelem * npes * sizeof(int));
int *source = (int *)rocshmem_malloc(nelem * npes * sizeof(int));
int *dest = (int *)rocshmem_malloc(nelem * npes * sizeof(int));
if (NULL == source || NULL == dest) {
std::cout << "Error allocating memory from symmetric heap" << std::endl;
std::cout << "source: " << source << ", dest: " << dest << ", size: "
<< sizeof(int) * nelem * npes << std::endl;
roc_shmem_global_exit(1);
rocshmem_global_exit(1);
}
init_sendbuf(source, nelem, my_pe, npes);
@@ -111,9 +111,9 @@ int main (int argc, char **argv)
dest[i] = -1;
}
roc_shmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
rocshmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
&team_reduce_world_dup);
CHECK_HIP(hipDeviceSynchronize());
@@ -126,10 +126,10 @@ int main (int argc, char **argv)
bool pass = check_recvbuf(dest, nelem, my_pe, npes);
printf("Test %s \t nelem %d %s\n", argv[0], nelem, pass ? "[PASS]" : "[FAIL]");
rocshmem_free(source);
rocshmem_free(dest);
roc_shmem_free(source);
roc_shmem_free(dest);
roc_shmem_finalize();
rocshmem_finalize();
return 0;
}
+24 -24
View File
@@ -10,14 +10,14 @@ hipcc -fgpu-rdc --hip-link rocshmem_broadcast_test.o -o rocshmem_broadcast_test
$OPENMPI_UCX_INSTALL_DIR/lib/libmpi.so \
-L/opt/rocm/lib -lamdhip64 -lhsa-runtime64
ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_broadcast_test
ROCSHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_broadcast_test
*/
#include <iostream>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#define CHECK_HIP(condition) { \
hipError_t error = condition; \
@@ -30,21 +30,21 @@ ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 8 ./rocshmem_broadcast_test
using namespace rocshmem;
__global__ void broadcast_test(int *source, int *dest, size_t nelem,
int root, roc_shmem_team_t team) {
__shared__ roc_shmem_ctx_t ctx;
int root, rocshmem_team_t team) {
__shared__ rocshmem_ctx_t ctx;
int64_t ctx_type = 0;
roc_shmem_wg_init();
roc_shmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = roc_shmem_ctx_n_pes(ctx);
rocshmem_wg_init();
rocshmem_wg_ctx_create(ctx_type, &ctx);
int num_pes = rocshmem_ctx_n_pes(ctx);
roc_shmem_ctx_int_wg_broadcast(ctx, team, dest, source, nelem, root);
rocshmem_ctx_int_wg_broadcast(ctx, team, dest, source, nelem, root);
roc_shmem_ctx_quiet(ctx);
rocshmem_ctx_quiet(ctx);
__syncthreads();
roc_shmem_wg_ctx_destroy(&ctx);
roc_shmem_wg_finalize();
rocshmem_wg_ctx_destroy(&ctx);
rocshmem_wg_finalize();
}
static void init_sendbuf(int *source, int nelem, int my_pe)
@@ -80,23 +80,23 @@ int main(int argc, char **argv)
nelem = atoi(argv[1]);
}
int my_pe = roc_shmem_my_pe();
int npes = roc_shmem_n_pes();
int my_pe = rocshmem_my_pe();
int npes = rocshmem_n_pes();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = my_pe % ndevices;
CHECK_HIP(hipSetDevice(my_device));
roc_shmem_init();
rocshmem_init();
int *source = (int *)roc_shmem_malloc(nelem * sizeof(int));
int *dest = (int *)roc_shmem_malloc(nelem * sizeof(int));
int *source = (int *)rocshmem_malloc(nelem * sizeof(int));
int *dest = (int *)rocshmem_malloc(nelem * sizeof(int));
if (NULL == source || NULL == dest) {
std::cout << "Error allocating memory from symmetric heap" << std::endl;
std::cout << "source: " << source << ", dest: " << dest << ", size: "
<< sizeof(int) * nelem << std::endl;
roc_shmem_global_exit(1);
rocshmem_global_exit(1);
}
init_sendbuf(source, nelem, my_pe);
@@ -105,9 +105,9 @@ int main(int argc, char **argv)
}
int root = 0;
roc_shmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROC_SHMEM_TEAM_INVALID;
roc_shmem_team_split_strided(ROC_SHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
rocshmem_team_t team_reduce_world_dup;
team_reduce_world_dup = ROCSHMEM_TEAM_INVALID;
rocshmem_team_split_strided(ROCSHMEM_TEAM_WORLD, 0, 1, npes, nullptr, 0,
&team_reduce_world_dup);
CHECK_HIP(hipDeviceSynchronize());
@@ -121,10 +121,10 @@ int main(int argc, char **argv)
bool pass = check_recvbuf(dest, nelem, my_pe, npes);
printf("Test %s \t nelem %d %s\n", argv[0], nelem, pass ? "[PASS]" : "[FAIL]");
}
rocshmem_free(source);
rocshmem_free(dest);
roc_shmem_free(source);
roc_shmem_free(dest);
roc_shmem_finalize();
rocshmem_finalize();
return 0;
}
+17 -17
View File
@@ -10,14 +10,14 @@ hipcc -fgpu-rdc --hip-link rocshmem_getmem_test.o -o rocshmem_getmem_test \
$OPENMPI_UCX_INSTALL_DIR/lib/libmpi.so \
-L/opt/rocm/lib -lamdhip64 -lhsa-runtime64
ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 2 ./rocshmem_getmem_test
ROCSHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 2 ./rocshmem_getmem_test
*/
#include <iostream>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#define CHECK_HIP(condition) { \
hipError_t error = condition; \
@@ -31,25 +31,25 @@ using namespace rocshmem;
__global__ void simple_getmem_test(int *src, int *dst, size_t nelem)
{
roc_shmem_wg_init();
rocshmem_wg_init();
int threadId = blockIdx.x * blockDim.x + threadIdx.x;
if (threadId == 0) {
int rank = roc_shmem_my_pe();
int rank = rocshmem_my_pe();
int peer = rank ? 0 : 1;
roc_shmem_getmem(dst, src, nelem * sizeof(int), peer);
roc_shmem_quiet();
rocshmem_getmem(dst, src, nelem * sizeof(int), peer);
rocshmem_quiet();
}
__syncthreads();
roc_shmem_wg_finalize();
rocshmem_wg_finalize();
}
#define MAX_ELEM 256
int main (int argc, char **argv)
{
int rank = roc_shmem_my_pe();
int rank = rocshmem_my_pe();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = rank % ndevices;
@@ -60,15 +60,15 @@ int main (int argc, char **argv)
nelem = atoi(argv[1]);
}
roc_shmem_init();
int npes = roc_shmem_n_pes();
int *src = (int *)roc_shmem_malloc(nelem * sizeof(int));
int *dst = (int *)roc_shmem_malloc(nelem * sizeof(int));
rocshmem_init();
int npes = rocshmem_n_pes();
int *src = (int *)rocshmem_malloc(nelem * sizeof(int));
int *dst = (int *)rocshmem_malloc(nelem * sizeof(int));
if (NULL == src || NULL == dst) {
std::cout << "Error allocating memory from symmetric heap" << std::endl;
std::cout << "source: " << src << ", dest: " << dst << ", size: "
<< sizeof(int) * nelem << std::endl;
roc_shmem_global_exit(1);
rocshmem_global_exit(1);
}
for (int i=0; i<nelem; i++) {
@@ -79,7 +79,7 @@ int main (int argc, char **argv)
int threadsPerBlock=256;
simple_getmem_test<<<dim3(1), dim3(threadsPerBlock), 0, 0>>>(src, dst, nelem);
roc_shmem_barrier_all();
rocshmem_barrier_all();
CHECK_HIP(hipDeviceSynchronize());
bool pass = true;
@@ -93,8 +93,8 @@ int main (int argc, char **argv)
}
printf("Test %s \t %s\n", argv[0], pass ? "[PASS]" : "[FAIL]");
roc_shmem_free(src);
roc_shmem_free(dst);
roc_shmem_finalize();
rocshmem_free(src);
rocshmem_free(dst);
rocshmem_finalize();
return 0;
}
+18 -18
View File
@@ -10,14 +10,14 @@ hipcc -fgpu-rdc --hip-link rocshmem_put_signal_test.o -o rocshmem_getmem_test \
$OPENMPI_UCX_INSTALL_DIR/lib/libmpi.so \
-L/opt/rocm/lib -lamdhip64 -lhsa-runtime64
ROC_SHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 2 ./rocshmem_put_signal_test
ROCSHMEM_MAX_NUM_CONTEXTS=2 mpirun -np 2 ./rocshmem_put_signal_test
*/
#include <iostream>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <roc_shmem/roc_shmem.hpp>
#include <rocshmem/rocshmem.hpp>
#define CHECK_HIP(condition) { \
hipError_t error = condition; \
@@ -32,29 +32,29 @@ using namespace rocshmem;
__global__ void simple_put_signal_test(uint64_t *data, uint64_t *message, size_t nelem,
uint64_t *sig_addr, int my_pe, int dst_pe)
{
roc_shmem_wg_init();
rocshmem_wg_init();
int threadId = blockIdx.x * blockDim.x + threadIdx.x;
if (threadId == 0) {
if (my_pe == 0) {
roc_shmem_ulong_put_signal(data, message, nelem, sig_addr, 1, ROC_SHMEM_SIGNAL_SET, dst_pe);
rocshmem_ulong_put_signal(data, message, nelem, sig_addr, 1, ROCSHMEM_SIGNAL_SET, dst_pe);
}
else {
roc_shmem_ulong_wait_until(sig_addr, ROC_SHMEM_CMP_EQ, 1);
roc_shmem_ulong_put_signal(data, data, nelem, sig_addr, 1, ROC_SHMEM_SIGNAL_SET, dst_pe);
rocshmem_ulong_wait_until(sig_addr, ROCSHMEM_CMP_EQ, 1);
rocshmem_ulong_put_signal(data, data, nelem, sig_addr, 1, ROCSHMEM_SIGNAL_SET, dst_pe);
}
}
__syncthreads();
roc_shmem_wg_finalize();
rocshmem_wg_finalize();
}
#define MAX_ELEM 256
int main (int argc, char **argv)
{
int rank = roc_shmem_my_pe();
int rank = rocshmem_my_pe();
int ndevices, my_device = 0;
CHECK_HIP(hipGetDeviceCount(&ndevices));
my_device = rank % ndevices;
@@ -65,12 +65,12 @@ int main (int argc, char **argv)
nelem = atoi(argv[1]);
}
roc_shmem_init();
int npes = roc_shmem_n_pes();
rocshmem_init();
int npes = rocshmem_n_pes();
int dst_pe = (rank + 1) % npes;
uint64_t *message = (uint64_t*)roc_shmem_malloc(nelem * sizeof(uint64_t));
uint64_t *data = (uint64_t*)roc_shmem_malloc(nelem * sizeof(uint64_t));
uint64_t *sig_addr = (uint64_t*)roc_shmem_malloc(sizeof(uint64_t));
uint64_t *message = (uint64_t*)rocshmem_malloc(nelem * sizeof(uint64_t));
uint64_t *data = (uint64_t*)rocshmem_malloc(nelem * sizeof(uint64_t));
uint64_t *sig_addr = (uint64_t*)rocshmem_malloc(sizeof(uint64_t));
if (NULL == data || NULL == message || NULL == sig_addr) {
std::cout << "Error allocating memory from symmetric heap" << std::endl;
std::cout << "data: " << data
@@ -78,7 +78,7 @@ int main (int argc, char **argv)
<< ", size: " << sizeof(uint64_t) * nelem
<< ", sig_addr: " << sig_addr
<< std::endl;
roc_shmem_global_exit(1);
rocshmem_global_exit(1);
}
for (int i=0; i<nelem; i++) {
@@ -90,7 +90,7 @@ int main (int argc, char **argv)
int threadsPerBlock=256;
simple_put_signal_test<<<dim3(1), dim3(threadsPerBlock), 0, 0>>>(data, message, nelem, sig_addr, rank, dst_pe);
roc_shmem_barrier_all();
rocshmem_barrier_all();
CHECK_HIP(hipDeviceSynchronize());
bool pass = true;
@@ -104,8 +104,8 @@ int main (int argc, char **argv)
}
printf("[%d] Test %s \t %s\n", rank, argv[0], pass ? "[PASS]" : "[FAIL]");
roc_shmem_free(data);
roc_shmem_free(message);
roc_shmem_finalize();
rocshmem_free(data);
rocshmem_free(message);
rocshmem_finalize();
return 0;
}