Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) 2010-2024 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
#
cmake_minimum_required (VERSION 3.21)
project (PARSEC C)
Expand Down Expand Up @@ -536,6 +537,7 @@ if( NOT PARSEC_HAVE_RUSAGE_THREAD )
endif( NOT PARSEC_HAVE_RUSAGE_THREAD)
check_include_files(limits.h PARSEC_HAVE_LIMITS_H)
check_include_files(string.h PARSEC_HAVE_STRING_H)
check_include_files(strings.h PARSEC_HAVE_STRINGS_H)
check_include_files(libgen.h PARSEC_HAVE_GEN_H)
check_include_files(complex.h PARSEC_HAVE_COMPLEX_H)
check_include_files(sys/param.h PARSEC_HAVE_SYS_PARAM_H)
Expand Down
6 changes: 4 additions & 2 deletions parsec/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2010-2023 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
*/

#include "parsec/parsec_config.h"
Expand Down Expand Up @@ -96,7 +97,7 @@ int parsec_arena_construct(parsec_arena_t* arena,
parsec_arena_max_cached_memory);
}

static void parsec_arena_destructor(parsec_arena_t* arena)
static int parsec_arena_destructor(parsec_arena_t* arena)
{
parsec_list_item_t* item;

Expand All @@ -116,6 +117,7 @@ static void parsec_arena_destructor(parsec_arena_t* arena)
}
PARSEC_OBJ_DESTRUCT(&arena->area_lifo);
}
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(parsec_arena_t, parsec_object_t, NULL, parsec_arena_destructor);
Expand Down Expand Up @@ -223,7 +225,7 @@ int parsec_arena_allocate_device_private(parsec_data_copy_t *copy,
assert(0 == (((ptrdiff_t)chunk->data) % arena->alignment));
assert((arena->elem_size + (ptrdiff_t)chunk->data) <= (size + (ptrdiff_t)chunk));

data->nb_elts = count * arena->elem_size;
data->span = count * arena->elem_size;

copy->flags = PARSEC_DATA_FLAG_ARENA |
PARSEC_DATA_FLAG_PARSEC_OWNED |
Expand Down
8 changes: 5 additions & 3 deletions parsec/class/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2020-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2024-2025 NVIDIA Corporation. All rights reserved.
*/

#include "parsec/parsec_config.h"
Expand All @@ -21,7 +21,7 @@ static void parsec_info_constructor(parsec_object_t *obj)
PARSEC_OBJ_CONSTRUCT(&nfo->ioa_list, parsec_list_t);
}

static void parsec_info_destructor(parsec_object_t *obj)
static int parsec_info_destructor(parsec_object_t *obj)
{
parsec_info_t *nfo = (parsec_info_t*)obj;
parsec_list_item_t *item, *next;
Expand All @@ -34,6 +34,7 @@ static void parsec_info_destructor(parsec_object_t *obj)
}
PARSEC_OBJ_DESTRUCT(&nfo->ioa_list);
/* nfo->info_list is the parent and will be destructed at exit */
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(parsec_info_t, parsec_list_t, parsec_info_constructor, parsec_info_destructor);
Expand Down Expand Up @@ -223,7 +224,7 @@ void parsec_info_object_array_init(parsec_info_object_array_t *oa, parsec_info_t
oa->cons_obj = cons_obj;
}

