diff --git a/src/mca/pml/pml.h b/src/mca/pml/pml.h index 2be661cd4f..d59c2a4c72 100644 --- a/src/mca/pml/pml.h +++ b/src/mca/pml/pml.h @@ -81,7 +81,7 @@ typedef int (*mca_pml_base_progress_fn_t)(void); typedef int (*mca_pml_base_irecv_init_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int src, int tag, @@ -91,7 +91,7 @@ typedef int (*mca_pml_base_irecv_init_fn_t)( typedef int (*mca_pml_base_irecv_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int src, int tag, @@ -101,7 +101,7 @@ typedef int (*mca_pml_base_irecv_fn_t)( typedef int (*mca_pml_base_recv_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int src, int tag, @@ -111,7 +111,7 @@ typedef int (*mca_pml_base_recv_fn_t)( typedef int (*mca_pml_base_isend_init_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int dst, int tag, @@ -122,7 +122,7 @@ typedef int (*mca_pml_base_isend_init_fn_t)( typedef int (*mca_pml_base_isend_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int dst, int tag, @@ -133,7 +133,7 @@ typedef int (*mca_pml_base_isend_fn_t)( typedef int (*mca_pml_base_send_fn_t)( void *buf, - size_t size, + size_t count, struct lam_datatype_t *datatype, int dst, int tag, @@ -159,7 +159,7 @@ typedef int (*mca_pml_base_wait_fn_t)( ); typedef int (*mca_pml_base_wait_all_fn_t)( - int count, /* size of request/status arrays */ + int count, /* count of request/status arrays */ lam_request_t** request, /* array of requests */ lam_status_public_t *status /* array of statuses */ ); diff --git a/src/mca/pml/teg/src/pml_teg.h b/src/mca/pml/teg/src/pml_teg.h index 5798ebe9d9..ab0709a9eb 100644 --- a/src/mca/pml/teg/src/pml_teg.h +++ b/src/mca/pml/teg/src/pml_teg.h @@ -33,8 +33,8 @@ struct mca_pml_teg_t { mca_ptl_t** teg_ptls; size_t teg_num_ptls; - lam_list_t teg_procs; - lam_mutex_t teg_lock; + lam_list_t teg_procs; + lam_mutex_t teg_lock; int teg_free_list_num; /* initial size of free list */ int teg_free_list_max; /* maximum size of free list */ diff --git a/src/mca/pml/teg/src/pml_teg_wait.c b/src/mca/pml/teg/src/pml_teg_wait.c index e75d699a3e..3c50fa4b5a 100644 --- a/src/mca/pml/teg/src/pml_teg_wait.c +++ b/src/mca/pml/teg/src/pml_teg_wait.c @@ -10,35 +10,51 @@ int mca_pml_teg_wait( int *index, lam_status_public_t* status) { -#if 0 - mca_pml_base_request_t* pml_request = *(mca_pml_base_request_t**)request; - if(pml_request->req_mpi_done == false) { + int c, i; + int completed = -1; + mca_pml_base_request_t* pml_request; - /* poll for completion - primarily for benchmarks */ - int i; - for(i=0; ireq_mpi_done == false; i++) - ; /* do nothing */ - - /* if not complete - sleep on condition variable until a request completes */ - if(pml_request->req_mpi_done == false) { - lam_mutex_lock(&mca_pml_teg.teg_request_lock); - mca_pml_teg.teg_request_waiting++; - while(pml_request->req_mpi_done == false) - lam_condition_wait(&mca_pml_teg.teg_request_cond, &mca_pml_teg.teg_request_lock); - mca_pml_teg.teg_request_waiting--; - lam_mutex_unlock(&mca_pml_teg.teg_request_lock); + /* poll for completion */ + for(c=0; completed < 0 && c < mca_pml_teg.teg_poll_iterations; c++) { + for(i=0; ireq_mpi_done == true) { + completed = i; + break; + } } } + if(completed < 0) { + /* give up and sleep until completion */ + lam_mutex_lock(&mca_pml_teg.teg_request_lock); + mca_pml_teg.teg_request_waiting++; + while(completed < 0) { + for(i=0; ireq_mpi_done == true) { + completed = i; + break; + } + lam_condition_wait(&mca_pml_teg.teg_request_cond, &mca_pml_teg.teg_request_lock); + } + } + mca_pml_teg.teg_request_waiting--; + lam_mutex_unlock(&mca_pml_teg.teg_request_lock); + } + /* return request to pool */ if(pml_request->req_persistent == false) { mca_pml_teg_free(request); } - if (status != NULL) { *status = pml_request->req_status; } -#endif + if (index != NULL) { + *index = completed; + } return LAM_SUCCESS; } diff --git a/src/mpi/c/isend.c b/src/mpi/c/isend.c index 0901bb293f..858242e85b 100644 --- a/src/mpi/c/isend.c +++ b/src/mpi/c/isend.c @@ -20,7 +20,7 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, if (dest == MPI_PROC_NULL) { return MPI_SUCCESS; } - + if ( MPI_PARAM_CHECK ) { int rc = MPI_SUCCESS; if (lam_mpi_finalized) { @@ -44,7 +44,7 @@ int MPI_Isend(void *buf, int count, MPI_Datatype type, int dest, return rc; } } - + return mca_pml.pml_isend(buf,count,type,dest,tag,MCA_PML_BASE_SEND_STANDARD,comm,request); }