Skip to content
Snippets Groups Projects
Commit d641f83f authored by Christopher J. Morrone's avatar Christopher J. Morrone
Browse files

Preload all of the normal SLURM plugins used by the slurmstepd. Avoids

the possibility of processes forked from slurmstepd needing to dlopen
plugin libraries.
parent 72de2ead
No related branches found
No related tags found
No related merge requests found
...@@ -236,9 +236,8 @@ done: ...@@ -236,9 +236,8 @@ done:
return retval; return retval;
} }
int mpi_hook_slurmstepd_init (char ***env)
int mpi_hook_slurmstepd_task (const mpi_plugin_task_info_t *job, char ***env) {
{
char *mpi_type = getenvp (*env, "SLURM_MPI_TYPE"); char *mpi_type = getenvp (*env, "SLURM_MPI_TYPE");
debug("mpi type = %s", mpi_type); debug("mpi type = %s", mpi_type);
...@@ -247,6 +246,15 @@ int mpi_hook_slurmstepd_task (const mpi_plugin_task_info_t *job, char ***env) ...@@ -247,6 +246,15 @@ int mpi_hook_slurmstepd_task (const mpi_plugin_task_info_t *job, char ***env)
return SLURM_ERROR; return SLURM_ERROR;
unsetenvp (*env, "SLURM_MPI_TYPE"); unsetenvp (*env, "SLURM_MPI_TYPE");
return SLURM_SUCCESS;
}
int mpi_hook_slurmstepd_task (const mpi_plugin_task_info_t *job, char ***env)
{
if (mpi_hook_slurmstepd_init(env) == SLURM_ERROR)
return SLURM_ERROR;
return (*(g_context->ops.slurmstepd_init))(job, env); return (*(g_context->ops.slurmstepd_init))(job, env);
} }
......
...@@ -74,7 +74,19 @@ typedef struct { ...@@ -74,7 +74,19 @@ typedef struct {
**********************************************************************/ **********************************************************************/
/* /*
* Load the plugin and call the plugin p_mpi_hook_slurmstepd_task() function. * Just load the requested plugin. No explicit calls into the plugin
* once loaded (just the implicit call to the plugin's init() function).
*
* The MPI module type is passed through an environment variable
* SLURM_MPI_TYPE from the client. There is no more official protocol.
* This function will remove SLURM_MPI_TYPE from the environment variable
* array "env", if it exists.
*/
int mpi_hook_slurmstepd_init (char ***env);
/*
* Load the plugin (if not already loaded) and call the plugin
* p_mpi_hook_slurmstepd_task() function.
* *
* This function is called from within each process that will exec() a * This function is called from within each process that will exec() a
* task. The process will be running as the user of the job step at that * task. The process will be running as the user of the job step at that
......
...@@ -294,6 +294,14 @@ static int _slurm_jobacct_fini(void) ...@@ -294,6 +294,14 @@ static int _slurm_jobacct_fini(void)
return rc; return rc;
} }
extern int jobacct_init(void)
{
if (_slurm_jobacct_init() < 0)
return SLURM_ERROR;
return SLURM_SUCCESS;
}
extern int jobacct_g_init_struct(jobacctinfo_t *jobacct, extern int jobacct_g_init_struct(jobacctinfo_t *jobacct,
jobacct_id_t *jobacct_id) jobacct_id_t *jobacct_id)
{ {
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include "src/sacct/sacct_stat.h" #include "src/sacct/sacct_stat.h"
/* common */ /* common */
extern int jobacct_init(void); /* load the plugin */
extern int jobacct_g_init_struct(jobacctinfo_t *jobacct, extern int jobacct_g_init_struct(jobacctinfo_t *jobacct,
jobacct_id_t *jobacct_id); jobacct_id_t *jobacct_id);
/* must free jobacctinfo_t if not NULL */ /* must free jobacctinfo_t if not NULL */
......
...@@ -647,7 +647,14 @@ job_manager(slurmd_job_t *job) ...@@ -647,7 +647,14 @@ job_manager(slurmd_job_t *job)
debug3("Entered job_manager for %u.%u pid=%lu", debug3("Entered job_manager for %u.%u pid=%lu",
job->jobid, job->stepid, (unsigned long) job->jmgr_pid); job->jobid, job->stepid, (unsigned long) job->jmgr_pid);
if (slurm_proctrack_init() != SLURM_SUCCESS) { /*
* Preload plugins.
*/
if (switch_init() != SLURM_SUCCESS
|| slurmd_task_init() != SLURM_SUCCESS
|| mpi_hook_slurmstepd_init(&job->env) != SLURM_SUCCESS
|| slurm_proctrack_init() != SLURM_SUCCESS
|| jobacct_init() != SLURM_SUCCESS) {
rc = SLURM_FAILURE; rc = SLURM_FAILURE;
goto fail1; goto fail1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment