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_testall(int count, MPI_Request requests[],
+ MPI_Status status[]);
void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
MPI_Request smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
MPI_Status* status);
return flag;
}
+
+int smpi_mpi_testall(int count, MPI_Request requests[],
+ MPI_Status status[])
+{
+ xbt_dynar_t comms;
+ int i, flag, size;
+ int* map;
+
+ flag = 0;
+ if(count > 0) {
+ comms = xbt_dynar_new(sizeof(smx_action_t), NULL);
+ map = xbt_new(int, count);
+ size = 0;
+ for(i = 0; i < count; i++) {
+ if(requests[i]->action) {
+ xbt_dynar_push(comms, &requests[i]->action);
+ map[size] = i;
+ size++;
+ }
+ }
+
+ int n_finished=0;
+ while(n_finished<size) {
+ i = simcall_comm_testany(comms);
+ if(i != MPI_UNDEFINED) {
+ smpi_mpi_wait(&requests[i], &status[i]);
+ }
+ n_finished++;
+ XBT_DEBUG("TestAll, n finished %d on %d to test", n_finished, size);
+ }
+ flag = 1;
+ xbt_free(map);
+ xbt_dynar_free(&comms);
+ }
+ return flag;
+}
+
void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status){
int flag=0;
//FIXME find another wait to avoid busy waiting ?
return retval;
}
+int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses)
+{
+ int retval;
+ smpi_bench_end();
+ if (flag == NULL) {
+ retval = MPI_ERR_ARG;
+ } else {
+ *flag = smpi_mpi_testall(count, requests, statuses);
+ retval = MPI_SUCCESS;
+ }
+ smpi_bench_begin();
+ return retval;
+}
int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
int retval;
return not_yet_implemented();
}
-int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses) {
- return not_yet_implemented();
-}
-
int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) {
return not_yet_implemented();
}