oshmem: updated API oshmem examples to OSHMEM 1.3
This commit is contained in:
parent
2a9f818d24
commit
e894a89db8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -11,17 +11,15 @@
|
||||
#include <stdio.h>
|
||||
#include <shmem.h>
|
||||
|
||||
#warning This application uses deprecated API see http://www.open-mpi.org/
|
||||
|
||||
int main (void)
|
||||
{
|
||||
static int aaa, bbb;
|
||||
int num_pes, my_pe, peer;
|
||||
|
||||
start_pes(0);
|
||||
shmem_init();
|
||||
|
||||
num_pes = _num_pes();
|
||||
my_pe = _my_pe();
|
||||
num_pes = shmem_n_pes();
|
||||
my_pe = shmem_my_pe();
|
||||
|
||||
peer = (my_pe + 1) % num_pes;
|
||||
|
||||
@ -30,6 +28,7 @@ int main (void)
|
||||
|
||||
shmem_barrier_all();
|
||||
printf("Process %d exiting\n", my_pe);
|
||||
shmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -15,8 +15,6 @@
|
||||
|
||||
#include <shmem.h>
|
||||
|
||||
#warning This application uses deprecated API see http://www.open-mpi.org/
|
||||
|
||||
long pSync[_SHMEM_BCAST_SYNC_SIZE];
|
||||
|
||||
#define N 3
|
||||
@ -34,10 +32,10 @@ int main(void)
|
||||
pSync[i] = _SHMEM_SYNC_VALUE;
|
||||
}
|
||||
|
||||
start_pes(0);
|
||||
shmem_init();
|
||||
|
||||
my_pe = _my_pe();
|
||||
num_pes = _num_pes();
|
||||
my_pe = shmem_my_pe();
|
||||
num_pes = shmem_n_pes();
|
||||
|
||||
for (i = 0; i < N; i += 1) {
|
||||
src[i] = my_pe + i;
|
||||
@ -54,6 +52,7 @@ int main(void)
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
shmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -15,16 +15,16 @@
|
||||
|
||||
#include <shmem.h>
|
||||
|
||||
#warning This application uses deprecated API see http://www.open-mpi.org/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
long *x;
|
||||
|
||||
start_pes(0);
|
||||
shmem_init();
|
||||
|
||||
x = (long *) shmalloc(sizeof(*x));
|
||||
x = (long *) shmem_malloc(sizeof(*x));
|
||||
|
||||
shfree(x);
|
||||
shmem_free(x);
|
||||
|
||||
shmem_finalize();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -27,16 +27,14 @@
|
||||
#include <stdio.h>
|
||||
#include <shmem.h>
|
||||
|
||||
#warning This application uses deprecated API see http://www.open-mpi.org/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
short source[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
static short target[10];
|
||||
int me;
|
||||
|
||||
start_pes(0);
|
||||
me = _my_pe();
|
||||
shmem_init();
|
||||
me = shmem_my_pe();
|
||||
|
||||
if (me == 0) {
|
||||
/* put 10 words into target on PE 1 */
|
||||
@ -51,6 +49,7 @@ int main(void)
|
||||
target[3], target[4] );
|
||||
}
|
||||
shmem_barrier_all(); /* sync before exiting */
|
||||
shmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -11,8 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <shmem.h>
|
||||
|
||||
#warning This application uses deprecated API see http://www.open-mpi.org/
|
||||
|
||||
#define SIZE 16
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -22,10 +20,10 @@ int main(int argc, char* argv[])
|
||||
int i;
|
||||
int num_pe, my_pe;
|
||||
|
||||
start_pes(0);
|
||||
shmem_init();
|
||||
|
||||
num_pe = _num_pes();
|
||||
my_pe = _my_pe();
|
||||
num_pe = shmem_n_pes();
|
||||
my_pe = shmem_my_pe();
|
||||
|
||||
if (my_pe == 0) {
|
||||
/* initialize array */
|
||||
@ -52,6 +50,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
shmem_barrier_all(); /* sync before exiting */
|
||||
shmem_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user