[ROCm/rocshmem commit: fd8dbc7fb6]
Этот коммит содержится в:
Brandon Potter
2024-11-25 14:12:15 -06:00
родитель 07088f0f2b
Коммит 913ce47ef1
179 изменённых файлов: 5250 добавлений и 5251 удалений
+14 -14
Просмотреть файл
@@ -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;
}