Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BBT#442] Trimming and broadcast #355

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3c92ede
create bcast key task class
yu-pei Sep 23, 2021
ef3117f
setting release dep func for BCAST KEY class
yu-pei Sep 25, 2021
3f7320f
added a sleep to have a temp solution for the last data flush iterate…
yu-pei Sep 27, 2021
db21cda
add in populate remote dep and check successors code for chain topology
yu-pei Sep 27, 2021
5345981
handle calling iterate successor from get datatype
yu-pei Sep 28, 2021
95c9066
node in the chain continue propagation; TODO: data, remote dep ref co…
yu-pei Sep 28, 2021
0492882
add in some tile clean up on root node from data flush
yu-pei Sep 29, 2021
bcf2c35
fixes tile accounting on nodes in the chain; TODO: clearn up of non p…
yu-pei Sep 30, 2021
1b7534e
not involved nodes calling TILE_OF will insert tile into hash table
yu-pei Sep 30, 2021
de4f299
some code clean up
yu-pei Oct 1, 2021
3b2fd37
BCAST DATA task class piggyback to the normal workflow
yu-pei Oct 3, 2021
0728ed3
clean up and add previous potrf test case
yu-pei Oct 5, 2021
ed5a53a
key array propagate will need root rank info as part of key as well
yu-pei Oct 9, 2021
5ad52fe
fix issue of pending_ack for created remote_deps
yu-pei Oct 13, 2021
4396353
fix issue in get successor rank; TODO: data copy and remote deps recycle
yu-pei Oct 21, 2021
af22ab6
window size limits the key bcast in current scheme; incresing as temp…
yu-pei Oct 23, 2021
c11afe1
allocating more bits for ranks
Oct 26, 2021
8bec4b0
hash table to store key arrays, still overfill task window
yu-pei Nov 3, 2021
a0d16b6
WIP: removing receiver task for key array, reduce tasks
yu-pei Nov 4, 2021
f873ec7
use correct key to retrieve saved deps
yu-pei Nov 11, 2021
31445b0
remove prints
yu-pei Nov 12, 2021
c46a57d
clean up the not needed bcast release deps func
yu-pei Nov 23, 2021
c736fea
move broadcast code into own file
yu-pei Nov 23, 2021
3d8e030
move the bcast key/data task body to dtd_broadcast file
yu-pei Nov 23, 2021
d3625dd
move the bcast keys tile to be DTD internal
yu-pei Dec 6, 2021
464c721
switch to reuse PTG implementation
yu-pei Jan 24, 2022
d56c3b9
linking bcast meta data to propagate bcast data with global ID
yu-pei Jan 31, 2022
b1b6ce2
fix remote dep refcount issue
yu-pei Feb 7, 2022
1b222f0
minor update to test case
yu-pei Feb 7, 2022
92c2d35
changes to allow QR to work
yu-pei Feb 28, 2022
1ce2dbe
increase nb pending task of task pool for a remote dep, similar to PT…
yu-pei Mar 3, 2022
6dc8829
cache multiple bcast keys for binomial in the locals
yu-pei Mar 7, 2022
13f4f58
fix p2p after bcast data issue
yu-pei Mar 21, 2022
788b1bc
reset bcast keys in remote_deps when freed
yu-pei Apr 1, 2022
0e4fc3d
remove printf for perf testing
yu-pei Apr 1, 2022
06f99ef
pack the local keys into locals
yu-pei Apr 1, 2022
e1145df
updates to prevent multiple bcast forwarding, and seems like a misuse…
yu-pei Apr 11, 2022
f0bd339
some internal param changes to run on 512 nodes of Shaheen
Apr 22, 2022
0615a41
fix other cases where nolock find was used
yu-pei Apr 25, 2022
27cfc44
include broadcast benchmark codes for PTG and DTD
yu-pei May 18, 2022
b9c717a
move the timing to just around the bcast
May 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if(PARSEC_DIST_WITH_MPI AND 0)
message(FATAL_ERROR "PARSEC_DIST_WITH_MPI and PARSEC_DIST_WITH_OTHER are mutually exclusive, please select only one")
endif()
option(PARSEC_DIST_THREAD
"Use an extra thread to progress the data movements" ON)
"Use an extra thread to progress the data movements" OFF)
option(PARSEC_DIST_PRIORITIES
"Favor the communications that unlock the most prioritary tasks" ON)
option(PARSEC_DIST_COLLECTIVES
Expand Down
4 changes: 3 additions & 1 deletion parsec/interfaces/superscalar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ if( BUILD_PARSEC )
LIST(APPEND EXTRA_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/parsec_dtd_data_flush.c
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/overlap_strategies.c
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/insert_function.c)
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/insert_function.c
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/parsec_dtd_broadcast.c
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/collectives.c)

INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/interfaces/superscalar/insert_function.h
Expand Down
195 changes: 195 additions & 0 deletions parsec/interfaces/superscalar/collectives.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
/**
* Copyright (c) 2013-2020 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*/

#include "parsec/class/lifo.h"
#include "parsec/parsec_internal.h"
#include "parsec/parsec_config.h"
#include "parsec/interfaces/superscalar/insert_function_internal.h"
#include "parsec/interfaces/superscalar/insert_function.h"

#ifdef PARSEC_DTD_DIST_COLLECTIVES

/**
* Create and return `parsec_remote_deps_t` structure associated with
* the broadcast of the a data to all the nodes set in the
* `dest_ranks` array.
**/
parsec_remote_deps_t* parsec_dtd_create_remote_deps(
int myrank, int root, parsec_data_copy_t *data_copy,
parsec_arena_datatype_t *arenas_datatype,
int* dest_ranks, int num_dest_ranks) {

parsec_remote_deps_t *deps = (parsec_remote_deps_t*)remote_deps_allocate(&parsec_remote_dep_context.freelist);

assert(NULL != deps);
assert(NULL == deps->taskpool);

deps->root = root;
deps->outgoing_mask |= (1 << 0); /* only 1 flow */
deps->max_priority = 0;

struct remote_dep_output_param_s* output = &deps->output[0];
output->data.data = NULL;
output->data.arena = arenas_datatype->arena;
output->data.layout = arenas_datatype->opaque_dtt;
output->data.count = 1;
output->data.displ = 0;
output->priority = 0;

if (myrank == root) {
// if my rank corresponds to the root for this broadcast then we
// add `data_copy` to the remote deps information
// `data.data`. Otherwise, we leave it to NULL.
output->data.data = data_copy;
}

int _array_pos, _array_mask;
uint32_t dest_rank_idx;
if(myrank == root) {
// Loop through destination ranks in `dest_rank` array
for (dest_rank_idx = 0; dest_rank_idx < (uint32_t)num_dest_ranks; ++dest_rank_idx) {

// Get rank from `dest_rank` array
uint32_t dest_rank = dest_ranks[dest_rank_idx];

// Skip if we are root
if(deps->root == dest_rank) continue;

_array_pos = dest_rank / (8 * sizeof(uint32_t));
_array_mask = 1 << (dest_rank % (8 * sizeof(uint32_t)));

if( !(output->rank_bits[_array_pos] & _array_mask) ) {
output->rank_bits[_array_pos] |= _array_mask;
output->deps_mask |= (1 << 0); /* not used by DTD? */
output->count_bits++;
}
}
} else{
_array_pos = myrank / (8 * sizeof(uint32_t));
_array_mask = 1 << (myrank % (8 * sizeof(uint32_t)));

output->rank_bits[_array_pos] |= _array_mask;
output->deps_mask |= (1 << 0); /* not used by DTD? */
output->count_bits++;
}

return deps;
}

