1
1

Fix some memory problems. This will temporarily break comm_spawn again - Tim needs to grab this to take a look at something in connect_accept.

This commit was SVN r3772.
Этот коммит содержится в:
Ralph Castain 2004-12-10 16:27:09 +00:00
родитель 0d76949743
Коммит 65f874c556
8 изменённых файлов: 110 добавлений и 86 удалений

Просмотреть файл

@ -367,7 +367,8 @@ int mca_gpr_replica_subscribe_nl(ompi_registry_mode_t addr_mode,
mca_gpr_replica_segment_t *seg,
mca_gpr_replica_key_t *keys,
int num_keys,
ompi_registry_notify_id_t id_tag);
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t owning_jobid);
int mca_gpr_replica_unsubscribe(ompi_registry_notify_id_t sub_number);
ompi_registry_notify_id_t mca_gpr_replica_unsubscribe_nl(ompi_registry_notify_id_t sub_number);
@ -385,7 +386,8 @@ int mca_gpr_replica_synchro_nl(ompi_registry_synchro_mode_t synchro_mode,
mca_gpr_replica_key_t *keys,
int num_keys,
int trigger,
ompi_registry_notify_id_t id_tag);
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t owning_jobid);
int mca_gpr_replica_cancel_synchro(ompi_registry_notify_id_t synch_number);
ompi_registry_notify_id_t mca_gpr_replica_cancel_synchro_nl(ompi_registry_notify_id_t synch_number);

Просмотреть файл

