Created
October 21, 2015 14:03
-
-
Save jsquyres/8db59c06933b0ead4921 to your computer and use it in GitHub Desktop.
Test program from Sebastian Rettenberger <rettenbs@in.tum.de>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mpi.h> | |
#include <unistd.h> | |
#include <iostream> | |
int main(int argc, char* argv[]) { | |
int provided; | |
MPI_Init(&argc, &argv); | |
int rank; | |
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | |
MPI_Win window; | |
int* data; | |
MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &data); | |
data[0] = 0; | |
MPI_Win_create(data, | |
sizeof(int), | |
sizeof(int), | |
MPI_INFO_NULL, | |
MPI_COMM_WORLD, &window); | |
int remoteRank = 0; | |
if (rank == 0) { | |
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, remoteRank, MPI_MODE_NOCHECK, window); | |
//MPI_Win_lock(MPI_LOCK_SHARED, 1, 0, window); | |
int mydata; | |
MPI_Get(&mydata, 1, MPI_INT, remoteRank, 0, 1, MPI_INT, window); | |
MPI_Win_unlock(remoteRank, window); | |
} | |
MPI_Win_free(&window); | |
MPI_Free_mem(data); | |
MPI_Finalize(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment