@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user