cleanup
This commit was SVN r7414.
Этот коммит содержится в:
родитель
41b6fc166e
Коммит
f71abbf856
@ -275,36 +275,6 @@ static void orte_pls_bproc_waitpid_cb(pid_t wpid, int status, void *data) {
|
|||||||
opal_output(0, "in orte_pls_bproc_waitpid_cb, %d processes left\n",
|
opal_output(0, "in orte_pls_bproc_waitpid_cb, %d processes left\n",
|
||||||
mca_pls_bproc_component.num_procs);
|
mca_pls_bproc_component.num_procs);
|
||||||
}
|
}
|
||||||
if(0 == mca_pls_bproc_component.num_procs &&
|
|
||||||
mca_pls_bproc_component.done_launching) {
|
|
||||||
orte_buffer_t ack;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
OBJ_CONSTRUCT(&ack, orte_buffer_t);
|
|
||||||
rc = orte_dps.pack(&ack, &i, 1, ORTE_BYTE);
|
|
||||||
if(rc != ORTE_SUCCESS) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
for(i = 0; i < mca_pls_bproc_component.num_daemons; i++) {
|
|
||||||
proc = orte_pointer_array_get_item(mca_pls_bproc_component.daemon_names, i);
|
|
||||||
if(NULL == proc) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
rc = mca_oob_send_packed(proc, &ack, MCA_OOB_TAG_BPROC, 0);
|
|
||||||
if (0 > rc) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
}
|
|
||||||
free(proc);
|
|
||||||
}
|
|
||||||
OBJ_DESTRUCT(&ack);
|
|
||||||
while(0 < mca_pls_bproc_component.num_daemons) {
|
|
||||||
opal_condition_wait(&mca_pls_bproc_component.condition,
|
|
||||||
&mca_pls_bproc_component.lock);
|
|
||||||
}
|
|
||||||
mca_pls_bproc_component.done_launching = false;
|
|
||||||
orte_pointer_array_clear(mca_pls_bproc_component.daemon_names);
|
|
||||||
}
|
|
||||||
OPAL_THREAD_UNLOCK(&mca_pls_bproc_component.lock);
|
OPAL_THREAD_UNLOCK(&mca_pls_bproc_component.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,10 +556,12 @@ static int orte_pls_bproc_launch_daemons(orte_cellid_t cellid, char *** envp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* launch the daemons */
|
/* launch the daemons */
|
||||||
|
mca_pls_bproc_component.num_daemons = num_daemons;
|
||||||
rc = bproc_vexecmove(num_daemons, daemon_list, pids, orted_path, argv, *envp);
|
rc = bproc_vexecmove(num_daemons, daemon_list, pids, orted_path, argv, *envp);
|
||||||
if(rc != num_daemons) {
|
if(rc != num_daemons) {
|
||||||
opal_show_help("help-pls-bproc.txt", "daemon-launch-number", true,
|
opal_show_help("help-pls-bproc.txt", "daemon-launch-number", true,
|
||||||
num_daemons, rc, orted_path);
|
num_daemons, rc, orted_path);
|
||||||
|
mca_pls_bproc_component.num_daemons = 0;
|
||||||
rc = ORTE_ERROR;
|
rc = ORTE_ERROR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -637,7 +609,6 @@ static int orte_pls_bproc_launch_daemons(orte_cellid_t cellid, char *** envp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mca_pls_bproc_component.num_daemons = num_daemons;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if(NULL != argv) {
|
if(NULL != argv) {
|
||||||
@ -649,7 +620,6 @@ cleanup:
|
|||||||
if(NULL != orted_path) {
|
if(NULL != orted_path) {
|
||||||
free(orted_path);
|
free(orted_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +768,6 @@ cleanup:
|
|||||||
int orte_pls_bproc_launch(orte_jobid_t jobid) {
|
int orte_pls_bproc_launch(orte_jobid_t jobid) {
|
||||||
opal_list_item_t* item;
|
opal_list_item_t* item;
|
||||||
opal_list_t mapping;
|
opal_list_t mapping;
|
||||||
orte_buffer_t ack;
|
|
||||||
orte_cellid_t cellid;
|
orte_cellid_t cellid;
|
||||||
orte_rmaps_base_map_t* map;
|
orte_rmaps_base_map_t* map;
|
||||||
orte_vpid_t vpid_launch;
|
orte_vpid_t vpid_launch;
|
||||||
@ -812,8 +781,6 @@ int orte_pls_bproc_launch(orte_jobid_t jobid) {
|
|||||||
int context = 0;
|
int context = 0;
|
||||||
size_t idx, j;
|
size_t idx, j;
|
||||||
|
|
||||||
OBJ_CONSTRUCT(&ack, orte_buffer_t);
|
|
||||||
|
|
||||||
/* query for the application context and allocated nodes */
|
/* query for the application context and allocated nodes */
|
||||||
OBJ_CONSTRUCT(&mapping, opal_list_t);
|
OBJ_CONSTRUCT(&mapping, opal_list_t);
|
||||||
if(ORTE_SUCCESS != (rc = orte_rmaps_base_get_map(jobid, &mapping))) {
|
if(ORTE_SUCCESS != (rc = orte_rmaps_base_get_map(jobid, &mapping))) {
|
||||||
@ -871,9 +838,12 @@ int orte_pls_bproc_launch(orte_jobid_t jobid) {
|
|||||||
* sucessfully set up the pty/pipes and IO forwarding which the user apps
|
* sucessfully set up the pty/pipes and IO forwarding which the user apps
|
||||||
* will use */
|
* will use */
|
||||||
for(j = 0; j < mca_pls_bproc_component.num_daemons; j++) {
|
for(j = 0; j < mca_pls_bproc_component.num_daemons; j++) {
|
||||||
|
orte_buffer_t ack;
|
||||||
|
OBJ_CONSTRUCT(&ack, orte_buffer_t);
|
||||||
rc = mca_oob_recv_packed(MCA_OOB_NAME_ANY, &ack, MCA_OOB_TAG_BPROC);
|
rc = mca_oob_recv_packed(MCA_OOB_NAME_ANY, &ack, MCA_OOB_TAG_BPROC);
|
||||||
if(0 > rc) {
|
if(0 > rc) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
|
OBJ_DESTRUCT(&ack);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
idx = 4;
|
idx = 4;
|
||||||
@ -881,6 +851,8 @@ int orte_pls_bproc_launch(orte_jobid_t jobid) {
|
|||||||
if(ORTE_SUCCESS != rc) {
|
if(ORTE_SUCCESS != rc) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
}
|
}
|
||||||
|
OBJ_DESTRUCT(&ack);
|
||||||
|
|
||||||
if(-1 == src[0]) {
|
if(-1 == src[0]) {
|
||||||
/* one of the daemons has failed to properly launch. The error is sent
|
/* one of the daemons has failed to properly launch. The error is sent
|
||||||
* by orte_pls_bproc_waitpid_daemon_cb */
|
* by orte_pls_bproc_waitpid_daemon_cb */
|
||||||
@ -929,7 +901,6 @@ cleanup:
|
|||||||
free(node_array_len);
|
free(node_array_len);
|
||||||
}
|
}
|
||||||
OBJ_DESTRUCT(&mapping);
|
OBJ_DESTRUCT(&mapping);
|
||||||
OBJ_DESTRUCT(&ack);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,8 +68,6 @@ static int pls_bproc_orted_link_pipes(int proc_rank, orte_jobid_t jobid, int * f
|
|||||||
bool connect_stdin, size_t app_context);
|
bool connect_stdin, size_t app_context);
|
||||||
static void pls_bproc_orted_delete_dir_tree(char * path);
|
static void pls_bproc_orted_delete_dir_tree(char * path);
|
||||||
static int pls_bproc_orted_remove_dir(void);
|
static int pls_bproc_orted_remove_dir(void);
|
||||||
static void pls_bproc_orted_kill_cb(int status, orte_process_name_t * peer,
|
|
||||||
orte_buffer_t* buffer, int tag, void* cbdata);
|
|
||||||
static void pls_bproc_orted_send_cb(int status, orte_process_name_t * peer,
|
static void pls_bproc_orted_send_cb(int status, orte_process_name_t * peer,
|
||||||
orte_buffer_t* buffer, int tag, void* cbdata);
|
orte_buffer_t* buffer, int tag, void* cbdata);
|
||||||
|
|
||||||
@ -357,22 +355,6 @@ static int pls_bproc_orted_remove_dir() {
|
|||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback function for when mpirun sends us a message saying all the child
|
|
||||||
* procs are done.
|
|
||||||
* @param status
|
|
||||||
* @param peer
|
|
||||||
* @param buffer
|
|
||||||
* @param tag
|
|
||||||
* @param cbdata
|
|
||||||
*/
|
|
||||||
static void pls_bproc_orted_kill_cb(int status, orte_process_name_t * peer,
|
|
||||||
orte_buffer_t* buffer, int tag, void* cbdata) {
|
|
||||||
OPAL_THREAD_LOCK(&mca_pls_bproc_orted_component.lock);
|
|
||||||
opal_condition_signal(&mca_pls_bproc_orted_component.condition);
|
|
||||||
OPAL_THREAD_UNLOCK(&mca_pls_bproc_orted_component.lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function for when we tell mpirun we are ready
|
* Callback function for when we tell mpirun we are ready
|
||||||
* @param status
|
* @param status
|
||||||
@ -382,7 +364,9 @@ static void pls_bproc_orted_kill_cb(int status, orte_process_name_t * peer,
|
|||||||
* @param cbdata
|
* @param cbdata
|
||||||
*/
|
*/
|
||||||
static void pls_bproc_orted_send_cb(int status, orte_process_name_t * peer,
|
static void pls_bproc_orted_send_cb(int status, orte_process_name_t * peer,
|
||||||
orte_buffer_t* buffer, int tag, void* cbdata) {
|
orte_buffer_t* buffer, int tag, void* cbdata)
|
||||||
|
{
|
||||||
|
OBJ_RELEASE(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -402,7 +386,7 @@ int orte_pls_bproc_orted_launch(orte_jobid_t jobid) {
|
|||||||
int num_procs = 0;
|
int num_procs = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
int src = 0;
|
int src = 0;
|
||||||
orte_buffer_t ack;
|
orte_buffer_t *ack;
|
||||||
char * param;
|
char * param;
|
||||||
bool connect_stdin;
|
bool connect_stdin;
|
||||||
char * pty_name = NULL;
|
char * pty_name = NULL;
|
||||||
@ -413,7 +397,6 @@ int orte_pls_bproc_orted_launch(orte_jobid_t jobid) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
OBJ_CONSTRUCT(&ack, orte_buffer_t);
|
|
||||||
|
|
||||||
rc = bproc_currnode();
|
rc = bproc_currnode();
|
||||||
if(0 > rc) {
|
if(0 > rc) {
|
||||||
@ -503,20 +486,14 @@ int orte_pls_bproc_orted_launch(orte_jobid_t jobid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* post recieve for termination signal */
|
/* message to indicate that we are ready */
|
||||||
rc = mca_oob_recv_packed_nb(MCA_OOB_NAME_SEED, MCA_OOB_TAG_BPROC, 0,
|
ack = OBJ_NEW(orte_buffer_t);
|
||||||
pls_bproc_orted_kill_cb, NULL);
|
rc = orte_dps.pack(ack, &src, 1, ORTE_INT);
|
||||||
if (0 > rc) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
/* do callback to say we are ready */
|
|
||||||
rc = orte_dps.pack(&ack, &src, 1, ORTE_INT);
|
|
||||||
if(ORTE_SUCCESS != rc) {
|
if(ORTE_SUCCESS != rc) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
}
|
}
|
||||||
rc = mca_oob_send_packed_nb(MCA_OOB_NAME_SEED, &ack, MCA_OOB_TAG_BPROC, 0,
|
rc = mca_oob_send_packed_nb(MCA_OOB_NAME_SEED, ack, MCA_OOB_TAG_BPROC, 0,
|
||||||
pls_bproc_orted_send_cb, NULL);
|
pls_bproc_orted_send_cb, NULL);
|
||||||
if (0 > rc) {
|
if (0 > rc) {
|
||||||
ORTE_ERROR_LOG(rc);
|
ORTE_ERROR_LOG(rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -531,7 +508,6 @@ cleanup:
|
|||||||
free(pty_name);
|
free(pty_name);
|
||||||
}
|
}
|
||||||
OBJ_DESTRUCT(&map);
|
OBJ_DESTRUCT(&map);
|
||||||
OBJ_DESTRUCT(&ack);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +518,8 @@ cleanup:
|
|||||||
* @param jobid The job to terminate
|
* @param jobid The job to terminate
|
||||||
* @retval ORTE_SUCCESS
|
* @retval ORTE_SUCCESS
|
||||||
*/
|
*/
|
||||||
int orte_pls_bproc_orted_terminate_job(orte_jobid_t jobid) {
|
int orte_pls_bproc_orted_terminate_job(orte_jobid_t jobid)
|
||||||
|
{
|
||||||
orte_iof.iof_flush();
|
orte_iof.iof_flush();
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -554,28 +531,21 @@ int orte_pls_bproc_orted_terminate_job(orte_jobid_t jobid) {
|
|||||||
* @param proc the process's name
|
* @param proc the process's name
|
||||||
* @retval ORTE_SUCCESS
|
* @retval ORTE_SUCCESS
|
||||||
*/
|
*/
|
||||||
int orte_pls_bproc_orted_terminate_proc(const orte_process_name_t* proc) {
|
int orte_pls_bproc_orted_terminate_proc(const orte_process_name_t* proc)
|
||||||
|
{
|
||||||
orte_iof.iof_flush();
|
orte_iof.iof_flush();
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalizes the bproc_orted module. This function simply blocks on a condition
|
* Finalizes the bproc_orted module. Cleanup tmp directory/files
|
||||||
* until we get a message from the seed telling us the user processes are done
|
* used for I/O forwarding.
|
||||||
* so we can now terminate.
|
|
||||||
* @retval ORTE_SUCCESS
|
* @retval ORTE_SUCCESS
|
||||||
*/
|
*/
|
||||||
int orte_pls_bproc_orted_finalize(void) {
|
int orte_pls_bproc_orted_finalize(void)
|
||||||
OPAL_THREAD_LOCK(&mca_pls_bproc_orted_component.lock);
|
{
|
||||||
opal_condition_wait(&mca_pls_bproc_orted_component.condition,
|
|
||||||
&mca_pls_bproc_orted_component.lock);
|
|
||||||
orte_iof.iof_flush();
|
|
||||||
pls_bproc_orted_remove_dir();
|
pls_bproc_orted_remove_dir();
|
||||||
orte_session_dir_finalize(orte_process_info.my_name);
|
orte_session_dir_finalize(orte_process_info.my_name);
|
||||||
if(mca_pls_bproc_orted_component.debug) {
|
|
||||||
opal_output(0, "pls_bproc_orted: all cleanup routines called\n");
|
|
||||||
}
|
|
||||||
OPAL_THREAD_UNLOCK(&mca_pls_bproc_orted_component.lock);
|
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +67,6 @@ struct orte_pls_bproc_orted_component_t {
|
|||||||
* that bproc is available and running on this node, */
|
* that bproc is available and running on this node, */
|
||||||
opal_mutex_t lock;
|
opal_mutex_t lock;
|
||||||
/**< Lock used to prevent some race conditions */
|
/**< Lock used to prevent some race conditions */
|
||||||
opal_condition_t condition;
|
|
||||||
/**< Condition that is signaled when we have recieved a message from
|
|
||||||
* the seed that it is time to terminate. */
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Convenience typedef
|
* Convenience typedef
|
||||||
|
@ -64,7 +64,6 @@ int orte_pls_bproc_orted_component_open(void)
|
|||||||
{
|
{
|
||||||
/* initialize globals */
|
/* initialize globals */
|
||||||
OBJ_CONSTRUCT(&mca_pls_bproc_orted_component.lock, opal_mutex_t);
|
OBJ_CONSTRUCT(&mca_pls_bproc_orted_component.lock, opal_mutex_t);
|
||||||
OBJ_CONSTRUCT(&mca_pls_bproc_orted_component.condition, opal_condition_t);
|
|
||||||
|
|
||||||
/* lookup parameters */
|
/* lookup parameters */
|
||||||
mca_base_param_reg_int(&mca_pls_bproc_orted_component.super.pls_version,
|
mca_base_param_reg_int(&mca_pls_bproc_orted_component.super.pls_version,
|
||||||
@ -110,7 +109,6 @@ orte_pls_base_module_t *orte_pls_bproc_orted_init(int *priority)
|
|||||||
int orte_pls_bproc_orted_component_close(void)
|
int orte_pls_bproc_orted_component_close(void)
|
||||||
{
|
{
|
||||||
OBJ_DESTRUCT(&mca_pls_bproc_orted_component.lock);
|
OBJ_DESTRUCT(&mca_pls_bproc_orted_component.lock);
|
||||||
OBJ_DESTRUCT(&mca_pls_bproc_orted_component.condition);
|
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user