- // FIXME: we should implement smpi_wait_all for a more asynchronous behavior
- for (i=0; i<comm->size; i++) {
- if ( rank != i ) { // except for me
- smpi_mpi_wait(tabrequest[i], MPI_STATUS_IGNORE);
-
- // FIXME: the core part is here. To be written ...
-
- fprintf(stderr,"[smpi] %s:%d : MPI_Reduce *Not yet implemented*.\n",__FILE__,__LINE__);
- }
+ for (i=0; i<comm->size-1; i++) {
+ int index = MPI_UNDEFINED;
+ smpi_mpi_waitany(comm->size-1, tabrequest, &index, MPI_STATUS_IGNORE);
+
+ print_buffer_int( recvbuf, count, "rcvbuf");
+ printf("MPI_Waitany() unblocked: root received (completes req[%d]): ",index);
+ print_buffer_int( tmprecvbuf, count, "tmprecvbuf");
+
+ // arg 2 is modified
+ op->func (tmprecvbuf,recvbuf,&count,&datatype);
+ print_buffer_int( recvbuf, count, "recvbuf after func");
+ //fprintf(stderr,"[smpi] %s:%d : MPI_Reduce *Not yet implemented*.\n",__FILE__,__LINE__);
+ xbt_mallocator_release(smpi_global->request_mallocator, tabrequest[i]);