Skip to content

Commit

Permalink
checkpoint.
Browse files Browse the repository at this point in the history
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
  • Loading branch information
bosilca committed Aug 1, 2023
1 parent 55eb92b commit 7586036
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions src/utils/dplasma_lapack_adtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ static parsec_key_fn_t dtt_lapack_key_fns = {

parsec_hash_table_t *dplasma_datatypes_lapack_helper = NULL;

/*************************************************************/
/* Static helper functions that are not protected. */
/*************************************************************/

static void dplasma_datatypes_lapack_helper_release(void *item, void*cb_data)
{
(void)cb_data;
Expand All @@ -59,28 +63,40 @@ static void dplasma_datatypes_info_fini()
}
}

static int
dplasma_set_dtt_to_info( const dplasma_data_collection_t *dc,
parsec_arena_datatype_t adt,
const lapack_info_t* info)
{
dplasma_datatype_lapack_helper_t * dtt_entry = NULL;
/*************************************************************/
/* Static helper functions that are lock protected. */
/*************************************************************/

char static_desc[LAPACK_ADT_KEY_STR_SZ];
snprintf( static_desc, LAPACK_ADT_KEY_STR_SZ, "%p|%"PRIxPTR"|-1|-1|-1", dc, (intptr_t)adt.opaque_dtt);
parsec_key_t k = (uint64_t)static_desc;
static inline int
dplasma_set_helper_hash_table_atomic(void)
{
if( NULL == dplasma_datatypes_lapack_helper ) {
parsec_hash_table_t* new_ht = PARSEC_OBJ_NEW(parsec_hash_table_t);
parsec_hash_table_init(new_ht,
offsetof(dplasma_datatype_lapack_helper_t, ht_item),
16, dtt_lapack_key_fns, NULL);
if(parsec_atomic_cas_ptr(&dplasma_datatypes_lapack_helper, NULL, new_ht)) {
parsec_context_at_fini(dplasma_datatypes_info_fini, NULL);
} else {
parsec_hash_table_fini(new_ht);
PARSEC_OBJ_RELEASE(new_ht);
return 1;
}
parsec_hash_table_fini(new_ht);
PARSEC_OBJ_RELEASE(new_ht);
}
return 0;
}

static int
dplasma_set_dtt_to_info( const dplasma_data_collection_t *dc,
parsec_arena_datatype_t adt,
const lapack_info_t* info)
{
dplasma_datatype_lapack_helper_t * dtt_entry = NULL;

char static_desc[LAPACK_ADT_KEY_STR_SZ];
snprintf( static_desc, LAPACK_ADT_KEY_STR_SZ, "%p|%"PRIxPTR"|-1|-1|-1", dc, (intptr_t)adt.opaque_dtt);
parsec_key_t k = (uint64_t)static_desc;

(void)dplasma_set_helper_hash_table_atomic();

parsec_hash_table_lock_bucket(dplasma_datatypes_lapack_helper, k); /* protect access to the hash table */
/* Find the entry */
Expand Down Expand Up @@ -113,18 +129,8 @@ dplasma_set_info_to_dtt( const dplasma_data_collection_t *dc,
char static_desc[LAPACK_ADT_KEY_STR_SZ];
snprintf( static_desc, LAPACK_ADT_KEY_STR_SZ, "%p|-1|%d|%d|%d", dc, info->loc, info->shape, info->layout);
parsec_key_t k = (uint64_t)static_desc;
if( NULL == dplasma_datatypes_lapack_helper ) {
parsec_hash_table_t* new_ht = PARSEC_OBJ_NEW(parsec_hash_table_t);
parsec_hash_table_init(new_ht,
offsetof(dplasma_datatype_lapack_helper_t, ht_item),
16, dtt_lapack_key_fns, NULL);
if(parsec_atomic_cas_ptr(&dplasma_datatypes_lapack_helper, NULL, new_ht)) {
parsec_context_at_fini(dplasma_datatypes_info_fini, NULL);
} else {
parsec_hash_table_fini(new_ht);
PARSEC_OBJ_RELEASE(new_ht);
}
}

(void)dplasma_set_helper_hash_table_atomic();

parsec_hash_table_lock_bucket(dplasma_datatypes_lapack_helper, k); /* protect access to the hash table */
/* Find the entry */
Expand Down

0 comments on commit 7586036

Please sign in to comment.