int MPI_SOURCE;
int MPI_TAG;
int MPI_ERROR;
+ int count;
} MPI_Status;
#define MPI_STATUS_IGNORE NULL
XBT_PUBLIC(int) MPI_Comm_rank(MPI_Comm comm, int* rank);
XBT_PUBLIC(int) MPI_Comm_size(MPI_Comm comm, int* size);
XBT_PUBLIC(int) MPI_Get_processor_name(char *name, int *resultlen);
+XBT_PUBLIC(int) MPI_Get_count(MPI_Status* status, MPI_Datatype datatype, int* count);
XBT_PUBLIC(int) MPI_Comm_group(MPI_Comm comm, MPI_Group* group);
XBT_PUBLIC(int) MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int* result);
void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status);
int smpi_mpi_test(MPI_Request* request, MPI_Status* status);
int smpi_mpi_testany(int count, MPI_Request requests[], int* index, MPI_Status* status);
+int smpi_mpi_get_count(MPI_Status* status, MPI_Datatype datatype);
void smpi_mpi_wait(MPI_Request* request, MPI_Status* status);
int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status* status);
void smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[]);
}
}
+int smpi_mpi_get_count(MPI_Status* status, MPI_Datatype datatype) {
+ return status->count / smpi_datatype_size(datatype);
+}
+
static void finish_wait(MPI_Request* request, MPI_Status* status) {
if(status != MPI_STATUS_IGNORE) {
status->MPI_SOURCE = (*request)->src;
status->MPI_TAG = (*request)->tag;
status->MPI_ERROR = MPI_SUCCESS;
+ status->count = SIMIX_communication_get_dst_buf_size((*request)->pair);
}
print_request("finishing wait", *request);
if((*request)->complete == 1) {
}
-int MPI_Get_processor_name( char *name, int *resultlen ) {
+int MPI_Get_processor_name(char* name, int* resultlen) {
int retval = MPI_SUCCESS;
+
smpi_bench_end(-1, NULL);
strncpy( name , SIMIX_host_get_name(SIMIX_host_self()), MPI_MAX_PROCESSOR_NAME-1);
*resultlen= strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
return retval;
}
+int MPI_Get_count(MPI_Status* status, MPI_Datatype datatype, int* count) {
+ int retval = MPI_SUCCESS;
+ size_t size;
+
+ smpi_bench_end(-1, NULL);
+ if (status == NULL || count == NULL) {
+ retval = MPI_ERR_ARG;
+ } else if (datatype == MPI_DATATYPE_NULL) {
+ retval = MPI_ERR_TYPE;
+ } else {
+ size = smpi_datatype_size(datatype);
+ if (size == 0) {
+ *count = 0;
+ } else if (status->count % size != 0) {
+ retval = MPI_UNDEFINED;
+ } else {
+ *count = smpi_mpi_get_count(status, datatype);
+ }
+ }
+ smpi_bench_begin(-1, NULL);
+ return retval;
+}