pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

slurm: Add imported patch files and enable script



Module Name:	pkgsrc-wip
Committed By:	Jason Bacon <bacon4000%gmail.com@localhost>
Pushed By:	outpaddling
Date:		Thu Feb 22 17:10:23 2018 -0600
Changeset:	043d974b6510ac3e5e315f682c13e9faad9e5fb5

Added Files:
	slurm/files/linux-slurm-enable
	slurm/patches/patch-etc_init.d.slurm.in
	slurm/patches/patch-src_slurmd_common_task__plugin.c
	slurm/patches/patch-src_slurmd_common_task__plugin.h
	slurm/patches/patch-src_slurmd_slurmd_slurmd.c
	slurm/patches/patch-src_slurmd_slurmd_slurmd.h
	slurm/patches/patch-src_slurmd_slurmstepd_io.c
	slurm/patches/patch-src_slurmd_slurmstepd_task.c
Removed Files:
	slurm/patches/patch-src_common_gres.c

Log Message:
slurm: Add imported patch files and enable script

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=043d974b6510ac3e5e315f682c13e9faad9e5fb5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 slurm/files/linux-slurm-enable                     | 64 ++++++++++++++++++++++
 slurm/patches/patch-etc_init.d.slurm.in            | 16 ++++++
 slurm/patches/patch-src_common_gres.c              | 14 -----
 .../patches/patch-src_slurmd_common_task__plugin.c | 28 ++++++++++
 .../patches/patch-src_slurmd_common_task__plugin.h | 21 +++++++
 slurm/patches/patch-src_slurmd_slurmd_slurmd.c     | 27 +++++++++
 slurm/patches/patch-src_slurmd_slurmd_slurmd.h     | 21 +++++++
 slurm/patches/patch-src_slurmd_slurmstepd_io.c     | 12 ++++
 slurm/patches/patch-src_slurmd_slurmstepd_task.c   | 25 +++++++++
 9 files changed, 214 insertions(+), 14 deletions(-)

