From 9dcb3ff47d62cd3ef4399cbed88a88effd5f01e8 Mon Sep 17 00:00:00 2001 From: Pierre Lindenbaum <plindenbaum@yahoo.fr> Date: Thu, 4 Sep 2014 08:45:35 -0700 Subject: [PATCH] Add patch for integration with make v4.0 renamed the patch for make 3.81 and added a patch for gnu make 4.0 --- contribs/Makefile.am | 2 + contribs/Makefile.in | 3 +- contribs/README | 5 +- ...make.slurm.patch => make-3.81.slurm.patch} | 0 contribs/make-4.0.slurm.patch | 60 +++++++++++++++++++ doc/html/team.shtml | 1 + 6 files changed, 68 insertions(+), 3 deletions(-) rename contribs/{make.slurm.patch => make-3.81.slurm.patch} (100%) create mode 100644 contribs/make-4.0.slurm.patch diff --git a/contribs/Makefile.am b/contribs/Makefile.am index 287e2c22ce8..be824a4d607 100644 --- a/contribs/Makefile.am +++ b/contribs/Makefile.am @@ -2,6 +2,8 @@ SUBDIRS = cray lua pam perlapi torque sgather sjobexit slurmdb-direct pmi2 EXTRA_DIST = \ env_cache_builder.c \ + make-3.81.slurm.patch \ + make-4.0.slurm.patch \ make.slurm.patch \ mpich1.slurm.patch \ ptrace.patch \ diff --git a/contribs/Makefile.in b/contribs/Makefile.in index fc9ffc4019e..b9fedf0e8dd 100644 --- a/contribs/Makefile.in +++ b/contribs/Makefile.in @@ -447,7 +447,8 @@ top_srcdir = @top_srcdir@ SUBDIRS = cray lua pam perlapi torque sgather sjobexit slurmdb-direct pmi2 EXTRA_DIST = \ env_cache_builder.c \ - make.slurm.patch \ + make-3.81.slurm.patch \ + make-4.0.slurm.patch \ mpich1.slurm.patch \ ptrace.patch \ sgather \ diff --git a/contribs/README b/contribs/README index eb28925c0ef..febe1c6109b 100644 --- a/contribs/README +++ b/contribs/README @@ -47,14 +47,15 @@ of the SLURM contribs distribution follows: proctrack.lua - proctrack (process tracking) plugin that implements a very simple job step container using CPUSETs - make.slurm.patch [ Patch to "make" command for parallel build ] + make-3.81.slurm.patch [ Patch to "make" command for parallel build ] + make-4.0.slurm.patch [ Patch to "make" command for parallel build ] This patch will use SLURM to launch tasks across a job's current resource allocation. Depending upon the size of modules to be compiled, this may or may not improve performance. If most modules are thousands of lines long, the use of additional resources should more than compensate for the overhead of SLURM's task launch. Use with make's "-j" option within an existing SLURM allocation. Outside of a SLURM allocation, make's behavior - will be unchanged. Designed for GNU make-3.81. + will be unchanged. Designed for GNU make-3.81 or make-4.0. mic [Tools for use on Intel MIC processors] diff --git a/contribs/make.slurm.patch b/contribs/make-3.81.slurm.patch similarity index 100% rename from contribs/make.slurm.patch rename to contribs/make-3.81.slurm.patch diff --git a/contribs/make-4.0.slurm.patch b/contribs/make-4.0.slurm.patch new file mode 100644 index 00000000000..6983373f460 --- /dev/null +++ b/contribs/make-4.0.slurm.patch @@ -0,0 +1,60 @@ +diff --git a/README b/README +index 8b10c42..9e52eb8 100644 +--- a/README ++++ b/README +@@ -136,6 +136,18 @@ system contains rules that depend on proper behavior of tools like "cp + force make to treat them properly. See the manual for details. + + ++SLURM ++----- ++ ++This patch will use SLURM to launch tasks across a job's current resource ++allocation. Depending upon the size of modules to be compiled, this may ++or may not improve performance. If most modules are thousands of lines ++long, the use of additional resources should more than compensate for the ++overhead of SLURM's task launch. Use with make's "-j" option within an ++existing SLURM allocation. Outside of a SLURM allocation, make's behavior ++will be unchanged. Designed for GNU make-4.0. ++ ++ + Ports + ----- + +diff --git a/job.c b/job.c +index febfac0..eea50f1 100644 +--- a/job.c ++++ b/job.c +@@ -2269,6 +2269,23 @@ void + child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd, + char **argv, char **envp) + { ++ char** argx=NULL; ++ /* PARALLEL JOB LAUNCH VIA SLURM */ ++ if (getenv("SLURM_JOB_ID")) { ++ unsigned int i, argc=4; ++ for (i=0; argv[i] != NULL ; i++) argc++; ++ argx = (char**) xmalloc( sizeof(char*)*( argc )); ++ argx[0] = "srun"; ++ argx[1] = "-N1"; ++ argx[2] = "-n1"; ++ for (i=0; argv[i] != NULL ; i++) { ++ argx[i+3] = argv[i]; ++ } ++ argx[ argc -1 ] = NULL; ++ argv = argx; ++ } ++/* END OF SLURM PATCH */ ++ + /* For any redirected FD, dup2() it to the standard FD then close it. */ + if (stdin_fd != FD_STDIN) + { +@@ -2288,6 +2305,8 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd, + + /* Run the command. */ + exec_command (argv, envp); ++ ++ free(argx); + } + #endif /* !AMIGA && !__MSDOS__ && !VMS */ + #endif /* !WINDOWS32 */ diff --git a/doc/html/team.shtml b/doc/html/team.shtml index c18330fd62f..59364a5bfd8 100644 --- a/doc/html/team.shtml +++ b/doc/html/team.shtml @@ -122,6 +122,7 @@ Lead Slurm developers are: <li>Piotr Lesnicki (Bull)</li> <li>Bernard Li (Genome Sciences Centre, Canada)</li> <li>Eric Lin (Bull)</li> +<li>Pierre Lindenbaum (L'Insitut du Thorax, France)</li> <li>Donald Lipari (Lawrence Livermore National Laboratory)</li> <br> <li>Komoto Masahiro</li> -- GitLab