Use new naming scheme

This commit is contained in:
Brandon Potter
2024-11-25 14:12:15 -06:00
والد 308816bc5e
کامیت fd8dbc7fb6
179فایلهای تغییر یافته به همراه5250 افزوده شده و 5251 حذف شده
@@ -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;
}