Pushing c_cube_dim to communicator since it is used by more than one type
This commit was SVN r1068.
Этот коммит содержится в:
родитель
2b0cd649b7
Коммит
a8d9e4ac7d
@ -24,6 +24,12 @@ extern lam_class_t lam_communicator_t_class;
|
||||
#define LAM_COMM_NAMEISSET 0x00000008
|
||||
#define LAM_COMM_ISFREED 0x00000010
|
||||
|
||||
/* some utility #defines */
|
||||
#define LAM_COMM_IS_INTER(comm) ((comm)->c_flags & LAM_COMM_INTER)
|
||||
#define LAM_COMM_IS_INTRA(comm) (!((comm)->c_flags & LAM_COMM_INTER))
|
||||
#define LAM_COMM_IS_CART(comm) ((comm)->c_flags & LAM_COMM_CART)
|
||||
#define LAM_COMM_IS_GRAPH(comm) ((comm)->c_flags & LAM_COMM_GRAPH)
|
||||
|
||||
/* modes reqquired for accquiring the new comm-id */
|
||||
#define LAM_COMM_INTRA_INTRA 0x00000020
|
||||
#define LAM_COMM_INTRA_INTER 0x00000040
|
||||
@ -44,6 +50,8 @@ struct lam_communicator_t {
|
||||
/* Attributes */
|
||||
lam_hash_table_t *c_keyhash;
|
||||
|
||||
int c_cube_dim; /**< inscribing cube dimension */
|
||||
|
||||
/* Hooks for topo module to hang things */
|
||||
mca_topo_1_0_0_t c_topo; /**< structure of function pointers */
|
||||
mca_topo_comm_t *c_topo_comm; /**<structure containing information
|
||||
@ -132,6 +140,15 @@ static inline bool lam_comm_peer_invalid(lam_communicator_t* comm, int peer_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int lam_cube_dim(int nprocs) {
|
||||
int dim;
|
||||
size_t size;
|
||||
|
||||
if (1 > nprocs) return LAM_ERROR;
|
||||
for(dim = 0, size = 1; size < nprocs; ++dim, size <<= 1);
|
||||
|
||||
return dim;
|
||||
}
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
|
@ -79,6 +79,7 @@ int lam_comm_init(void)
|
||||
lam_mpi_comm_world.c_my_rank = group->grp_my_rank;
|
||||
lam_mpi_comm_world.c_local_group = group;
|
||||
lam_mpi_comm_world.c_remote_group = group;
|
||||
lam_mpi_comm_world.c_cube_dim = lam_cube_dim(size);
|
||||
mca_pml.pml_add_comm(&lam_mpi_comm_world);
|
||||
lam_pointer_array_set_item(&lam_mpi_communicators, 0, &lam_mpi_comm_world);
|
||||
|
||||
@ -134,8 +135,13 @@ lam_communicator_t *lam_comm_allocate ( int local_size, int remote_size )
|
||||
new_comm->c_remote_group = new_comm->c_local_group;
|
||||
}
|
||||
}
|
||||
/* fill in the inscribing hyper-cube dimensions */
|
||||
new_comm->c_cube_dim = lam_cube_dim(local_size);
|
||||
if (LAM_ERROR == new_comm->c_cube_dim) {
|
||||
OBJ_RELEASE(new_comm);
|
||||
new_comm = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return new_comm;
|
||||
}
|
||||
|
||||
@ -409,6 +415,7 @@ static void lam_comm_construct(lam_communicator_t* comm)
|
||||
comm->c_contextid = 0;
|
||||
comm->c_flags = 0;
|
||||
comm->c_my_rank = 0;
|
||||
comm->c_cube_dim = 0;
|
||||
comm->c_local_group = NULL;
|
||||
comm->c_remote_group = NULL;
|
||||
comm->error_handler = NULL;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user