1
1

next step: a first version of how a non-segmented hierarchical bcast might look like with the current data structures

This commit was SVN r4531.
Этот коммит содержится в:
Edgar Gabriel 2005-02-24 20:05:12 +00:00
родитель 140f937880
Коммит dbedfcda69
3 изменённых файлов: 54 добавлений и 10 удалений

Просмотреть файл

@ -201,6 +201,7 @@ mca_coll_hierarch_module_init(struct ompi_communicator_t *comm)
if ( NULL == data->hier_reqs ) {
goto exit;
}
data->hier_am_lleader=0; /* false */
/* determine how many local leader there are and who they are */
colorarr = (int *) comm->c_coll_selected_data;
@ -228,8 +229,10 @@ mca_coll_hierarch_module_init(struct ompi_communicator_t *comm)
data->hier_my_lleader = c;
}
c++;
if ( llr[c] == rank ) {
data->hier_am_lleader = 1;
}
}
}
data->hier_num_lleaders = c-1;
@ -365,9 +368,6 @@ mca_coll_hierarch_checkfor_component ( struct ompi_communicator_t *comm,
}
}
/* Here we might introduce later on an allreduce step to determine,
whether we agree on the result or not */
*ncount = counter; /* true */
/* Print the final result */
if ( counter == 1 ) {

Просмотреть файл

@ -44,6 +44,7 @@ extern int mca_coll_hierarch_verbose;
int hier_num_lleaders; /* number of local leaders */
int *hier_lleaders; /* list of local leaders */
int hier_my_lleader; /* pos. of my lleader in hier_lleaders */
int hier_am_lleader; /* am I an lleader? */
int hier_num_reqs; /* num. of requests */
ompi_request_t **hier_reqs; /* list of requests */
};

Просмотреть файл

@ -20,6 +20,7 @@
#include "util/output.h"
#include "mca/coll/coll.h"
#include "mca/coll/base/base.h"
#include "mca/coll/base/coll_tags.h"
#include "coll_hierarch.h"
@ -31,10 +32,52 @@
* Returns: - MPI_SUCCESS or error code
*/
int mca_coll_hierarch_bcast_intra(void *buff, int count,
struct ompi_datatype_t *datatype, int root,
struct ompi_communicator_t *comm)
struct ompi_datatype_t *datatype, int root,
struct ompi_communicator_t *comm)
{
ompi_output_verbose(10, mca_coll_base_output, "In hierarch bcast_intra");
return comm->c_coll_basic_module->coll_bcast(buff, count, datatype,
root, comm);
}
struct mca_coll_base_comm_t *data=NULL;
struct ompi_communicator_t *llcomm=NULL;
int i, rank, ret;
rank = ompi_comm_rank ( comm );
data = comm->c_coll_selected_data;
llcomm = data->hier_llcomm;
/* trivial linear distribution of the data to all local leaders.
need something significantly better */
if ( rank == root ) {
for (i=0; i< data->hier_num_lleaders; i++) {
if ( data->hier_lleaders[i] == data->hier_my_lleader ) {
data->hier_reqs[i] = MPI_REQUEST_NULL;
continue;
}
ret = mca_pml.pml_isend (buff, count, datatype, data->hier_lleaders[i],
MCA_COLL_BASE_TAG_BCAST,
MCA_PML_BASE_SEND_STANDARD,
comm, &(data->hier_reqs[i]));
if ( OMPI_SUCCESS != ret ) {
return ret;
}
}
ret = ompi_request_wait_all ( data->hier_num_lleaders, data->hier_reqs,
MPI_STATUSES_IGNORE);
if ( OMPI_SUCCESS != ret ) {
return ret;
}
}
else if ( data->hier_am_lleader ) {
ret = mca_pml.pml_recv ( buff, count, datatype, root,
MCA_COLL_BASE_TAG_BCAST, comm,
MPI_STATUS_IGNORE );
if ( OMPI_SUCCESS != ret ) {
return ret;
}
}
if ( MPI_COMM_NULL != llcomm ) {
ret = llcomm->c_coll.coll_bcast(buff, count, datatype,
data->hier_my_lleader, llcomm );
}
return ret;
}