/* Same behavior as PMPI_Irsend.c */ int PMPI_Issend (void* message, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) { int size, retval, index; char* p; _MPI_COVERAGE(); _MPI_CHECK_STATUS(&comm); retval = _MPI_checkRequest(*request); if ( retval!=MPI_SUCCESS ) { _MPI_Set_Request(request, message, count, datatype, _MPI_TRUE, tag, comm); } retval = _MPI_checks(message, count, datatype, dest, tag, comm); if (retval == MPI_SUCCESS) { index = _MPI_Req_Find(tag, comm); if ( index >= 0 ) { size = _MPI_calculateSize(count, datatype); p = (char *)_MPI_safeMalloc(size, "Error with malloc for send buffer."); p = memcpy(p, message, size); retval =_MPI_Buff_Insert(p, count, datatype, tag, comm); return retval; } return MPI_ERR_PENDING; } else { _MPI_ERR_ROUTINE (retval, "MPI_ISSEND / MPI_IRSEND: argument error"); MPI_Abort (comm, retval); } _MPI_COVERAGE(); return retval; }
/*==========================================================================*/ int PMPI_Scatter (void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) { int sendsize, recvsize, retval; _MPI_COVERAGE(); _MPI_CHECK_STATUS(&comm); retval = _MPI_checks(sendbuf, sendcnt, sendtype, _MPI_RANK, MPI_ANY_TAG, comm); if (retval != MPI_SUCCESS) return retval; retval = _MPI_checks(recvbuf,recvcnt,recvtype, _MPI_RANK, MPI_ANY_TAG, comm); if (retval == MPI_SUCCESS) { recvsize = _MPI_calculateSize(recvcnt, recvtype); sendsize = _MPI_calculateSize(sendcnt, sendtype); if (recvsize < sendsize) /*MESSAGE IS TRUNCATED*/ { recvbuf = memcpy(recvbuf, sendbuf, recvsize); printf("MPI_RECV : Message truncated.\n"); MPI_Abort(comm, MPI_ERR_COUNT); return MPI_ERR_COUNT; } else { recvbuf = memcpy(recvbuf, sendbuf, sendsize); } } _MPI_COVERAGE(); return _MPI_NOT_OK; }
/*=============================================================================================*/ int PMPI_Msend (void* message, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { int size, retval; char* p; /* option 1: Assert( _MPI_IS_INITIALIZED() ); */ _MPI_COVERAGE(); _MPI_CHECK_STATUS(&comm); retval = _MPI_checks(message, count, datatype, dest, tag, comm); /* option 2: STANDARD_MPI_CHECK(comm); */ if (retval == MPI_SUCCESS) { size = _MPI_calculateSize(count, datatype); p = (char *)_MPI_safeMalloc(size, "Error with malloc for send buffer."); p = memcpy(p, message, size); retval =_MPI_Buff_Insert(p, count, datatype, tag, comm); return retval; } else { _MPI_ERR_ROUTINE (retval, "MPI_SEND / MPI_ISEND: argument error"); MPI_Abort (comm, retval); } _MPI_COVERAGE(); return _MPI_NOT_OK; }
/*==========================================================================*/ int _MPI_Free_datatype (MPI_Datatype datatype) { int index; _MPI_TYPE_DES* child; _MPI_COVERAGE(); index = _MPI_FindType(datatype); if (index == _MPI_NOT_OK) { _MPI_COVERAGE(); return _MPI_NOT_OK; } #ifdef KDD_REMOVED_DEBUG printf("%s:%d: BOGUS value??? %d %d 0x%x\n",__FILE__,__LINE__,datatype, index, (int)_MPI_TYPE_LIST[index].next); #endif child = _MPI_TYPE_LIST[index].next; if ( child ) _MPI_deleteAll(child); _MPI_safeFree(_MPI_TYPE_LIST[index].info,"type info"); /* _MPI_safeFree(_MPI_TYPE_LIST[index].next,"type next"); */ _MPI_TYPE_LIST[index].id = _MPI_NOT_VALID; _MPI_TYPE_LIST[index].info = 0; _MPI_TYPE_LIST[index].next = 0; return MPI_SUCCESS; }
/*============================================================================*/ int _MPI_Req_Null (MPI_Request request) { _MPI_COVERAGE(); if(request == MPI_REQUEST_NULL) { _MPI_COVERAGE(); return _MPI_TRUE; } _MPI_COVERAGE(); return _MPI_FALSE; }
/*==========================================================================*/ void _MPI_deleteAll (_MPI_TYPE_DES* parent) { _MPI_COVERAGE(); if (parent->next != NULL) { _MPI_COVERAGE(); _MPI_deleteAll (parent->next); parent->next = 0; } _MPI_safeFree (parent,"Parent"); }
/*============================================================================*/ int _MPI_Req_Equal (MPI_Request request1, MPI_Request request2) { _MPI_COVERAGE(); if ( (request1->tag == request2->tag) && (request1->comm == request2->comm) ) { _MPI_COVERAGE(); return _MPI_TRUE; } _MPI_COVERAGE(); return _MPI_FALSE; }
/*==========================================================================*/ int _MPI_BasicType (MPI_Datatype datatype) { _MPI_COVERAGE(); if ( (datatype >= _MPI_TYPE_START)&&(datatype <= _MPI_TYPE_END) ) { _MPI_COVERAGE(); return MPI_SUCCESS; } return _MPI_FALSE; }
/*==========================================================================*/ int _MPI_checkSendType (MPI_Datatype type) { int index; _MPI_COVERAGE(); index = _MPI_FindType(type); if (index == _MPI_NOT_OK) { _MPI_COVERAGE(); return _MPI_DEFAULT; } return _MPI_TYPE_LIST[index].sendType; }
/* STUB */ int PMPI_Comm_dup ( MPI_Comm comm, MPI_Comm *comm_out ) { _MPI_COVERAGE(); if ( comm == MPI_COMM_NULL ) { _MPI_COVERAGE(); if ( comm_out ) *comm_out = MPI_COMM_NULL; return MPI_SUCCESS; } return PMPI_Comm_create(comm,_MPI_COMM_WORLD_GROUP,comm_out); }
/*==========================================================================*/ int _MPI_Find_free (void) { int i; _MPI_COVERAGE(); for (i=0; i<_MPI_TYPE_COUNT; i++) { _MPI_COVERAGE(); if (_MPI_TYPE_LIST[i].id == _MPI_NOT_VALID) return i; } _MPI_TYPE_LIST = (_MPI_TYPE_DES*) _MPI_safeRealloc(_MPI_TYPE_LIST, (_MPI_TYPE_ARRAY_SIZE+PREALLOCATION_SIZE)*sizeof(_MPI_TYPE_DES), "Error in _MPI_Find_free for reallocation"); return _MPI_TYPE_COUNT; }
/*==========================================================================*/ int _MPI_FindType (MPI_Datatype datatype) { int index; _MPI_COVERAGE(); for (index = 0; index < _MPI_TYPE_COUNT; index++) { _MPI_COVERAGE(); if (_MPI_TYPE_LIST[index].id == datatype) { _MPI_COVERAGE(); return index; } } return _MPI_NOT_OK; }
/*============================================================================*/ int _MPI_Check_Request_Array(int count, MPI_Request array[]) { int index; _MPI_COVERAGE(); for(index = 0; index<count; index++) { _MPI_COVERAGE(); if(_MPI_Req_Null((MPI_Request) &array[index])==_MPI_FALSE) { _MPI_COVERAGE(); return MPI_SUCCESS; } } _MPI_COVERAGE(); return _MPI_NOT_OK; }
/*============================================================================*/ int _MPI_Req_Exists(MPI_Request request) { int i; _MPI_COVERAGE(); for (i=0; i<_MPI_REQ_COUNT; i++) { _MPI_COVERAGE(); if (_MPI_Req_Equal((MPI_Request) &_MPI_REQ_LIST[i], request)==_MPI_TRUE) { _MPI_COVERAGE(); return i; } } _MPI_COVERAGE(); return _MPI_FALSE; }
int MPI_Errhandler_create( MPI_Handler_function *function, MPI_Errhandler *errhandler) { _MPI_COVERAGE(); return PMPI_Errhandler_create (function, errhandler); }
/* STUB */ int PMPI_Cart_create ( MPI_Comm comm_old, int ndims, int *dims, int *periods, int reorder, MPI_Comm *comm_cart ) { _MPI_COVERAGE(); fprintf(stderr,"%s:%d: NOT IMPLEMENTED\n",__FILE__,__LINE__); return MPI_Abort((MPI_Comm)NULL, MPI_UNDEFINED); }
/* STUB */ int PMPI_Bsend_init( void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request ) { _MPI_COVERAGE(); fprintf(stderr,"%s:%d: NOT IMPLEMENTED\n",__FILE__,__LINE__); return MPI_Abort((MPI_Comm)NULL, MPI_UNDEFINED); }
/* STUB */ int MPI_Allgather ( void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm ) { _MPI_COVERAGE(); return PMPI_Allgather (sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm); }
/* STUB */ int MPI_Comm_dup ( MPI_Comm comm, MPI_Comm *comm_out ) { _MPI_COVERAGE(); return PMPI_Comm_dup (comm, comm_out); }
int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { _MPI_COVERAGE(); return PMPI_File_write_at_all (fh, offset, buf, count, datatype, status); }
/* STUB */ int MPI_File_iwrite_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPIO_Request *request) { _MPI_COVERAGE(); return PMPI_File_iwrite_at(fh, offset, buf, count, datatype, request); }
/* STUB */ int MPI_Cart_rank ( MPI_Comm comm, int *coords, int *rank ) { _MPI_COVERAGE(); return PMPI_Cart_rank(comm, coords, rank); }
int PMPI_Comm_compare ( MPI_Comm comm1, MPI_Comm comm2, int *result) { int index1, index2; /* treat an index as the MPI communicator "context" */ MPI_Group group1, group2; int gcmp; _MPI_COVERAGE(); *result = MPI_UNEQUAL; if (_MPI_CHECK_STATUS(&comm1) == _MPI_OK && _MPI_CHECK_STATUS(&comm2) == _MPI_OK) { _MPI_COVERAGE(); if (_MPI_Comm_check_legal(comm1, &index1)==MPI_SUCCESS && _MPI_Comm_check_legal(comm2, &index2)==MPI_SUCCESS) { _MPI_COVERAGE(); if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) return MPI_ERR_COMM; if ( index1 == index2 ) { _MPI_COVERAGE(); *result = MPI_IDENT; } else { _MPI_COVERAGE(); group1 = _MPI_COMM_LIST[index1].group; group2 = _MPI_COMM_LIST[index2].group; if ( PMPI_Group_compare( group1, group2, &gcmp ) != MPI_SUCCESS ) return MPI_ERR_GROUP; if ( gcmp == MPI_IDENT ) *result = MPI_CONGRUENT; if ( gcmp == MPI_SIMILAR ) *result = MPI_SIMILAR; } return MPI_SUCCESS; } } return MPI_ERR_COMM; }
/* STUB */ int MPI_Comm_compare ( MPI_Comm comm1, MPI_Comm comm2, int *result) { _MPI_COVERAGE(); return PMPI_Comm_compare (comm1, comm2, result); }
/*==========================================================================*/ int MPI_Sendrecv( void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status ) { _MPI_COVERAGE(); return PMPI_Sendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, status); }
/* STUB */ int MPI_Dims_create( int nnodes, int ndims, int *dims) { _MPI_COVERAGE(); return PMPI_Dims_create ( nnodes, ndims, dims); }
int MPI_Testany( int count, MPI_Request array_of_requests[], int *index, int *flag, MPI_Status *status ) { _MPI_COVERAGE(); return PMPI_Testany (count, array_of_requests, index, flag, status); }
/* STUB */ int PMPI_Cart_rank ( MPI_Comm comm, int *coords, int *rank ) { _MPI_COVERAGE(); fprintf(stderr,"%s:%d: NOT IMPLEMENTED\n",__FILE__,__LINE__); return MPI_Abort((MPI_Comm)NULL, MPI_UNDEFINED); }
int MPI_Keyval_create ( MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state ) { _MPI_COVERAGE(); return PMPI_Keyval_create (copy_fn, delete_fn, keyval, extra_state); }
/* STUB */ int PMPI_Comm_compare ( MPI_Comm comm1, MPI_Comm comm2, int *result) { _MPI_COVERAGE(); fprintf(stderr,"%s:%d: NOT IMPLEMENTED\n",__FILE__,__LINE__); return MPI_Abort((MPI_Comm)NULL, MPI_UNDEFINED); }