Skip to content

Commit

Permalink
Merge pull request #3 from wokuno/pr/update_example14_15
Browse files Browse the repository at this point in the history
Updated example 14 to remove `shmem_long_sum_to_all`
  • Loading branch information
wokuno authored Sep 3, 2024
2 parents 016f06d + 8d87f9d commit a03071b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions example_code/shmem_ctx.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include <shmem.h>
#include <stdio.h>

long pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE];
long psync[SHMEM_REDUCE_SYNC_SIZE];

long task_cntr = 0; /* Next task counter */
long tasks_done = 0; /* Tasks done by this PE */
long total_done = 0; /* Total tasks done by all PEs */
Expand All @@ -12,9 +9,6 @@ int main(void) {
int tl, i;
long ntasks = 1024; /* Total tasks per PE */

for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++)
psync[i] = SHMEM_SYNC_VALUE;

shmem_init_thread(SHMEM_THREAD_MULTIPLE, &tl);
if (tl != SHMEM_THREAD_MULTIPLE)
shmem_global_exit(1);
Expand Down Expand Up @@ -49,7 +43,7 @@ int main(void) {
shmem_ctx_destroy(ctx);
}

shmem_long_sum_to_all(&total_done, &tasks_done, 1, 0, 0, npes, pwrk, psync);
shmem_long_sum_reduce(SHMEM_TEAM_WORLD, &total_done, &tasks_done, 1);

int result = (total_done != ntasks * npes);
shmem_finalize();
Expand Down

0 comments on commit a03071b

Please sign in to comment.