forked from jeffhammond/foMPI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc_test.c
49 lines (34 loc) · 1.09 KB
/
c_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2012 The Trustees of University of Illinois. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "fompi.h"
int main( int argc, char *argv[] ) {
foMPI_Win win;
int status;
uint64_t* base;
uint64_t result;
int commsize;
int commrank;
int ranges[1][3];
MPI_Group group, newgroup;
foMPI_Init( &argc, &argv );
foMPI_Win_allocate( 2*sizeof(uint64_t), sizeof(uint64_t), MPI_INFO_NULL, MPI_COMM_WORLD, &base, &win);
MPI_Comm_size( MPI_COMM_WORLD, &commsize );
MPI_Comm_rank( MPI_COMM_WORLD, &commrank );
foMPI_Request req;
int tag =0;
foMPI_Notify_init(win, foMPI_ANY_SOURCE, tag, commsize - 1, &req);
foMPI_Win_fence( MPI_INFO_NULL, win );
if(commrank!=0){
foMPI_Put_notify(base,0,MPI_DOUBLE, 0, 0 ,0, MPI_DOUBLE, win, tag);
} else {
foMPI_Start(&req);
foMPI_Wait(&req, MPI_STATUS_IGNORE);
}
if ( commrank == 0 ) {
printf("Motification Received. Thank you for using foMPI-NA.\n");
}
foMPI_Win_free( &win );
foMPI_Finalize();
return 0;
}