@ -104,7 +104,8 @@ mca_gpr_replica_trigger_list_t
mca_gpr_replica_key_t *keys,
int num_keys,
int trigger,
ompi_registry_notify_id_t id_tag);
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t owning_jobid);
ompi_registry_notify_message_t
*mca_gpr_replica_construct_notify_message(mca_gpr_replica_segment_t *seg,

Просмотреть файл

@ -34,7 +34,8 @@ mca_gpr_replica_construct_trigger(ompi_registry_synchro_mode_t synchro_mode,
mca_gpr_replica_key_t *keys,
int num_keys,
int trigger,
ompi_registry_notify_id_t id_tag)
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t owning_jobid)
{
mca_gpr_replica_core_t *reg;
mca_gpr_replica_trigger_list_t *trig;
@ -47,6 +48,7 @@ mca_gpr_replica_construct_trigger(ompi_registry_synchro_mode_t synchro_mode,
trig->synch_mode = synchro_mode;
trig->action = action;
trig->addr_mode = addr_mode;
trig->owning_job = owning_jobid;
trig->trigger = trigger;
trig->count = 0;
trig->local_idtag = id_tag;

Просмотреть файл

@ -777,7 +777,7 @@ static int32_t mca_gpr_replica_recv_delete_object_cmd(ompi_buffer_t buffer)
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
/* locate the segment */
seg = mca_gpr_replica_find_seg(false, segment, ompi_name_server.get_jobid(ompi_rte_get_self()));
seg = mca_gpr_replica_find_seg(false, segment, MCA_NS_BASE_JOBID_MAX);
if (NULL == seg) {
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
return OMPI_ERROR;
@ -868,6 +868,7 @@ static ompi_registry_notify_id_t mca_gpr_replica_recv_subscribe_cmd(ompi_process
int num_keys=0;
int32_t num_tokens=0, response=(int32_t)OMPI_ERROR;
int i=0;
mca_ns_base_jobid_t owning_jobid;
return_tag = OMPI_REGISTRY_NOTIFY_ID_MAX;
@ -905,13 +906,19 @@ static ompi_registry_notify_id_t mca_gpr_replica_recv_subscribe_cmd(ompi_process
goto RETURN_ERROR;
}
if (NULL != sender) {
owning_jobid = ompi_name_server.get_jobid(sender);
} else {
owning_jobid = ompi_name_server.get_jobid(ompi_rte_get_self());
}
/******* LOCK *****/
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
seg = mca_gpr_replica_find_seg(true, segment, ompi_name_server.get_jobid(ompi_rte_get_self()));
seg = mca_gpr_replica_find_seg(true, segment, owning_jobid);
if (NULL == seg) { /* segment couldn't be found */
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
goto RETURN_ERROR;
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
goto RETURN_ERROR;
}
/* convert tokens to keys */
@ -928,14 +935,14 @@ static ompi_registry_notify_id_t mca_gpr_replica_recv_subscribe_cmd(ompi_process
local_idtag1 = mca_gpr_replica_enter_notify_request(seg, action, sender, id_tag, NULL, NULL);
response = (int32_t)mca_gpr_replica_subscribe_nl(mode, action, seg, keys, num_keys,
local_idtag1);
local_idtag1, owning_jobid);
if (OMPI_SUCCESS == response) {
return_tag = local_idtag1;
}
} else { /* local sender - id_tag is for local notify tracking system*/
response = (int32_t)mca_gpr_replica_subscribe_nl(mode, action, seg,
keys, num_keys, id_tag);
keys, num_keys, id_tag, owning_jobid);
if (OMPI_SUCCESS == response) {
return_tag = id_tag;
}
@ -998,6 +1005,7 @@ static ompi_registry_notify_id_t mca_gpr_replica_recv_synchro_cmd(ompi_process_n
int num_keys=0;
int32_t num_tokens=0, response=(int32_t)OMPI_ERROR, synchro_mode=0, trigger=0;
int i=0;
mca_ns_base_jobid_t owning_jobid;
return_tag = OMPI_REGISTRY_NOTIFY_ID_MAX;
@ -1043,41 +1051,47 @@ static ompi_registry_notify_id_t mca_gpr_replica_recv_synchro_cmd(ompi_process_n
goto RETURN_ERROR;
}
if (NULL != sender) {
owning_jobid = ompi_name_server.get_jobid(sender);
} else {
owning_jobid = ompi_name_server.get_jobid(ompi_rte_get_self());
}
/******* LOCK *****/
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
seg = mca_gpr_replica_find_seg(true, segment, ompi_name_server.get_jobid(ompi_rte_get_self()));
seg = mca_gpr_replica_find_seg(true, segment, owning_jobid);
if (NULL == seg) { /* segment couldn't be found */
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
goto RETURN_ERROR;
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
goto RETURN_ERROR;
}
/* convert tokens to keys */
keys = mca_gpr_replica_get_key_list(seg, tokens, &num_keys);
if (NULL != sender) { /* remote sender */
/* enter request on local notify tracking system */
local_idtag1 = mca_gpr_replica_enter_notify_request(seg,
OMPI_REGISTRY_NOTIFY_NONE, sender,
id_tag, NULL, NULL);
response = (int32_t)mca_gpr_replica_synchro_nl(synchro_mode,
mode, seg, keys, num_keys,
trigger, local_idtag1);
if (OMPI_SUCCESS == response) {
return_tag = local_idtag1;
}
/* enter request on local notify tracking system */
local_idtag1 = mca_gpr_replica_enter_notify_request(seg,
OMPI_REGISTRY_NOTIFY_NONE, sender,
id_tag, NULL, NULL);
response = (int32_t)mca_gpr_replica_synchro_nl(synchro_mode,
mode, seg, keys, num_keys,
trigger, local_idtag1, owning_jobid);
if (OMPI_SUCCESS == response) {
return_tag = local_idtag1;
}
} else { /* local sender - id_tag already on local notify tracking system */
response = (int32_t)mca_gpr_replica_synchro_nl(synchro_mode,
mode, seg, keys, num_keys,
trigger, id_tag);
if (OMPI_SUCCESS == response) {
return_tag = id_tag;
}
response = (int32_t)mca_gpr_replica_synchro_nl(synchro_mode,
mode, seg, keys, num_keys,
trigger, id_tag, owning_jobid);
if (OMPI_SUCCESS == response) {
return_tag = id_tag;
}
}
mca_gpr_replica_check_synchros(seg);

Просмотреть файл

@ -37,33 +37,36 @@ mca_gpr_replica_subscribe(ompi_registry_mode_t addr_mode,
mca_gpr_replica_segment_t *seg;
mca_gpr_replica_key_t *keys;
int num_keys;
mca_ns_base_jobid_t my_jobid;
/* protect against errors */
if (NULL == segment) {
return OMPI_REGISTRY_NOTIFY_ID_MAX;
}
seg = mca_gpr_replica_find_seg(true, segment, ompi_name_server.get_jobid(ompi_rte_get_self()));
my_jobid = ompi_name_server.get_jobid(ompi_rte_get_self());
seg = mca_gpr_replica_find_seg(true, segment, my_jobid);
if (NULL == seg) { /* segment couldn't be found or created */
return OMPI_REGISTRY_NOTIFY_ID_MAX;
}
if (mca_gpr_replica_compound_cmd_mode) {
mca_gpr_base_pack_subscribe(mca_gpr_replica_compound_cmd,
addr_mode, action,
segment, tokens);
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
/* enter request on notify tracking system */
local_idtag = mca_gpr_replica_enter_notify_request(seg, action, NULL, 0, cb_func, user_tag);
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
ompi_pack(mca_gpr_replica_compound_cmd, &local_idtag, 1, OMPI_INT32);
return local_idtag;
mca_gpr_base_pack_subscribe(mca_gpr_replica_compound_cmd,
addr_mode, action,
segment, tokens);
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
/* enter request on notify tracking system */
local_idtag = mca_gpr_replica_enter_notify_request(seg, action, NULL, 0, cb_func, user_tag);
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
ompi_pack(mca_gpr_replica_compound_cmd, &local_idtag, 1, OMPI_INT32);
return local_idtag;
}
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
@ -76,7 +79,7 @@ mca_gpr_replica_subscribe(ompi_registry_mode_t addr_mode,
/* register subscription */
rc = mca_gpr_replica_subscribe_nl(addr_mode, action, seg,
keys, num_keys, local_idtag);
keys, num_keys, local_idtag, my_jobid);
/* check subscriptions */
mca_gpr_replica_check_subscriptions(seg, MCA_GPR_REPLICA_SUBSCRIBER_ADDED);
@ -98,7 +101,8 @@ int mca_gpr_replica_subscribe_nl(ompi_registry_mode_t addr_mode,
mca_gpr_replica_segment_t *seg,
mca_gpr_replica_key_t *keys,
int num_keys,
ompi_registry_notify_id_t id_tag)
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t jobid)
{
mca_gpr_replica_trigger_list_t *trig;
ompi_registry_notify_message_t *notify_msg;
@ -112,17 +116,17 @@ int mca_gpr_replica_subscribe_nl(ompi_registry_mode_t addr_mode,
/* construct the trigger */
if (NULL != (trig = mca_gpr_replica_construct_trigger(OMPI_REGISTRY_SYNCHRO_MODE_NONE, action,
addr_mode, seg, keys, num_keys,
0, id_tag))) {
0, id_tag, jobid))) {
if ((OMPI_REGISTRY_NOTIFY_PRE_EXISTING & action) && seg->triggers_active) { /* want list of everything there */
notify_msg = mca_gpr_replica_construct_notify_message(seg, trig);
notify_msg->trig_action = action;
notify_msg->trig_synchro = OMPI_REGISTRY_SYNCHRO_MODE_NONE;
mca_gpr_replica_process_triggers(seg, trig, notify_msg);
}
return OMPI_SUCCESS;
if ((OMPI_REGISTRY_NOTIFY_PRE_EXISTING & action) && seg->triggers_active) { /* want list of everything there */
notify_msg = mca_gpr_replica_construct_notify_message(seg, trig);
notify_msg->trig_action = action;
notify_msg->trig_synchro = OMPI_REGISTRY_SYNCHRO_MODE_NONE;
mca_gpr_replica_process_triggers(seg, trig, notify_msg);
}
return OMPI_SUCCESS;
} else {
return OMPI_ERROR;
return OMPI_ERROR;
}
}

Просмотреть файл

@ -37,34 +37,37 @@ mca_gpr_replica_synchro(ompi_registry_synchro_mode_t synchro_mode,
mca_gpr_replica_segment_t *seg;
mca_gpr_replica_key_t *keys;
int num_keys;
mca_ns_base_jobid_t my_jobid;
/* protect against errors */
if (NULL == segment) {
return OMPI_REGISTRY_NOTIFY_ID_MAX;
}
seg = mca_gpr_replica_find_seg(true, segment, ompi_name_server.get_jobid(ompi_rte_get_self()));
my_jobid = ompi_name_server.get_jobid(ompi_rte_get_self());
seg = mca_gpr_replica_find_seg(true, segment, my_jobid);
if (NULL == seg) { /* segment couldn't be found */
return OMPI_REGISTRY_NOTIFY_ID_MAX;
}
if (mca_gpr_replica_compound_cmd_mode) {
mca_gpr_base_pack_synchro(mca_gpr_replica_compound_cmd,
synchro_mode, addr_mode,
segment, tokens, trigger);
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
/* enter request on notify tracking system */
local_idtag = mca_gpr_replica_enter_notify_request(seg, OMPI_REGISTRY_NOTIFY_NONE,
NULL, 0, cb_func, user_tag);
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
ompi_pack(mca_gpr_replica_compound_cmd, &local_idtag, 1, OMPI_INT32);
return local_idtag;
mca_gpr_base_pack_synchro(mca_gpr_replica_compound_cmd,
synchro_mode, addr_mode,
segment, tokens, trigger);
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
/* enter request on notify tracking system */
local_idtag = mca_gpr_replica_enter_notify_request(seg, OMPI_REGISTRY_NOTIFY_NONE,
NULL, 0, cb_func, user_tag);
OMPI_THREAD_UNLOCK(&mca_gpr_replica_mutex);
ompi_pack(mca_gpr_replica_compound_cmd, &local_idtag, 1, OMPI_INT32);
return local_idtag;
}
OMPI_THREAD_LOCK(&mca_gpr_replica_mutex);
@ -78,7 +81,7 @@ mca_gpr_replica_synchro(ompi_registry_synchro_mode_t synchro_mode,
/* process synchro request */
rc = mca_gpr_replica_synchro_nl(synchro_mode, addr_mode,
seg, keys, num_keys, trigger, local_idtag);
seg, keys, num_keys, trigger, local_idtag, my_jobid);
mca_gpr_replica_check_synchros(seg);
@ -99,7 +102,8 @@ int mca_gpr_replica_synchro_nl(ompi_registry_synchro_mode_t synchro_mode,
mca_gpr_replica_key_t *keys,
int num_keys,
int trigger,
ompi_registry_notify_id_t id_tag)
ompi_registry_notify_id_t id_tag,
mca_ns_base_jobid_t jobid)
{
mca_gpr_replica_trigger_list_t *trig;
@ -112,10 +116,10 @@ int mca_gpr_replica_synchro_nl(ompi_registry_synchro_mode_t synchro_mode,
if (NULL != (trig = mca_gpr_replica_construct_trigger(synchro_mode,
OMPI_REGISTRY_NOTIFY_NONE,
addr_mode, seg, keys, num_keys,
trigger, id_tag))) {
return OMPI_SUCCESS;
trigger, id_tag, jobid))) {
return OMPI_SUCCESS;
} else {
return OMPI_ERROR;
return OMPI_ERROR;
}
}

Просмотреть файл

@ -61,7 +61,6 @@ OMPI_DECLSPEC extern ompi_process_name_t mca_oob_name_self;
/**
* Service tags
*/
#define MCA_OOB_TAG_XCAST -1
#define MCA_OOB_TAG_NS 1
#define MCA_OOB_TAG_GPR 2
#define MCA_OOB_TAG_GPR_NOTIFY 3
@ -71,6 +70,7 @@ OMPI_DECLSPEC extern ompi_process_name_t mca_oob_name_self;
#define MCA_OOB_TAG_STDIO 7
#define MCA_OOB_TAG_SCHED 8
#define MCA_OOB_TAG_PCM_KILL 9
#define MCA_OOB_TAG_XCAST 10
#define MCA_OOB_TAG_USER 1000 /* user defined tags should be assigned above this level */
/*

Просмотреть файл

@ -108,9 +108,6 @@ ompi_rte_vm_status_t
/* transfer ownership of registry object to buffer and unpack */
ompi_buffer_init_preallocated(&buffer, value->object, value->object_size);
value->object = NULL;
value->object_size = 0;
OBJ_RELEASE(value);
ompi_unpack(buffer, &stat_ptr->cell, 1, OMPI_CELLID);
ompi_unpack_string(buffer, &stat_ptr->nodename);