diff --git a/maestro/cdo.c b/maestro/cdo.c index 449551aa83394f9724f52828f8ef6d2d675cfa8d..969aaadea291a9988b40c79b1106db09955690d3 100644 --- a/maestro/cdo.c +++ b/maestro/cdo.c @@ -2630,6 +2630,21 @@ mstro_cdo__mark_transfer_complete(mstro_cdo cdo) } + int64_t n_pieces; + + /* reduce the number of outstanding segments by 1 as we received one part*/ + n_pieces = atomic_fetch_sub(&cdo->n_segments, 1); + + assert(n_pieces > 0); /* there is some outstanding communication */ + n_pieces--; /* decrement n_pieces to reflect cdo->n_segments after fetch and sub operation */ + + if (n_pieces != 0) + { + DEBUG("There are %zu outstanding pieces for CDO %zu \n", n_pieces, cdo->id.local_id); + return MSTRO_OK; + } + + /* clear in-transport flag */ s = s & ~(MSTRO_CDO_STATE_IN_TRANSPORT); switch(s) { diff --git a/maestro/pool_manager_registry.c b/maestro/pool_manager_registry.c index 8f0d33dca7af27c8fd45cb5fdbef30ef220ca06f..6f1eb45f87ef7a30ec3fd5ec9c4673c4857dea8a 100644 --- a/maestro/pool_manager_registry.c +++ b/maestro/pool_manager_registry.c @@ -875,50 +875,6 @@ mstro_pm__mmbLayoutIntersecton_to_candidates( return status; } -/** If a CDO has is_distributed flag set at the mstro_pm_cdo_registry_entry but - * the cdo handle does not has a distribution defined, - * - * we cook up a default distributed for it, which consists of one piece holding - * all the cdo data */ -mstro_status -mstro_pm_cdo_create_default_dist_layout(mmbLayout *src_layout, mmbLayout **default_layout){ - mstro_status status = MSTRO_OK; - - - /*FIXME only support irregular 1D layouts */ - if ((src_layout->type != MMB_IRREGULAR) || (src_layout->n_dims != 1)) { - ERR("FIXME only support now 1D irregular layouts \n"); - return MSTRO_UNIMPL; - } - - size_t *offsets, *sizes; - offsets = (size_t *) malloc(sizeof(size_t) * 1); - sizes = (size_t *) malloc(sizeof(size_t) * 1); - - if ((!offsets) || (!sizes) ) { - ERR("Can not allocate memory for default layout offsets and sizes \n"); - return MSTRO_NOMEM; - } - - offsets[0] = 0; // data starts from the begining - /* get cdo size */ - sizes[0] = 0; // cdo size - for (size_t i = 0; i < src_layout->irregular.n_blocks.d[0]; i++) { - sizes[0] += src_layout->irregular.lengths[i]; // cdo size - } - - - mmbError stat = MMB_OK; - stat = mmb_layout_create_dist_irregular_1d(src_layout->element.size_bytes, - 0, /*index = 0*/ - 1, /* nblocks = 1*/ - offsets, - sizes, - default_layout); - - return (stat == MMB_OK) ? MSTRO_OK : MSTRO_FAIL; -} - static inline mstro_status mstro_pm__find_cdo_with_layout( @@ -1743,26 +1699,6 @@ mstro_pm_cdo_registry_find(mstro_app_id app, const struct mstro_cdo_id *id) return MSTRO_FAIL; } -mstro_status -mstro_pm_cdo_registry_attributes_to_dist_layout(Mstro__Pool__Attributes *attributes, mmbLayout **dist_layout) -{ - mstro_status status = MSTRO_OK; - size_t n = attributes->kv_map->n_map; - - DEBUG("looking for distributed layout among %d attributes \n", n); - const char *key; - for(size_t i=0; i<n; i++) { - key = attributes->kv_map->map[i]->key; - if(strcmp(key,".maestro.core.cdo.dist-layout")==0) { - DEBUG("DIST Layout found ... \n\n\n"); - status = mstro_attribute_pool_aval_to_mmbLayout(attributes->kv_map->map[i]->val->mmblayout, dist_layout); - break; - } - } - - return status; -} - mstro_status mstro_pm_cdo_registry_store_attributes(const struct mstro_cdo_id *cdo_id, mstro_app_id app_id,