Skip to content

v2.x: updated API oshmem examples to OSHMEM 1.3 #2243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions examples/oshmem_circular_shift.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -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;

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

shmem_barrier_all();
printf("Process %d exiting\n", my_pe);
shmem_finalize();

return 0;
}
Expand Down
11 changes: 5 additions & 6 deletions examples/oshmem_max_reduction.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -54,6 +52,7 @@ int main(void)
}

printf("\n");
shmem_finalize();

return 0;
}
Expand Down
12 changes: 6 additions & 6 deletions examples/oshmem_shmalloc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -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 *) shmem_malloc(sizeof(*x));

x = (long *) shmalloc(sizeof(*x));
shmem_free(x);

shfree(x);
shmem_finalize();
}

9 changes: 4 additions & 5 deletions examples/oshmem_strided_puts.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -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 */
Expand All @@ -51,6 +49,7 @@ int main(void)
target[3], target[4] );
}
shmem_barrier_all(); /* sync before exiting */
shmem_finalize();

return 0;
}
11 changes: 5 additions & 6 deletions examples/oshmem_symmetric_data.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* Copyright (c) 2014-2016 Mellanox Technologies, Inc.
* All rights reserved.
* $COPYRIGHT$
*
Expand All @@ -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[])
Expand All @@ -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 */
Expand All @@ -52,6 +50,7 @@ int main(int argc, char* argv[])
}

shmem_barrier_all(); /* sync before exiting */
shmem_finalize();

return 0;
}