Exemple #1
0
int MPI_Pack_size(int incount, MPI_Datatype type, MPI_Comm comm, int *size)
{
  CkDDT_DataType *ddt = getAmpiInstance(comm)->getDDT()->getType(type);
  int typesize = ddt->getSize();
  *size = incount * typesize;
  return MPI_SUCCESS;
}
CDECL
int AMPI_Win_get_name(MPI_Win win, char *name, int *length) {
    AMPIAPI("AMPI_Win_get_name");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    ptr->winGetName(winStruct, name, length);
    return MPI_SUCCESS;
}
CDECL
int AMPI_Win_get_group(MPI_Win win, MPI_Group *group) {
    AMPIAPI("AMPI_Win_get_group");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    ptr->winGetGroup(winStruct, group);
    return MPI_SUCCESS;
}
CDECL
int AMPI_Iget_free(MPI_Request *request, MPI_Status *status, MPI_Win win) {
    AMPIAPI("AMPI_Iget_free");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    // winGet is a local function which will call the remote method on #rank processor
    return  ptr->winIgetFree(request, status);
}
CDECL
int AMPI_Win_start(MPI_Group group, int assertion, MPI_Win win) {
    AMPIAPI("AMPI_Win_start");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    //  ptr->winStart(group, winStruct);
    return MPI_SUCCESS;
}
/*
 * ---Note : No atomicity for overlapping Puts.
 * ---sync calls should be made on this window to ensure the
 * ---correctness of the operation
 */
CDECL
int AMPI_Put(void *orgaddr, int orgcnt, MPI_Datatype orgtype, int rank,
             MPI_Aint targdisp, int targcnt, MPI_Datatype targtype, MPI_Win win) {
    AMPIAPI("AMPI_Put");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    return ptr->winPut(orgaddr, orgcnt, orgtype, rank, targdisp, targcnt, targtype, winStruct);
}
/*
 * ---Note : No atomicity for overlapping Gets.
 * ---sync calls should be made on this window to ensure the
 * ---correctness of the operation
 */
CDECL
int AMPI_Get(void *orgaddr, int orgcnt, MPI_Datatype orgtype, int rank,
             MPI_Aint targdisp, int targcnt, MPI_Datatype targtype, MPI_Win win) {
    AMPIAPI("AMPI_Get");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);
    // winGet is a local function which will call the remote method on #rank processor
    return  ptr->winGet(orgaddr, orgcnt, orgtype, rank, targdisp, targcnt, targtype, winStruct);
}
// The RMA call is completed both locally and remotely after unlock.
// process assertion here: HOW???
int AMPI_Win_unlock(int rank, MPI_Win win) {
    AMPIAPI("AMPI_Win_unlock");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);

    // process assertion here: HOW???
    // end of assertion
    ptr->winUnlock(rank, winStruct);
    return MPI_SUCCESS;
}
/*
 * int AMPI_Win_lock(int lock_type, int rank, int assertion, MPI_Win win)
 *   Locks access to this MPI_Win object.
 *   Input:
 *     int lock_type : MPI_LOCK_EXCLUSIVE or MPI_LOCK_SHARED
 *     int rank : rank of locked window
 *     int assertion : program assertion, used to provide optimization hints
 *   Returns int : MPI_SUCCESS or MPI_ERR_WIN
 */
CDECL
int AMPI_Win_lock(int lock_type, int rank, int assertion, MPI_Win win) {
    AMPIAPI("AMPI_Win_lock");
    WinStruct winStruct = getAmpiParent()->getWinStruct(win);
    ampi *ptr = getAmpiInstance(winStruct.comm);

    // process assertion here:
    // end of assertion
    ptr->winLock(lock_type, rank, winStruct);
    return MPI_SUCCESS;
}
Exemple #10
0
/*
 * 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;
}
Exemple #11
0
// 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;
}
Exemple #12
0
// 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;
}
Exemple #13
0
inline void MPID_Datatype_get_extent_macro(MPI_Datatype &type, MPI_Aint &extent){
  CkDDT_DataType *ddt = getAmpiInstance(MPI_COMM_WORLD)->getDDT()->getType(type);
  extent = ddt->getExtent();
}
Exemple #14
0
inline void MPID_Datatype_get_size_macro(MPI_Datatype &type, MPI_Aint &size){
  CkDDT_DataType *ddt = getAmpiInstance(MPI_COMM_WORLD)->getDDT()->getType(type);
  size = ddt->getSize();
}