From 37fc944b0119eb59151c02720cf99c8cc034a213 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 30 Sep 2005 23:12:23 +0000 Subject: [PATCH] Use the right number of segments per in-use flag when calculating offsets. This commit was SVN r7571. --- ompi/mca/coll/sm/coll_sm.h | 6 ++++++ ompi/mca/coll/sm/coll_sm_bcast.c | 16 ++++++++-------- ompi/mca/coll/sm/coll_sm_component.c | 2 ++ ompi/mca/coll/sm/coll_sm_reduce.c | 17 ++++++++--------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ompi/mca/coll/sm/coll_sm.h b/ompi/mca/coll/sm/coll_sm.h index 0bf22f8479..08b6b53bc0 100644 --- a/ompi/mca/coll/sm/coll_sm.h +++ b/ompi/mca/coll/sm/coll_sm.h @@ -158,6 +158,12 @@ extern "C" { /** Meta struct containing information about the bootstrap area */ mca_common_sm_mmap_t *sm_bootstrap_meta; + + /** How many fragment segments are protected by a single + in-use flags. This is solely so that we can only perform + the division once and then just use the value without + having to re-calculate. */ + int sm_segs_per_inuse_flag; }; /** * Convenience typedef diff --git a/ompi/mca/coll/sm/coll_sm_bcast.c b/ompi/mca/coll/sm/coll_sm_bcast.c index 7fe8c8e9df..8cb821926f 100644 --- a/ompi/mca/coll/sm/coll_sm_bcast.c +++ b/ompi/mca/coll/sm/coll_sm_bcast.c @@ -117,10 +117,10 @@ int mca_coll_sm_bcast_intra(void *buff, int count, /* Loop over all the segments in this set */ - segment_num = flag_num * - mca_coll_sm_component.sm_comm_num_in_use_flags; - max_segment_num = (flag_num + 1) * - mca_coll_sm_component.sm_comm_num_in_use_flags; + segment_num = + flag_num * mca_coll_sm_component.sm_segs_per_inuse_flag; + max_segment_num = + (flag_num + 1) * mca_coll_sm_component.sm_segs_per_inuse_flag; do { index = &(data->mcb_mpool_index[segment_num]); @@ -178,10 +178,10 @@ int mca_coll_sm_bcast_intra(void *buff, int count, /* Loop over all the segments in this set */ - segment_num = flag_num * - mca_coll_sm_component.sm_comm_num_in_use_flags; - max_segment_num = (flag_num + 1) * - mca_coll_sm_component.sm_comm_num_in_use_flags; + segment_num = + flag_num * mca_coll_sm_component.sm_segs_per_inuse_flag; + max_segment_num = + (flag_num + 1) * mca_coll_sm_component.sm_segs_per_inuse_flag; do { /* Pre-calculate some values */ diff --git a/ompi/mca/coll/sm/coll_sm_component.c b/ompi/mca/coll/sm/coll_sm_component.c index d4e2b88a63..dea0d8a004 100644 --- a/ompi/mca/coll/sm/coll_sm_component.c +++ b/ompi/mca/coll/sm/coll_sm_component.c @@ -210,6 +210,8 @@ static int sm_open(void) cs->sm_comm_num_segments += cs->sm_comm_num_in_use_flags - (cs->sm_comm_num_segments % cs->sm_comm_num_in_use_flags); } + cs->sm_segs_per_inuse_flag = + cs->sm_comm_num_segments / cs->sm_comm_num_in_use_flags; mca_base_param_reg_int(c, "tree_degree", "Degree of the tree for tree-based operations (must be => 1 and <= min(control_size, 255))", diff --git a/ompi/mca/coll/sm/coll_sm_reduce.c b/ompi/mca/coll/sm/coll_sm_reduce.c index 68bd9d757a..bd3e1f3488 100644 --- a/ompi/mca/coll/sm/coll_sm_reduce.c +++ b/ompi/mca/coll/sm/coll_sm_reduce.c @@ -265,12 +265,11 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, /* Loop over all the segments in this set */ - segment_num = flag_num * - mca_coll_sm_component.sm_comm_num_in_use_flags; - max_segment_num = (flag_num + 1) * - mca_coll_sm_component.sm_comm_num_in_use_flags; + segment_num = + flag_num * mca_coll_sm_component.sm_segs_per_inuse_flag; + max_segment_num = + (flag_num + 1) * mca_coll_sm_component.sm_segs_per_inuse_flag; reduce_target = (((char*) rbuf) + (frag_num * segment_ddt_bytes)); - do { /* Loop over the processes, receiving and reducing @@ -452,10 +451,10 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, /* Loop over all the segments in this set */ - segment_num = flag_num * - mca_coll_sm_component.sm_comm_num_in_use_flags; - max_segment_num = (flag_num + 1) * - mca_coll_sm_component.sm_comm_num_in_use_flags; + segment_num = + flag_num * mca_coll_sm_component.sm_segs_per_inuse_flag; + max_segment_num = + (flag_num + 1) * mca_coll_sm_component.sm_segs_per_inuse_flag; do { index = &(data->mcb_mpool_index[segment_num]);