diffs:
diff --git a/slurm/files/linux-slurm-enable b/slurm/files/linux-slurm-enable
new file mode 100644
index 0000000000..b162759003
--- /dev/null
+++ b/slurm/files/linux-slurm-enable
@@ -0,0 +1,64 @@
+#!/bin/sh -e
+
+##########################################################################
+#   Script description:
+#       
+#   Arguments:
+#       
+#   Returns:
+#       
+#   History:
+#   Date        Name        Modification
+#   2013-12-26  root        Begin
+##########################################################################
+
+usage()
+{
+    printf "Usage: $0 node-type\n"
+    exit 1
+}
+
+
+##########################################################################
+#   Main
+##########################################################################
+
+if [ $# != 1 ]; then
+    usage
+fi
+
+node_type=$1
+#./munge-enable $node_type
+
+case $node_type in
+'head')
+    prefix='/usr/pkg-1'
+    ;;
+'compute')
+    prefix='/sharedapps/pkg-1'
+    ;;
+*)
+    printf "$0 is only for head and compute nodes.\n"
+    exit 1
+    ;;
+esac
+
+# slurm.conf
+if [ ! -e $prefix/etc/slurm.conf ]; then
+    printf "Missing $prefix/etc/slurm.conf.  Copy it from head node.\n"
+    exit 1
+fi
+
+# Init script
+#if [ ! -e /etc/init.d/slurm ]; then
+    printf "exec_prefix=/$prefix\nprefix=$prefix\n\n" \
+	> /etc/init.d/slurm
+    chmod 750 /etc/init.d/slurm
+    cat $prefix/share/examples/slurm/init.d.slurm >> /etc/init.d/slurm
+    chkconfig slurm on
+    service slurm restart
+#fi
+
+mkdir -p /var/log/slurm
+chown slurm:slurm /var/log/slurm
+
diff --git a/slurm/patches/patch-etc_init.d.slurm.in b/slurm/patches/patch-etc_init.d.slurm.in
new file mode 100644
index 0000000000..a5a61fcee5
--- /dev/null
+++ b/slurm/patches/patch-etc_init.d.slurm.in
@@ -0,0 +1,16 @@
+$NetBSD: patch-etc_init.d.slurm.in,v 1.1 2015/04/20 13:08:37 outpaddling Exp $
+
+# Provide something for SUBST to replace
+
+--- etc/init.d.slurm.in.orig	2015-03-19 19:38:01.000000000 +0000
++++ etc/init.d.slurm.in
+@@ -25,6 +25,9 @@
+ # Description:       Start slurm to provide resource management
+ ### END INIT INFO
+ 
++exec_prefix=
++prefix=
++
+ BINDIR="@bindir@"
+ CONFDIR="@sysconfdir@"
+ LIBDIR="@libdir@"
diff --git a/slurm/patches/patch-src_common_gres.c b/slurm/patches/patch-src_common_gres.c
deleted file mode 100644
index 8d72862ad4..0000000000
--- a/slurm/patches/patch-src_common_gres.c
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- src/common/gres.c.orig	2016-05-31 21:35:09.000000000 +0000
-+++ src/common/gres.c
-@@ -82,7 +82,8 @@ typedef cpuset_t cpu_set_t;
- #ifdef __NetBSD__
- #define CPU_ZERO(c) cpuset_zero(*(c))
- #define CPU_ISSET(i,c) cpuset_isset((i),*(c))
--#define sched_getaffinity sched_getaffinity_np
-+#define sched_getaffinity(p,s,c) \
-+        sched_getaffinity_np((p),cpuset_size(*(c)),*(c))
- #define SCHED_GETAFFINITY_THREE_ARGS
- #endif
- 
diff --git a/slurm/patches/patch-src_slurmd_common_task__plugin.c b/slurm/patches/patch-src_slurmd_common_task__plugin.c
new file mode 100644
index 0000000000..b75fa98154
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_common_task__plugin.c
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- src/slurmd/common/task_plugin.c.orig	2018-01-05 18:03:10.000000000 +0000
++++ src/slurmd/common/task_plugin.c
+@@ -542,7 +542,11 @@ extern void task_slurm_chkaffinity(cpu_s
+ 				   int statval)
+ {
+ 	char *bind_type, *action, *status, *units;
++#ifdef __NetBSD__
++	char mstr[1 + cpuset_size(mask) / 4];
++#else
+ 	char mstr[1 + CPU_SETSIZE / 4];
++#endif
+ 	int task_gid = job->envtp->procid;
+ 	int task_lid = job->envtp->localid;
+ 	pid_t mypid = job->envtp->task_pid;
+@@ -609,7 +613,11 @@ extern char *task_cpuset_to_str(const cp
+ 	char *ptr = str;
+ 	char *ret = NULL;
+ 
++#ifdef __NetBSD__
++	for (base = cpuset_size(mask) - 4; base >= 0; base -= 4) {
++#else
+ 	for (base = CPU_SETSIZE - 4; base >= 0; base -= 4) {
++#endif
+ 		char val = 0;
+ 		if (CPU_ISSET(base, mask))
+ 			val |= 1;
diff --git a/slurm/patches/patch-src_slurmd_common_task__plugin.h b/slurm/patches/patch-src_slurmd_common_task__plugin.h
new file mode 100644
index 0000000000..0418b57a67
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_common_task__plugin.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- src/slurmd/common/task_plugin.h.orig	2018-01-04 21:15:01.000000000 +0000
++++ src/slurmd/common/task_plugin.h
+@@ -42,6 +42,16 @@
+ 
+ #include "src/slurmd/slurmstepd/slurmstepd_job.h"
+ 
++// Keep in sync with slurmd/slurmd.h
++#ifdef __NetBSD__    
++#define	cpu_set_t	cpuset_t
++#define CPU_ZERO(c)	cpuset_zero((c))   
++#define CPU_SET(i,c)	cpuset_set((i),(c))
++#define CPU_ISSET(i,c)	cpuset_isset((i),(c))
++#define sched_getaffinity	sched_getaffinity_np
++#define SCHED_GETAFFINITY_THREE_ARGS
++#endif
++ 
+ /*
+  * Initialize the task plugin.
+  *
diff --git a/slurm/patches/patch-src_slurmd_slurmd_slurmd.c b/slurm/patches/patch-src_slurmd_slurmd_slurmd.c
new file mode 100644
index 0000000000..831fff56b8
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_slurmd_slurmd.c
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- src/slurmd/slurmd/slurmd.c.orig	2018-01-04 21:15:01.000000000 +0000
++++ src/slurmd/slurmd/slurmd.c
+@@ -2067,7 +2067,13 @@ static int _core_spec_init(void)
+ 	uint32_t task_params;
+ 	bool slurmd_off_spec;
+ 	bitstr_t *res_mac_bitmap;
++#ifdef __NetBSD__
++	cpuset_t *mask = cpuset_create();
++#define	CPU_SET_SIZE	cpuset_size(mask)
++#else
+ 	cpu_set_t mask;
++#define	CPU_SET_SIZE	sizeof(cpu_set_t)
++#endif
+ 
+ 	if ((conf->core_spec_cnt == 0) && (conf->cpu_spec_list == NULL)) {
+ 		debug("Resource spec: No specialized cores configured by "
+@@ -2165,7 +2171,7 @@ static int _core_spec_init(void)
+ 		rval = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,
+ 					  pid, sizeof(cpu_set_t), &mask);
+ #elif defined(SCHED_GETAFFINITY_THREE_ARGS)
+-		rval = sched_setaffinity(pid, sizeof(cpu_set_t), &mask);
++		rval = sched_setaffinity(pid, CPU_SET_SIZE, &mask);
+ #else
+ 		rval = sched_setaffinity(pid, &mask);
+ #endif
diff --git a/slurm/patches/patch-src_slurmd_slurmd_slurmd.h b/slurm/patches/patch-src_slurmd_slurmd_slurmd.h
new file mode 100644
index 0000000000..2e6ef143fd
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_slurmd_slurmd.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- src/slurmd/slurmd/slurmd.h.orig	2018-01-04 21:15:01.000000000 +0000
++++ src/slurmd/slurmd/slurmd.h
+@@ -48,6 +48,16 @@
+ #include "src/common/slurm_protocol_api.h"
+ #include "src/common/slurm_cred.h"
+ 
++// Keep in sync with common/task_plugin.h
++#ifdef __NetBSD__  
++#define CPU_ZERO(c) cpuset_zero((c))
++#define CPU_SET(i,c) cpuset_set((i),(c))
++#define CPU_ISSET(i,c) cpuset_isset((i),(c))
++#define sched_getaffinity sched_getaffinity_np
++#define sched_setaffinity sched_setaffinity_np
++#define SCHED_GETAFFINITY_THREE_ARGS
++#endif
++                        
+ #ifndef __USE_XOPEN_EXTENDED
+ extern pid_t getsid(pid_t pid);		/* missing from <unistd.h> */
+ extern pid_t getpgid(pid_t pid);
diff --git a/slurm/patches/patch-src_slurmd_slurmstepd_io.c b/slurm/patches/patch-src_slurmd_slurmstepd_io.c
new file mode 100644
index 0000000000..15216726ef
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_slurmstepd_io.c
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/slurmd/slurmstepd/io.c.orig	2018-01-05 23:43:03.000000000 +0000
++++ src/slurmd/slurmstepd/io.c
+@@ -45,6 +45,7 @@
+ #endif
+ 
+ #ifdef HAVE_UTMP_H
++#  include <time.h>
+ #  include <utmp.h>
+ #endif
+ 
diff --git a/slurm/patches/patch-src_slurmd_slurmstepd_task.c b/slurm/patches/patch-src_slurmd_slurmstepd_task.c
new file mode 100644
index 0000000000..4681525e3f
--- /dev/null
+++ b/slurm/patches/patch-src_slurmd_slurmstepd_task.c
@@ -0,0 +1,25 @@
+$NetBSD$
+
+# Linux compat
+
+--- src/slurmd/slurmstepd/task.c.orig	2016-05-03 22:41:59.000000000 +0000
++++ src/slurmd/slurmstepd/task.c
+@@ -558,6 +558,18 @@ _make_tmpdir(stepd_step_rec_t *job)
+ 		 * still work with older systems we include this check.
+ 		 */
+ 
++/* FIXME: Come up with a real solution for EUID instead of substituting RUID */
++#if defined(__NetBSD__)
++#define eaccess(p,m) (access((p),(m)))
++#define HAVE_EACCESS 1
++#endif
++  
++// Unsure about the reason for this patch, but it dates back to SLURM 2.6.4
++//#if defined(__FreeBSD__) || defined(__NetBSD__)
++//#define __GLIBC__               (1) 
++//#define __GLIBC_PREREQ(a,b)     (1) 
++//#endif
++
+ #if defined(HAVE_FACCESSAT)
+ 		else if (faccessat(AT_FDCWD, tmpdir, X_OK|W_OK, AT_EACCESS))
+ #elif defined(HAVE_EACCESS)


Home | Main Index | Thread Index | Old Index