static void parsec_info_object_array_destructor(parsec_object_t *obj)
static int parsec_info_object_array_destructor(parsec_object_t *obj)
{
parsec_list_item_t *next, *item;
parsec_info_object_array_t *oa = (parsec_info_object_array_t*)obj;
Expand All @@ -246,6 +247,7 @@ static void parsec_info_object_array_destructor(parsec_object_t *obj)
oa->info_objects = NULL;
oa->infos = NULL;
oa->known_infos = -1;
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(parsec_info_object_array_t, parsec_list_item_t,
Expand Down
7 changes: 4 additions & 3 deletions parsec/class/parsec_datacopy_future.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2018-2024 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2023-2025 NVIDIA CORPORATION. All rights reserved.
*/
#include "parsec/parsec_config.h"
#include "parsec/class/parsec_future.h"
Expand All @@ -12,7 +12,7 @@
static void parsec_datacopy_future_construct(parsec_base_future_t* future);

static void parsec_datacopy_future_cleanup_nested(parsec_base_future_t* future);
static void parsec_datacopy_future_destruct(parsec_base_future_t* future);
static int parsec_datacopy_future_destruct(parsec_base_future_t* future);

static void parsec_datacopy_future_init(parsec_base_future_t* future,
parsec_future_cb_fulfill cb, ...);
Expand Down Expand Up @@ -295,7 +295,7 @@ static void parsec_datacopy_future_cleanup_nested(parsec_base_future_t* future)
*
* @param[in] future to be destructed.
*/
static void parsec_datacopy_future_destruct(parsec_base_future_t* future)
static int parsec_datacopy_future_destruct(parsec_base_future_t* future)
{
parsec_datacopy_future_t* d_fut = (parsec_datacopy_future_t*)future;

Expand All @@ -313,6 +313,7 @@ static void parsec_datacopy_future_destruct(parsec_base_future_t* future)
if(d_fut->cb_cleanup != NULL){
d_fut->cb_cleanup(future);
}
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(parsec_datacopy_future_t, parsec_base_future_t,
Expand Down
4 changes: 3 additions & 1 deletion parsec/class/parsec_hash_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2009-2023 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
*/

#include <assert.h>
Expand Down Expand Up @@ -261,7 +262,7 @@ void parsec_hash_table_unlock_bucket_handle_impl(parsec_hash_table_t *ht,
}


void parsec_hash_table_fini(parsec_hash_table_t *ht)
int parsec_hash_table_fini(parsec_hash_table_t *ht)
{
parsec_hash_table_head_t *head, *next;
head = ht->rw_hash;
Expand All @@ -279,6 +280,7 @@ void parsec_hash_table_fini(parsec_hash_table_t *ht)
head = next;
}
ht->rw_hash = NULL;
return 0;
}

void parsec_hash_table_nolock_insert(parsec_hash_table_t *ht, parsec_hash_table_item_t *item)
Expand Down
6 changes: 5 additions & 1 deletion parsec/class/parsec_hash_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2009-2022 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
*/

#ifndef _parsec_hash_table_h
Expand Down Expand Up @@ -210,8 +211,11 @@ void parsec_hash_table_unlock_bucket_handle_impl(parsec_hash_table_t *ht,
* Releases the resources allocated by the hash table.
* In debug mode, will assert if the hash table is not empty
* @arg[inout] ht the hash table to release
* @return As all destructors, it shall return 0 to continue the chain of destructors and
* 1 to stop the chain and save the object from oblivion. The user will then be in
* charge of freeing the object.
*/
void parsec_hash_table_fini(parsec_hash_table_t *ht);
int parsec_hash_table_fini(parsec_hash_table_t *ht);

/**
* @brief Insert element in a hash table without
Expand Down
4 changes: 3 additions & 1 deletion parsec/class/parsec_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2013-2021 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
*/

#include "parsec/parsec_config.h"
Expand Down Expand Up @@ -39,10 +40,11 @@ parsec_list_construct( parsec_list_t* list )
parsec_atomic_lock_init(&list->atomic_lock);
}

static inline void
static inline int
parsec_list_destruct( parsec_list_t* list )
{
assert(parsec_list_is_empty(list)); (void)list;
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(parsec_list_t, parsec_object_t,
Expand Down
21 changes: 11 additions & 10 deletions parsec/class/parsec_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -35,15 +36,15 @@
* and no constructor or destructor.
*/
parsec_class_t parsec_object_t_class = {
"parsec_object_t", /* name */
NULL, /* parent class */
NULL, /* constructor */
NULL, /* destructor */
1, /* initialized -- this class is preinitialized */
0, /* class hierarchy depth */
NULL, /* array of constructors */
NULL, /* array of destructors */
sizeof(parsec_object_t) /* size of the opal object */
"parsec_object_t", /* name */
NULL, /* parent class */
NULL, /* constructor */
NULL, /* destructor */
1, /* initialized -- this class is preinitialized */
0, /* class hierarchy depth */
NULL, /* array of constructors */
NULL, /* array of destructors */
sizeof(parsec_object_t) /* size of the opal object */
};

/*
Expand Down Expand Up @@ -135,7 +136,7 @@ void parsec_class_initialize(parsec_class_t *cls)
exit(-1);
}
cls->cls_destruct_array =
cls->cls_construct_array + cls_construct_array_count + 1;
(parsec_destruct_t*)(cls->cls_construct_array + cls_construct_array_count + 1);

/*
* The constructor array is reversed, so start at the end
Expand Down
52 changes: 31 additions & 21 deletions parsec/class/parsec_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -136,7 +137,8 @@ BEGIN_C_DECLS
typedef struct parsec_object_t parsec_object_t;
typedef struct parsec_class_t parsec_class_t;
typedef void (*parsec_construct_t) (parsec_object_t *);
typedef void (*parsec_destruct_t) (parsec_object_t *);
/* Class destructor: Returns 0 to continue through the class inheritance, or 1 to stop */
typedef int (*parsec_destruct_t) (parsec_object_t *);


/* types **************************************************************/
Expand Down Expand Up @@ -306,26 +308,28 @@ static inline parsec_object_t *parsec_obj_new_debug(parsec_class_t* type, const
* @param object Pointer to the object
*/
#if defined(PARSEC_DEBUG_PARANOID)
#define PARSEC_OBJ_RELEASE(object) \
do { \
assert(NULL != ((parsec_object_t *) (object))->obj_class); \
assert(PARSEC_OBJ_MAGIC_ID == ((parsec_object_t *) (object))->obj_magic_id); \
if (0 == parsec_obj_update((parsec_object_t *) (object), -1)) { \
parsec_obj_run_destructors((parsec_object_t *) (object)); \
PARSEC_OBJ_SET_MAGIC_ID((object), 0); \
PARSEC_OBJ_REMEMBER_FILE_AND_LINENO( object, __FILE__, __LINE__ ); \
free(object); \
object = NULL; \
} \
#define PARSEC_OBJ_RELEASE(object) \
do \
{ \
assert(NULL != ((parsec_object_t *)(object))->obj_class); \
assert(PARSEC_OBJ_MAGIC_ID == ((parsec_object_t *)(object))->obj_magic_id); \
if (0 == parsec_obj_update((parsec_object_t *)(object), -1)) \
{ \
PARSEC_OBJ_SET_MAGIC_ID((object), 0); \
PARSEC_OBJ_REMEMBER_FILE_AND_LINENO(object, __FILE__, __LINE__); \
if (0 == parsec_obj_run_destructors((parsec_object_t *)(object))) \
free(object); \
object = NULL; \
} \
} while (0)
#else
#define PARSEC_OBJ_RELEASE(object) \
do { \
if (0 == parsec_obj_update((parsec_object_t *) (object), -1)) { \
parsec_obj_run_destructors((parsec_object_t *) (object)); \
free(object); \
object = NULL; \
} \
#define PARSEC_OBJ_RELEASE(object) \
do { \
if (0 == parsec_obj_update((parsec_object_t *) (object), -1)) { \
if (0 == parsec_obj_run_destructors((parsec_object_t *) (object))) \
free(object); \
object = NULL; \
} \
} while (0)
#endif

Expand Down Expand Up @@ -435,17 +439,23 @@ static inline void parsec_obj_run_constructors(parsec_object_t * object)
*
* @param object Pointer to the object.
*/
static inline void parsec_obj_run_destructors(parsec_object_t * object)
static inline int parsec_obj_run_destructors(parsec_object_t * object)
{
parsec_destruct_t* cls_destruct;

assert(NULL != object->obj_class);

cls_destruct = object->obj_class->cls_destruct_array;
while( NULL != *cls_destruct ) {
(*cls_destruct)(object);
/* Any destructor is allowed to withdraw the object from the complete release, and thus prevent the
* base object management from freeing the object. Instead, the destructor will have to recycle the object
* by some internal means, and free it later.
*/
if (0 != (*cls_destruct)(object))
return 1;
cls_destruct++;
}
return 0;
}


Expand Down
4 changes: 3 additions & 1 deletion parsec/class/parsec_value_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -28,10 +29,11 @@ static void parsec_value_array_construct(parsec_value_array_t* array)
array->array_alloc_size = 0;
}

static void parsec_value_array_destruct(parsec_value_array_t* array)
static int parsec_value_array_destruct(parsec_value_array_t* array)
{
if (NULL != array->array_items)
free(array->array_items);
return 0;
}

PARSEC_OBJ_CLASS_INSTANCE(
Expand Down
4 changes: 3 additions & 1 deletion parsec/compound.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2019-2023 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
*/

#include "parsec/parsec_config.h"
Expand Down Expand Up @@ -65,7 +66,7 @@ parsec_compound_taskpool_startup( parsec_context_t *context,
(void)startup_list;
}

static void
static int
__parsec_compound_taskpool_destructor( parsec_compound_taskpool_t* compound )
{
assert(PARSEC_TASKPOOL_TYPE_COMPOUND == compound->super.taskpool_type);
Expand All @@ -76,6 +77,7 @@ __parsec_compound_taskpool_destructor( parsec_compound_taskpool_t* compound )
free(compound->super.taskpool_name);
compound->super.taskpool_name = NULL;
}
return 0;
}

static void
Expand Down
Loading