From af891ea294ad5f01660fa947886ec3354d5e48cc Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Sat, 27 Jul 2024 21:31:46 -0700 Subject: [PATCH] Fix use of calloc. The count is first, then the sizeof. Signed-off-by: George Bosilca --- parsec/class/info.c | 5 +++-- parsec/data_dist/matrix/map_operator.c | 7 ++++--- parsec/data_dist/matrix/vector_two_dim_cyclic.c | 3 ++- parsec/interfaces/dtd/insert_function.c | 5 +++-- parsec/interfaces/ptg/ptg-compiler/jdf2c.c | 7 ++++--- parsec/maxheap.c | 5 +++-- parsec/mca/device/device.c | 4 ++-- parsec/mca/sched/lfq/sched_lfq_module.c | 3 ++- parsec/mca/sched/lhq/sched_lhq_module.c | 3 ++- parsec/mca/sched/ltq/sched_ltq_module.c | 3 ++- parsec/mca/sched/pbq/sched_pbq_module.c | 3 ++- parsec/parsec_internal.h | 4 ++-- tests/class/atomics.c | 6 +++--- tests/class/future.c | 2 +- tests/class/future_datacopy.c | 2 +- tests/class/hash.c | 7 ++++--- tests/class/lifo.c | 5 +++-- tests/class/list.c | 5 +++-- tests/class/rwlock.c | 3 ++- tests/collections/redistribute/redistribute_check2.jdf | 3 ++- tests/collections/reshape/common.c | 3 ++- tests/dsl/dtd/dtd_test_new_tile.c | 2 +- tests/dsl/ptg/branching/branching_data.c | 3 ++- tests/dsl/ptg/choice/main.c | 3 ++- tests/profiling/async.jdf | 2 +- tools/profiling/dbpreader.c | 3 ++- 26 files changed, 60 insertions(+), 41 deletions(-) diff --git a/parsec/class/info.c b/parsec/class/info.c index e9c45cb51..000bf3839 100644 --- a/parsec/class/info.c +++ b/parsec/class/info.c @@ -2,6 +2,7 @@ * Copyright (c) 2020- The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -217,7 +218,7 @@ void parsec_info_object_array_init(parsec_info_object_array_t *oa, parsec_info_t if(oa->known_infos == 0) oa->info_objects = NULL; else - oa->info_objects = calloc(sizeof(void*), oa->known_infos); + oa->info_objects = calloc(oa->known_infos, sizeof(void*)); oa->infos = nfo; oa->cons_obj = cons_obj; } @@ -265,7 +266,7 @@ static void parsec_ioa_resize_and_rdlock(parsec_info_object_array_t *oa, parsec_ oa->info_objects = realloc(oa->info_objects, sizeof(void *) * ns); memset(&oa->info_objects[oa->known_infos - 1], 0, ns - oa->known_infos); } else { - oa->info_objects = calloc(sizeof(void*), ns); + oa->info_objects = calloc(ns, sizeof(void*)); } oa->known_infos = ns; } diff --git a/parsec/data_dist/matrix/map_operator.c b/parsec/data_dist/matrix/map_operator.c index 1d6af9196..91307e2ec 100644 --- a/parsec/data_dist/matrix/map_operator.c +++ b/parsec/data_dist/matrix/map_operator.c @@ -2,6 +2,7 @@ * Copyright (c) 2011-2021 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -106,7 +107,7 @@ static const parsec_symbol_t symb_column = { .flags = PARSEC_SYMBOL_IS_STANDALONE }; -static inline int affinity_of_map_operator(parsec_task_t *this_task, +static inline int affinity_of_map_operator(const parsec_task_t *this_task, parsec_data_ref_t *ref) { const parsec_map_operator_taskpool_t *__tp = (const parsec_map_operator_taskpool_t*)this_task->taskpool; @@ -117,7 +118,7 @@ static inline int affinity_of_map_operator(parsec_task_t *this_task, return 1; } -static inline int initial_data_of_map_operator(parsec_task_t *this_task, +static inline int initial_data_of_map_operator(const parsec_task_t *this_task, parsec_data_ref_t *refs) { int __flow_nb = 0; @@ -134,7 +135,7 @@ static inline int initial_data_of_map_operator(parsec_task_t *this_task, return __flow_nb; } -static inline int final_data_of_map_operator(parsec_task_t *this_task, +static inline int final_data_of_map_operator(const parsec_task_t *this_task, parsec_data_ref_t *data_refs) { int __flow_nb = 0; diff --git a/parsec/data_dist/matrix/vector_two_dim_cyclic.c b/parsec/data_dist/matrix/vector_two_dim_cyclic.c index 1c0b70a74..643c820eb 100644 --- a/parsec/data_dist/matrix/vector_two_dim_cyclic.c +++ b/parsec/data_dist/matrix/vector_two_dim_cyclic.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2021 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -251,7 +252,7 @@ static parsec_data_t* vector_twoDBC_data_of(parsec_data_collection_t *desc, ...) #endif /* Compute the local tile row */ - assert( dc->super.bsiz == dc->super.mb ); + assert( dc->super.bsiz == (size_t)dc->super.mb ); local_m = m / dc->lcm; diff --git a/parsec/interfaces/dtd/insert_function.c b/parsec/interfaces/dtd/insert_function.c index d1eac58a8..20ecf3cc2 100644 --- a/parsec/interfaces/dtd/insert_function.c +++ b/parsec/interfaces/dtd/insert_function.c @@ -410,7 +410,7 @@ parsec_dtd_taskpool_destructor(parsec_dtd_taskpool_t *tp) free((void *)tp->super.profiling_array); #endif /* defined(PARSEC_PROF_TRACE) */ - if( tp->super.taskpool_name != NULL ) { + if( NULL != tp->super.taskpool_name) { free(tp->super.taskpool_name); tp->super.taskpool_name = NULL; } @@ -2303,6 +2303,7 @@ static parsec_hook_return_t parsec_dtd_gpu_task_submit(parsec_execution_stream_t return device->kernel_scheduler(device, es, gpu_task); #else parsec_warning("DTD: Selected best device is a GPU, but no GPU is supported at compile time. Falling back to CPU"); + (void)this_task; return PARSEC_HOOK_RETURN_NEXT; #endif } @@ -3463,7 +3464,7 @@ parsec_arena_datatype_t *parsec_dtd_create_arena_datatype(parsec_context_t *ctx, if(NULL != new_adt) return NULL; #endif - new_adt = calloc(sizeof(parsec_arena_datatype_t), 1); + new_adt = calloc(1, sizeof(parsec_arena_datatype_t)); if(NULL == new_adt) return NULL; new_adt->ht_item.key = my_id; diff --git a/parsec/interfaces/ptg/ptg-compiler/jdf2c.c b/parsec/interfaces/ptg/ptg-compiler/jdf2c.c index ec53abeff..0627503c0 100644 --- a/parsec/interfaces/ptg/ptg-compiler/jdf2c.c +++ b/parsec/interfaces/ptg/ptg-compiler/jdf2c.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2023 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -2044,7 +2045,7 @@ static void jdf_generate_affinity( const jdf_t *jdf, const jdf_function_entry_t assert( NULL == data_affinity->var ); } - coutput("static inline int %s(%s *this_task,\n" + coutput("static inline int %s(const %s *this_task,\n" " parsec_data_ref_t *ref)\n" "{\n" " const __parsec_%s_internal_taskpool_t *__parsec_tp = (const __parsec_%s_internal_taskpool_t*)this_task->taskpool;\n", @@ -8413,14 +8414,14 @@ int jdf_force_termdet_dynamic(jdf_t* jdf) return rc; } - termdet_expr = (jdf_expr_t *)calloc(sizeof(jdf_expr_t), 1); + termdet_expr = (jdf_expr_t *)calloc(1, sizeof(jdf_expr_t)); termdet_expr->op = JDF_STRING; termdet_expr->local_variables = NULL; termdet_expr->scope = -1; termdet_expr->alias = NULL; termdet_expr->jdf_var = strdup(JDF_PROP_TERMDET_DYNAMIC); - property = (jdf_def_list_t*)calloc(sizeof(jdf_def_list_t), 1); + property = (jdf_def_list_t*)calloc(1, sizeof(jdf_def_list_t)); property->expr = termdet_expr; property->name = strdup(JDF_PROP_TERMDET_NAME); property->next = jdf->global_properties; diff --git a/parsec/maxheap.c b/parsec/maxheap.c index 46d2cf14a..bba41d9b2 100644 --- a/parsec/maxheap.c +++ b/parsec/maxheap.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -25,7 +26,7 @@ static inline int hiBit(unsigned int n) parsec_heap_t* heap_create(void) { - parsec_heap_t* heap = calloc(sizeof(parsec_heap_t), 1); + parsec_heap_t* heap = calloc(1, sizeof(parsec_heap_t)); /* Point back to the parent structure */ heap->list_item.list_next = (parsec_list_item_t*)heap; heap->list_item.list_prev = (parsec_list_item_t*)heap; @@ -67,7 +68,7 @@ void heap_insert(parsec_heap_t * heap, parsec_task_t * elem) } parents_size = level_counter; - parsec_task_t ** parents = calloc(sizeof(parsec_task_t *), level_counter); + parsec_task_t ** parents = calloc(level_counter, sizeof(parsec_task_t *)); // now the bitmask is two places farther than we want it, so back down bitmask = bitmask >> 2; diff --git a/parsec/mca/device/device.c b/parsec/mca/device/device.c index f45213ddb..db58ec8fc 100644 --- a/parsec/mca/device/device.c +++ b/parsec/mca/device/device.c @@ -1,8 +1,8 @@ /* - * * Copyright (c) 2013-2023 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -408,7 +408,7 @@ void parsec_compute_best_unit( uint64_t length, float* updated_value, char** bes void parsec_devices_save_statistics(uint64_t **pstats) { if(NULL == *pstats) { - *pstats = (uint64_t*)calloc(sizeof(uint64_t), parsec_nb_devices * 7 /* see below for the number of arrays */); + *pstats = (uint64_t*)calloc(parsec_nb_devices * 7 /* see below for the number of arrays */, sizeof(uint64_t)); } else { memset(*pstats, 0, parsec_nb_devices * sizeof(uint64_t) * 7); diff --git a/parsec/mca/sched/lfq/sched_lfq_module.c b/parsec/mca/sched/lfq/sched_lfq_module.c index 721146ec2..87f4e3feb 100644 --- a/parsec/mca/sched/lfq/sched_lfq_module.c +++ b/parsec/mca/sched/lfq/sched_lfq_module.c @@ -2,6 +2,7 @@ * Copyright (c) 2013-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,7 +65,7 @@ static int flow_lfq_init(parsec_execution_stream_t* es, struct parsec_barrier_t* vp = es->virtual_process; /* Every flow creates its own local object */ - sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(sizeof(parsec_mca_sched_local_queues_scheduler_object_t), 1); + sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(1, sizeof(parsec_mca_sched_local_queues_scheduler_object_t)); es->scheduler_object = sched_obj; if( 0 == es->th_id ) { /* And flow 0 creates the system_queue */ sched_obj->system_queue = PARSEC_OBJ_NEW(parsec_dequeue_t); diff --git a/parsec/mca/sched/lhq/sched_lhq_module.c b/parsec/mca/sched/lhq/sched_lhq_module.c index 6d9ec2424..b70bd6d9e 100644 --- a/parsec/mca/sched/lhq/sched_lhq_module.c +++ b/parsec/mca/sched/lhq/sched_lhq_module.c @@ -2,6 +2,7 @@ * Copyright (c) 2013-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -70,7 +71,7 @@ static int flow_lhq_init(parsec_execution_stream_t* ces, struct parsec_barrier_t /* First of all, we allocate the scheduling object memory for all threads */ es = vp->execution_streams[t]; - sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(sizeof(parsec_mca_sched_local_queues_scheduler_object_t), 1); + sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(1, sizeof(parsec_mca_sched_local_queues_scheduler_object_t)); es->scheduler_object = sched_obj; if( es->th_id == 0 ) { diff --git a/parsec/mca/sched/ltq/sched_ltq_module.c b/parsec/mca/sched/ltq/sched_ltq_module.c index f1bf081b5..fc8457704 100644 --- a/parsec/mca/sched/ltq/sched_ltq_module.c +++ b/parsec/mca/sched/ltq/sched_ltq_module.c @@ -2,6 +2,7 @@ * Copyright (c) 2013-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -63,7 +64,7 @@ static int flow_ltq_init(parsec_execution_stream_t* es, struct parsec_barrier_t* uint32_t queue_size; parsec_vp_t * vp = es->virtual_process; - sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(sizeof(parsec_mca_sched_local_queues_scheduler_object_t), 1); + sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(1, sizeof(parsec_mca_sched_local_queues_scheduler_object_t)); es->scheduler_object = sched_obj; if( es->th_id == 0 ) { diff --git a/parsec/mca/sched/pbq/sched_pbq_module.c b/parsec/mca/sched/pbq/sched_pbq_module.c index e604e8dc0..8591288a4 100644 --- a/parsec/mca/sched/pbq/sched_pbq_module.c +++ b/parsec/mca/sched/pbq/sched_pbq_module.c @@ -2,6 +2,7 @@ * Copyright (c) 2013-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -61,7 +62,7 @@ static int flow_pbq_init(parsec_execution_stream_t* es, struct parsec_barrier_t* uint32_t queue_size = 0; /* Every flow creates its own local object */ - sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(sizeof(parsec_mca_sched_local_queues_scheduler_object_t), 1); + sched_obj = (parsec_mca_sched_local_queues_scheduler_object_t*)calloc(1, sizeof(parsec_mca_sched_local_queues_scheduler_object_t)); es->scheduler_object = sched_obj; if( es->th_id == 0 ) { /* And flow 0 creates the system_queue */ sched_obj->system_queue = PARSEC_OBJ_NEW(parsec_dequeue_t); diff --git a/parsec/parsec_internal.h b/parsec/parsec_internal.h index 970587260..103d53aa1 100644 --- a/parsec/parsec_internal.h +++ b/parsec/parsec_internal.h @@ -2,6 +2,7 @@ * Copyright (c) 2012-2023 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #if !defined(PARSEC_CONFIG_H_HAS_BEEN_INCLUDED) @@ -337,8 +338,7 @@ typedef struct parsec_data_ref_s { parsec_data_key_t key; } parsec_data_ref_t; -typedef int (parsec_data_ref_fn_t)(parsec_task_t *task, - parsec_data_ref_t *ref); +typedef int (parsec_data_ref_fn_t)(const parsec_task_t *task, parsec_data_ref_t *ref); #define PARSEC_HAS_IN_IN_DEPENDENCIES 0x0001 #define PARSEC_HAS_OUT_OUT_DEPENDENCIES 0x0002 diff --git a/tests/class/atomics.c b/tests/class/atomics.c index fc7f0ecbb..74c7e0695 100644 --- a/tests/class/atomics.c +++ b/tests/class/atomics.c @@ -242,9 +242,9 @@ int main(int argc, char *argv[]) } } - threads = calloc(sizeof(pthread_t), nb_tests); - params = calloc(sizeof(param_t), nb_tests); - values = calloc(sizeof(values_t), nb_tests+2); + threads = calloc(nb_tests, sizeof(pthread_t)); + params = calloc(nb_tests, sizeof(param_t)); + values = calloc(nb_tests+2, sizeof(values_t)); gettimeofday(&now, NULL); srand48(now.tv_usec ^ getpid()); diff --git a/tests/class/future.c b/tests/class/future.c index ff3ee4f05..887ca9e14 100644 --- a/tests/class/future.c +++ b/tests/class/future.c @@ -119,7 +119,7 @@ int main(int argc, char* argv[]) c_fut = PARSEC_OBJ_NEW(parsec_countable_future_t); parsec_future_init(c_fut, NULL, cores); printf("running with %d cores and %d copies\n", cores, ncopy); - threads = calloc(sizeof(pthread_t), cores); + threads = calloc(cores, sizeof(pthread_t)); fut_array = malloc(cores*ncopy*sizeof(parsec_base_future_t*)); data = malloc(cores*ncopy*sizeof(int)); diff --git a/tests/class/future_datacopy.c b/tests/class/future_datacopy.c index effad1fe7..28af1262d 100644 --- a/tests/class/future_datacopy.c +++ b/tests/class/future_datacopy.c @@ -162,7 +162,7 @@ int main(int argc, char* argv[]) } printf("running with %d cores and %d copies\n", cores, ncopy); - threads = calloc(sizeof(pthread_t), cores); + threads = calloc(cores, sizeof(pthread_t)); fut_array = malloc(ncopy*sizeof(parsec_datacopy_future_t*)); data = malloc(cores*ncopy*sizeof(int)); diff --git a/tests/class/hash.c b/tests/class/hash.c index 850713ee7..e7fa7f1bd 100644 --- a/tests/class/hash.c +++ b/tests/class/hash.c @@ -2,6 +2,7 @@ * Copyright (c) 2017-2021 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -597,9 +598,9 @@ int main(int argc, char *argv[]) } } - threads = calloc(sizeof(pthread_t), maxthreads); - params = calloc(sizeof(param_t), maxthreads+1); - keys = calloc(sizeof(uint64_t), nb_tests); + threads = calloc(maxthreads, sizeof(pthread_t)); + params = calloc(maxthreads+1, sizeof(param_t)); + keys = calloc(nb_tests, sizeof(uint64_t)); init_keys(keys, nb_tests, seed, structured_keys); for(md_tuning = md_tuning_min; md_tuning < md_tuning_max; md_tuning += md_tuning_inc) { diff --git a/tests/class/lifo.c b/tests/class/lifo.c index 907d215d7..500243d89 100644 --- a/tests/class/lifo.c +++ b/tests/class/lifo.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2024 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -254,8 +255,8 @@ int main(int argc, char *argv[]) } } - threads = (pthread_t*)calloc(sizeof(pthread_t), nbthreads); - times = (uint64_t*)calloc(sizeof(uint64_t), nbthreads); + threads = (pthread_t*)calloc(nbthreads, sizeof(pthread_t)); + times = (uint64_t*)calloc(nbthreads, sizeof(uint64_t)); PARSEC_OBJ_CONSTRUCT(&lifo1, parsec_lifo_t); PARSEC_OBJ_CONSTRUCT(&lifo2, parsec_lifo_t); diff --git a/tests/class/list.c b/tests/class/list.c index d85a728bb..89fdd3030 100644 --- a/tests/class/list.c +++ b/tests/class/list.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2024 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -299,8 +300,8 @@ int main(int argc, char *argv[]) } } - threads = (pthread_t*)calloc(sizeof(pthread_t), nbthreads); - times = (uint64_t*)calloc(sizeof(uint64_t), nbthreads); + threads = (pthread_t*)calloc(nbthreads, sizeof(pthread_t)); + times = (uint64_t*)calloc(nbthreads, sizeof(uint64_t)); PARSEC_OBJ_CONSTRUCT( &l1, parsec_list_t ); PARSEC_OBJ_CONSTRUCT( &l2, parsec_list_t ); diff --git a/tests/class/rwlock.c b/tests/class/rwlock.c index d16a221ec..11d4dbd46 100644 --- a/tests/class/rwlock.c +++ b/tests/class/rwlock.c @@ -2,6 +2,7 @@ * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -138,7 +139,7 @@ int main(int argc, char *argv[]) parsec_atomic_rwlock_init(&rwlock); - threads = (pthread_t*)calloc(sizeof(pthread_t), maxthreads); + threads = (pthread_t*)calloc(maxthreads, sizeof(pthread_t)); for( nbthreads = minthreads; nbthreads < maxthreads; nbthreads++) { parsec_barrier_init(&barrier, NULL, nbthreads+1); diff --git a/tests/collections/redistribute/redistribute_check2.jdf b/tests/collections/redistribute/redistribute_check2.jdf index fcb4c0b52..48ecb0382 100644 --- a/tests/collections/redistribute/redistribute_check2.jdf +++ b/tests/collections/redistribute/redistribute_check2.jdf @@ -3,6 +3,7 @@ extern "C" %{ * Copyright (c) 2017-2021 The Universiy of Tennessee and The Universiy * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "redistribute_test.h" @@ -143,7 +144,7 @@ int parsec_redistribute_check2(parsec_context_t *parsec, int nb_threads = parsec->virtual_processes[0]->nb_cores; /* Used for error accumulation */ - long long int *info = (long long int *)calloc(sizeof(long long int), nb_threads); + long long int *info = (long long int *)calloc(nb_threads, sizeof(long long int)); parsec_redistribute_check2 = parsec_redistribute_check2_New( (parsec_tiled_matrix_t *)dcY, diff --git a/tests/collections/reshape/common.c b/tests/collections/reshape/common.c index 04b2cd825..206109bd2 100644 --- a/tests/collections/reshape/common.c +++ b/tests/collections/reshape/common.c @@ -2,6 +2,7 @@ * Copyright (c) 2017-2021 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "common.h" @@ -158,7 +159,7 @@ int reshape_set_matrix_value_position_swap(parsec_execution_stream_t *es, int check_matrix_equal(parsec_matrix_block_cyclic_t dcA, parsec_matrix_block_cyclic_t dcA_check){ int ret = 0; - for(int i=0; i < dcA_check.super.nb_local_tiles * dcA_check.super.bsiz; i++){ + for(size_t i = 0; i < (dcA_check.super.nb_local_tiles * dcA_check.super.bsiz); i++) { if( ((int*)dcA.mat)[i] != ((int*)dcA_check.mat)[i]){ ret = 1; break; diff --git a/tests/dsl/dtd/dtd_test_new_tile.c b/tests/dsl/dtd/dtd_test_new_tile.c index 36f6b99da..42056f3f1 100644 --- a/tests/dsl/dtd/dtd_test_new_tile.c +++ b/tests/dsl/dtd/dtd_test_new_tile.c @@ -378,7 +378,7 @@ int main(int argc, char **argv) parsec_dtd_task_class_add_chore(dtd_tp, fourth_tc, PARSEC_DEV_CPU, cpu_reduce); parsec_dtd_tile_t **new_tiles; - new_tiles = (parsec_dtd_tile_t**)calloc(sizeof(parsec_dtd_tile_t *), NCASE*world); + new_tiles = (parsec_dtd_tile_t**)calloc(NCASE*world, sizeof(parsec_dtd_tile_t *)); acc = 0; diff --git a/tests/dsl/ptg/branching/branching_data.c b/tests/dsl/ptg/branching/branching_data.c index e362cb5c8..0f8045240 100644 --- a/tests/dsl/ptg/branching/branching_data.c +++ b/tests/dsl/ptg/branching/branching_data.c @@ -2,6 +2,7 @@ * Copyright (c) 2013-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -98,7 +99,7 @@ parsec_data_collection_t *create_and_distribute_data(int rank, int world, int si #endif parsec_type_create_contiguous(size, parsec_datatype_int32_t, &d->default_dtt); - m->data = calloc(sizeof(parsec_data_t*), nb); + m->data = calloc(nb, sizeof(parsec_data_t*)); m->nt = nb; m->size = size; m->ptr = (int32_t*)malloc(nb * size * sizeof(int32_t)); diff --git a/tests/dsl/ptg/choice/main.c b/tests/dsl/ptg/choice/main.c index 29988fd1d..525441934 100644 --- a/tests/dsl/ptg/choice/main.c +++ b/tests/dsl/ptg/choice/main.c @@ -2,6 +2,7 @@ * Copyright (c) 2009-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/runtime.h" @@ -68,7 +69,7 @@ int main(int argc, char *argv[]) dcA = create_and_distribute_data(rank, world, size); parsec_data_collection_set_key(dcA, "A"); - decision = (int*)calloc(sizeof(int), nb+1); + decision = (int*)calloc(nb+1, sizeof(int)); choice = choice_new(dcA, size, decision, nb, world); rc = parsec_context_add_taskpool(parsec, choice); diff --git a/tests/profiling/async.jdf b/tests/profiling/async.jdf index 487c2ea21..de24694c8 100644 --- a/tests/profiling/async.jdf +++ b/tests/profiling/async.jdf @@ -211,7 +211,7 @@ int main( int argc, char** argv ) profiling_save_iinfo("NB", NB); #endif - taskqueue = (parsec_task_t**)calloc(sizeof(parsec_task_t*), (NB+1)); + taskqueue = (parsec_task_t**)calloc(NB+1, sizeof(parsec_task_t*)); /** * Build the data and the arena to hold it up. */ diff --git a/tools/profiling/dbpreader.c b/tools/profiling/dbpreader.c index 00eb00acd..419755b0d 100644 --- a/tools/profiling/dbpreader.c +++ b/tools/profiling/dbpreader.c @@ -2,6 +2,7 @@ * Copyright (c) 2010-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2024 NVIDIA Corporation. All rights reserved. */ #include "parsec/parsec_config.h" @@ -1071,7 +1072,7 @@ static dbp_multifile_reader_t *open_files(int nbfiles, char **filenames) dbp->last_error = SUCCESS; dbp->dico_size = 0; dbp->dico_allocated = 8; - dbp->dico_keys = calloc(sizeof(dbp_dictionary_t), dbp->dico_allocated); + dbp->dico_keys = calloc(dbp->dico_allocated, sizeof(dbp_dictionary_t)); n = 0; for(i = 0; i < nbfiles; i++) {