Skip to content

Commit e894a89

Browse files
committed
oshmem: updated API oshmem examples to OSHMEM 1.3
1 parent 2a9f818 commit e894a89

5 files changed

+25
-29
lines changed

examples/oshmem_circular_shift.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014 Mellanox Technologies, Inc.
2+
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -11,17 +11,15 @@
1111
#include <stdio.h>
1212
#include <shmem.h>
1313

14-
#warning This application uses deprecated API see http://www.open-mpi.org/
15-
1614
int main (void)
1715
{
1816
static int aaa, bbb;
1917
int num_pes, my_pe, peer;
2018

21-
start_pes(0);
19+
shmem_init();
2220

23-
num_pes = _num_pes();
24-
my_pe = _my_pe();
21+
num_pes = shmem_n_pes();
22+
my_pe = shmem_my_pe();
2523

2624
peer = (my_pe + 1) % num_pes;
2725

@@ -30,6 +28,7 @@ int main (void)
3028

3129
shmem_barrier_all();
3230
printf("Process %d exiting\n", my_pe);
31+
shmem_finalize();
3332

3433
return 0;
3534
}

examples/oshmem_max_reduction.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014 Mellanox Technologies, Inc.
2+
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -15,8 +15,6 @@
1515

1616
#include <shmem.h>
1717

18-
#warning This application uses deprecated API see http://www.open-mpi.org/
19-
2018
long pSync[_SHMEM_BCAST_SYNC_SIZE];
2119

2220
#define N 3
@@ -34,10 +32,10 @@ int main(void)
3432
pSync[i] = _SHMEM_SYNC_VALUE;
3533
}
3634

37-
start_pes(0);
35+
shmem_init();
3836

39-
my_pe = _my_pe();
40-
num_pes = _num_pes();
37+
my_pe = shmem_my_pe();
38+
num_pes = shmem_n_pes();
4139

4240
for (i = 0; i < N; i += 1) {
4341
src[i] = my_pe + i;
@@ -54,6 +52,7 @@ int main(void)
5452
}
5553

5654
printf("\n");
55+
shmem_finalize();
5756

5857
return 0;
5958
}

examples/oshmem_shmalloc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014 Mellanox Technologies, Inc.
2+
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -15,16 +15,16 @@
1515

1616
#include <shmem.h>
1717

18-
#warning This application uses deprecated API see http://www.open-mpi.org/
19-
2018
int main(void)
2119
{
2220
long *x;
2321

24-
start_pes(0);
22+
shmem_init();
23+
24+
x = (long *) shmem_malloc(sizeof(*x));
2525

26-
x = (long *) shmalloc(sizeof(*x));
26+
shmem_free(x);
2727

28-
shfree(x);
28+
shmem_finalize();
2929
}
3030

examples/oshmem_strided_puts.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014 Mellanox Technologies, Inc.
2+
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -27,16 +27,14 @@
2727
#include <stdio.h>
2828
#include <shmem.h>
2929

30-
#warning This application uses deprecated API see http://www.open-mpi.org/
31-
3230
int main(void)
3331
{
3432
short source[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
3533
static short target[10];
3634
int me;
3735

38-
start_pes(0);
39-
me = _my_pe();
36+
shmem_init();
37+
me = shmem_my_pe();
4038

4139
if (me == 0) {
4240
/* put 10 words into target on PE 1 */
@@ -51,6 +49,7 @@ int main(void)
5149
target[3], target[4] );
5250
}
5351
shmem_barrier_all(); /* sync before exiting */
52+
shmem_finalize();
5453

5554
return 0;
5655
}

examples/oshmem_symmetric_data.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014 Mellanox Technologies, Inc.
2+
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
33
* All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -11,8 +11,6 @@
1111
#include <stdio.h>
1212
#include <shmem.h>
1313

14-
#warning This application uses deprecated API see http://www.open-mpi.org/
15-
1614
#define SIZE 16
1715

1816
int main(int argc, char* argv[])
@@ -22,10 +20,10 @@ int main(int argc, char* argv[])
2220
int i;
2321
int num_pe, my_pe;
2422

25-
start_pes(0);
23+
shmem_init();
2624

27-
num_pe = _num_pes();
28-
my_pe = _my_pe();
25+
num_pe = shmem_n_pes();
26+
my_pe = shmem_my_pe();
2927

3028
if (my_pe == 0) {
3129
/* initialize array */
@@ -52,6 +50,7 @@ int main(int argc, char* argv[])
5250
}
5351

5452
shmem_barrier_all(); /* sync before exiting */
53+
shmem_finalize();
5554

5655
return 0;
5756
}

0 commit comments

Comments
 (0)