- Upon Finalize, also release the memory of predefined attributes.
This commit was SVN r9169.
Этот коммит содержится в:
родитель
af0002c794
Коммит
4b1194056f
@ -497,12 +497,15 @@ int ompi_attr_init(void)
|
||||
|
||||
int ompi_attr_finalize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ompi_attr_free_predefined();
|
||||
OBJ_RELEASE(keyval_hash);
|
||||
OBJ_RELEASE(key_bitmap);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ompi_attr_create_keyval(ompi_attribute_type_t type,
|
||||
ompi_attribute_fn_ptr_union_t copy_attr_fn,
|
||||
@ -583,7 +586,7 @@ int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
|
||||
|
||||
/* This will delete the key only when no attributes are associated
|
||||
with it, else it will just decrement the reference count, so that when
|
||||
the last attribute is deleted, this object gets deleted too */
|
||||
the last attribute is deleted, this object gets deleted too */
|
||||
|
||||
OBJ_RELEASE(key_item);
|
||||
|
||||
@ -1028,7 +1031,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
|
||||
DELETE_ATTR_CALLBACKS(win, old_attr, key_item);
|
||||
break;
|
||||
|
||||
case TYPE_ATTR:
|
||||
case TYPE_ATTR:
|
||||
DELETE_ATTR_CALLBACKS(datatype, old_attr, key_item);
|
||||
break;
|
||||
|
||||
@ -1039,13 +1042,13 @@ static int set_value(ompi_attribute_type_t type, void *object,
|
||||
OBJ_RELEASE(old_attr);
|
||||
}
|
||||
|
||||
ret = opal_hash_table_set_value_uint32(*keyhash, key, new_attr);
|
||||
ret = opal_hash_table_set_value_uint32(*keyhash, key, new_attr);
|
||||
|
||||
if (need_lock) {
|
||||
OPAL_THREAD_UNLOCK(&alock);
|
||||
}
|
||||
if (OMPI_SUCCESS != ret) {
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Increase the reference count of the object, only if there was no
|
||||
|
@ -491,6 +491,15 @@ int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
|
||||
*/
|
||||
int ompi_attr_create_predefined(void);
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Free all the predefined attributes
|
||||
*
|
||||
* @returns OMPI_SUCCESS
|
||||
*/
|
||||
int ompi_attr_free_predefined(void);
|
||||
|
||||
struct orte_gpr_notify_data_t;
|
||||
/**
|
||||
* \internal
|
||||
|
@ -97,8 +97,12 @@
|
||||
* Private functions
|
||||
*/
|
||||
static int create_comm(int target_keyval, bool want_inherit);
|
||||
static int free_comm(int keyval);
|
||||
|
||||
/* JMS for when we implement windows */
|
||||
static int create_win(int target_keyval);
|
||||
static int free_win(int keyval);
|
||||
|
||||
static int set_f(int keyval, MPI_Fint value);
|
||||
|
||||
|
||||
@ -127,10 +131,10 @@ int ompi_attr_create_predefined(void)
|
||||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_DISP_UNIT)) ||
|
||||
#if 0
|
||||
/* JMS For when we implement IMPI */
|
||||
OMPI_SUCCESS != (ret = create_comm(MPI_IMPI_CLIENT_SIZE, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(MPI_IMPI_CLIENT_COLOR, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(MPI_IMPI_HOST_SIZE, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(MPI_IMPI_HOST_COLOR, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(IMPI_CLIENT_SIZE, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(IMPI_CLIENT_COLOR, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(IMPI_HOST_SIZE, true)) ||
|
||||
OMPI_SUCCESS != (ret = create_comm(IMPI_HOST_COLOR, true)) ||
|
||||
#endif
|
||||
0) {
|
||||
return ret;
|
||||
@ -152,13 +156,13 @@ int ompi_attr_create_predefined(void)
|
||||
ompi_comm_size(MPI_COMM_WORLD))) ||
|
||||
#if 0
|
||||
/* JMS For when we implement IMPI */
|
||||
OMPI_SUCCESS != (ret = set(MPI_IMPI_CLIENT_SIZE,
|
||||
OMPI_SUCCESS != (ret = set(IMPI_CLIENT_SIZE,
|
||||
&attr_impi_client_size)) ||
|
||||
OMPI_SUCCESS != (ret = set(MPI_IMPI_CLIENT_COLOR,
|
||||
OMPI_SUCCESS != (ret = set(IMPI_CLIENT_COLOR,
|
||||
&attr_impi_client_color)) ||
|
||||
OMPI_SUCCESS != (ret = set(MPI_IMPI_HOST_SIZE,
|
||||
OMPI_SUCCESS != (ret = set(IMPI_HOST_SIZE,
|
||||
&attr_impi_host_size)) ||
|
||||
OMPI_SUCCESS != (ret = set(MPI_IMPI_HOST_COLOR,
|
||||
OMPI_SUCCESS != (ret = set(IMPI_HOST_COLOR,
|
||||
&attr_impi_host_color)) ||
|
||||
#endif
|
||||
0) {
|
||||
@ -207,7 +211,34 @@ int ompi_attr_create_predefined(void)
|
||||
free(sub_name);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int ompi_attr_free_predefined(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (OMPI_SUCCESS != (ret = free_comm(MPI_TAG_UB)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_HOST)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_IO)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_WTIME_IS_GLOBAL)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_APPNUM)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_LASTUSEDCODE)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(MPI_UNIVERSE_SIZE)) ||
|
||||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_BASE)) ||
|
||||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_SIZE)) ||
|
||||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_DISP_UNIT)) ||
|
||||
#if 0
|
||||
/* JMS For when we implement IMPI */
|
||||
OMPI_SUCCESS != (ret = free_comm(IMPI_CLIENT_SIZE)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(IMPI_CLIENT_COLOR)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(IMPI_HOST_SIZE)) ||
|
||||
OMPI_SUCCESS != (ret = free_comm(IMPI_HOST_COLOR)) ||
|
||||
#endif
|
||||
0) {
|
||||
return ret;
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@ -315,6 +346,13 @@ static int create_comm(int target_keyval, bool want_inherit)
|
||||
}
|
||||
|
||||
|
||||
static int free_comm(int keyval)
|
||||
{
|
||||
int key = keyval;
|
||||
return ompi_attr_free_keyval (COMM_ATTR, &key, true);
|
||||
}
|
||||
|
||||
|
||||
static int create_win(int target_keyval)
|
||||
{
|
||||
int err;
|
||||
@ -337,6 +375,13 @@ static int create_win(int target_keyval)
|
||||
}
|
||||
|
||||
|
||||
static int free_win(int keyval)
|
||||
{
|
||||
int key = keyval;
|
||||
return ompi_attr_free_keyval (WIN_ATTR, &key, true);
|
||||
}
|
||||
|
||||
|
||||
static int set_f(int keyval, MPI_Fint value)
|
||||
{
|
||||
return ompi_attr_set_fortran_mpi1(COMM_ATTR, MPI_COMM_WORLD,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user