/**
* Perform a broadcast for of the dtd tile `dtd_tile_root` from the
* root node associated with the rank `root` to the nodes with ranks
* set in the `dest_ranks` array.
**/
void parsec_dtd_broadcast(
parsec_taskpool_t *taskpool, int root,
parsec_dtd_tile_t* dtd_tile_root, int arena_index,
//parsec_dtd_tile_t* bcast_keys_root, int bcast_arena_index,
int* dest_ranks, int num_dest_ranks) {

parsec_dtd_tile_t* bcast_keys_root = NULL;
int bcast_arena_index = 15;


parsec_data_copy_t *parsec_data_copy;
int *data_ptr;
int key;
int bcast_id;
int myrank = taskpool->context->my_rank;
parsec_dtd_taskpool_t *dtd_tp = (parsec_dtd_taskpool_t *)taskpool;

//bcast_keys_root = (parsec_dtd_tile_t *) parsec_thread_mempool_allocate( parsec_bcast_keys_tile_mempool->thread_mempools );
bcast_keys_root = (parsec_dtd_tile_t *) malloc(sizeof(parsec_dtd_tile_t));
SET_LAST_ACCESSOR(bcast_keys_root);
bcast_keys_root->dc = NULL;
bcast_keys_root->arena_index = -1;
bcast_keys_root->key = (uint64_t) bcast_id;
bcast_keys_root->rank = root;
bcast_keys_root->flushed = NOT_FLUSHED;
parsec_data_copy_t* new_data_copy = PARSEC_OBJ_NEW(parsec_data_copy_t);

new_data_copy->coherency_state = PARSEC_DATA_COHERENCY_OWNED;
new_data_copy->device_private = malloc(sizeof(int)*2500);
bcast_keys_root->data_copy = new_data_copy;

if(myrank == root) {
bcast_id = ( (1<<30) | (root << 18) | dtd_tp->bcast_id);
dtd_tp->bcast_id++;


parsec_data_copy = bcast_keys_root->data_copy;
data_ptr = (int*)parsec_data_copy_get_ptr(parsec_data_copy);
data_ptr[0] = bcast_id;
data_ptr[600] = num_dest_ranks;
for(int i = 0; i < num_dest_ranks; i++) {
data_ptr[dest_ranks[i]+1] = dtd_tp->send_task_id[dest_ranks[i]]++;
//pack the ranks at the end of the tiles as well
data_ptr[600+i+1] = dest_ranks[i];
}
bcast_keys_root->ht_item.key = (parsec_key_t)((uintptr_t)data_ptr[0]);

//fprintf(stderr, "on rank %d inserting key tile into bcast_keys_hash with key %ld num dest ranks %d\n", myrank, bcast_keys_root->ht_item.key, data_ptr[400]);
parsec_hash_table_insert(parsec_bcast_keys_hash, &bcast_keys_root->ht_item);
parsec_mfence(); /* Write */
}

// Retrieve DTD tile's data_copy
//parsec_data_copy_t *data_copy = dtd_tile_root->data_copy;
//parsec_data_copy_t *key_copy = bcast_keys_root->data_copy;

// Create remote deps corresponding to the braodcast
/*
parsec_remote_deps_t *deps_0 = parsec_dtd_create_remote_deps(
myrank, root, data_copy, &parsec_dtd_arenas_datatypes[arena_index],
dest_ranks, num_dest_ranks);
parsec_remote_deps_t *deps_1 = parsec_dtd_create_remote_deps(
myrank, root, key_copy, &parsec_dtd_arenas_datatypes[bcast_arena_index],
dest_ranks, num_dest_ranks);
*/
parsec_task_t *bcast_task_root = parsec_dtd_taskpool_create_task(
taskpool, parsec_dtd_bcast_data_fn, 0, "bcast_data_fn",
PASSED_BY_REF, dtd_tile_root, PARSEC_INOUT | arena_index,
sizeof(int), &root, PARSEC_VALUE | PARSEC_AFFINITY,
PARSEC_DTD_ARG_END);

parsec_dtd_task_t *dtd_bcast_task_root = (parsec_dtd_task_t *)bcast_task_root;

// Set broadcast topology info
//deps_0->pending_ack = 0;
//dtd_bcast_task_root->deps_out = deps_0;

if(myrank == root) {
dtd_bcast_task_root->ht_item.key = bcast_id;
dtd_bcast_task_root->super.locals[0].value = dtd_bcast_task_root->ht_item.key;
}else{
bcast_id = ( (1<<28) | (root << 18) | dtd_tp->recv_task_id[root]++);
dtd_bcast_task_root->ht_item.key = bcast_id;
dtd_bcast_task_root->super.locals[0].value = dtd_bcast_task_root->ht_item.key;
}

parsec_task_t *bcast_key_root = parsec_dtd_taskpool_create_task(
taskpool, parsec_dtd_bcast_key_fn, 0, "bcast_key_fn",
PASSED_BY_REF, bcast_keys_root, PARSEC_INOUT | bcast_arena_index,
sizeof(int), &root, PARSEC_VALUE | PARSEC_AFFINITY,
PARSEC_DTD_ARG_END);
parsec_dtd_task_t *dtd_bcast_key_root = (parsec_dtd_task_t *)bcast_key_root;
//deps_1->pending_ack = 0;
//dtd_bcast_key_root->deps_out = deps_1;
if(myrank == root) {
/* nothing here since the key is stored in the key array and will be updated before remote_dep_activate */
}else{
bcast_id = ( (1<<29) | (root << 18) | (dtd_tp->recv_task_id[root] -1));
dtd_bcast_key_root->ht_item.key = bcast_id;
dtd_bcast_key_root->super.locals[0].value = dtd_bcast_key_root->ht_item.key;
}
/* Post the bcast of keys and ranks array */
/* Post the bcast tasks for the actual data */
parsec_insert_dtd_task(dtd_bcast_task_root);
//sleep(1);
parsec_insert_dtd_task(dtd_bcast_key_root);
}

#endif
Loading