| 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**) malloc( 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 */ |