/* * int AMPI_Win_fence(int assertion, MPI_Win win) * Synchronizes all one-sided communication calls on this MPI_Win. * (Synchronized RMA operations on the specified window) * * Inputs: * int assertion : program assertion, used to provide optimization hints * Returns int : MPI_SUCCESS or MPI_ERR_WIN */ CDECL int AMPI_Win_fence(int assertion, MPI_Win win) { AMPIAPI("AMPI_Win_fence"); WinStruct winStruct = getAmpiParent()->getWinStruct(win); MPI_Comm comm = winStruct.comm; ampi *ptr = getAmpiInstance(comm); // Wait until everyone reaches the fence AMPI_Barrier(comm); // Complete all outstanding one-sided comm requests // no need to do this for the pseudo-implementation return MPI_SUCCESS; }
// A collective call over all processes in the communicator // MPI_Win object created LOCALLY on all processes when the call returns CDECL int AMPI_Win_create(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *newwin) { AMPIAPI("AMPI_Win_create"); ampi *ptr = getAmpiInstance(comm); *newwin = ptr->createWinInstance(base, size, disp_unit, info); /* set the builtin attributes on the window */ AMPI_Win_set_attr(*newwin, MPI_WIN_BASE, &base); AMPI_Win_set_attr(*newwin, MPI_WIN_SIZE, &size); AMPI_Win_set_attr(*newwin, MPI_WIN_DISP_UNIT, &disp_unit); /* need to reduction here: to make sure every processor participates */ AMPI_Barrier(comm); return MPI_SUCCESS; }
// A collective call over all processes in the communicator // MPI_Win object deleted LOCALLY on all processes when the call returns CDECL int AMPI_Win_free(MPI_Win *win) { AMPIAPI("AMPI_Win_free"); if(win==NULL) { return MPI_ERR_WIN; } WinStruct winStruct = getAmpiParent()->getWinStruct(*win); ampi *ptr = getAmpiInstance(winStruct.comm); ptr->deleteWinInstance(*win); /* Need a barrier here: to ensure that every process participates */ AMPI_Barrier(winStruct.comm); return MPI_SUCCESS; }
void mpi_barrier(int *comm, int *ierr) { *ierr = AMPI_Barrier(*comm); }