check in dave's scripts and config files
smbaker [Sun, 9 Dec 2012 21:01:37 +0000 (13:01 -0800)]
scripts/generate-hostfile.py [new file with mode: 0644]
scripts/mpi-copy.py [new file with mode: 0644]
scripts/sshd_config [new file with mode: 0644]

diff --git a/scripts/generate-hostfile.py b/scripts/generate-hostfile.py
new file mode 100644 (file)
index 0000000..cfdd80a
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+from optparse import OptionParser
+import sys
+
+parser = OptionParser()
+parser.add_option('-f', '--sourcefile', dest = "sourcefile", default = "hostfile", help='specifies the list of hosts, one per line (default: "hostfile")')
+parser.add_option('-d', '--destfile', dest = "destfile", default = "hostfile-new", help='specifies the output host file (default: "hostfile-new")')
+parser.add_option('-c', '--requestedcores', dest = "requestedcores", default = 1, help='number of cores to use (default: 1)')
+parser.add_option('-n', '--corespernode', dest = "corespernode", default = 1, help='number of cores per node (default: 1)')
+(options, args) = parser.parse_args()
+
+sourceFile = options.sourcefile
+destFile = options.destfile
+numRequestedCores = int(options.requestedcores)
+coresPerNode = int(options.corespernode)
+
+source = open(sourceFile, "r")
+dest = open(destFile, "w")
+
+numSockets = 2
+coresPerSocket = coresPerNode/numSockets
+
+print "Generating hostfile using the following parameters:"
+print ""
+print "Input host file:", sourceFile
+print "Destination host file:", destFile
+print "Cores per node:", coresPerNode
+print "Cores requested per node:", numRequestedCores
+
+wholeSource = source.readlines()
+for i in wholeSource:
+  s = str(i).strip("\n") + " numslots=" + str(numRequestedCores)
+  dest.write(s.strip(",")+"\n")
diff --git a/scripts/mpi-copy.py b/scripts/mpi-copy.py
new file mode 100644 (file)
index 0000000..83b223d
--- /dev/null
@@ -0,0 +1,143 @@
+#!/usr/bin/python
+
+from optparse import OptionParser
+import os
+import signal
+import sys
+import fcntl
+import getpass
+
+INSANE = 500
+BLOCKING_DELAY = 30
+
+def alarm(signum, junk):
+    # Do nothing, default implementation does needful
+    return
+
+def fetch_output(infd,outfile):
+    try:
+        os.write(infd,'1')
+        output = ''
+
+        while (True):
+            batch = outfile.read()
+            if (batch):
+                output+=batch
+            else:
+                break
+    except IOError,e:
+        print "IO Error Accessing Vsys"
+        raise e
+
+    return output
+
+def fetch_output_nofail(inpath,outpath):
+    pid = os.fork()
+
+    output = None
+
+    if (pid==0):
+        outfd = os.open(outpath, os.O_RDONLY|os.O_NONBLOCK)
+        infd = os.open(inpath, os.O_WRONLY)
+#        infile = os.fdopen(infd,'w')
+
+        flags = fcntl.fcntl(outfd, fcntl.F_GETFL)
+        fcntl.fcntl(outfd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
+        outfile = os.fdopen(outfd)
+
+        output = fetch_output(infd, outfile)
+    else:
+        signal.alarm(BLOCKING_DELAY)
+        try:
+            os.waitpid(pid,0)
+            exit(1)
+        except OSError:
+            ## Failed
+            pass
+
+    return output
+
+parser = OptionParser()
+(options, args) = parser.parse_args()
+hostfileName = "hostfile"
+fileList = args[0:len(args)]
+
+directory = os.getcwd()
+
+f = open("/etc/slicename", "r")
+sliceName = f.read()
+homedir = "/home/" + sliceName
+
+str = "sudo chown -R " + sliceName + " /vsys"
+os.system(str)
+
+outpath = '/vsys/slice_config.out'
+inpath = '/vsys/slice_config.in'
+
+###
+### If vsys is not set up, wait a bit and try again
+
+counter = 1
+while True:
+        signal.signal(signal.SIGALRM, alarm)
+        output = fetch_output_nofail(inpath,outpath)
+        if (output is not None or counter==INSANE):
+            break
+        print "No access to vsys. Looping (%d)..."%counter
+        counter = counter+1
+
+if (output is None):
+    print "Could not connect to Vsys. Giving up."
+    exit(1)
+
+outfd = os.open(outpath, os.O_RDONLY|os.O_NONBLOCK)
+infile = open(inpath, 'w')
+
+flags = fcntl.fcntl(outfd, fcntl.F_GETFL)
+fcntl.fcntl(outfd, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
+outfile = os.fdopen(outfd)
+
+infile.write('1')
+output = ''
+
+while (True):
+        batch = outfile.read()
+        if (batch):
+                output+=batch
+        else:
+                break
+
+wholestring = output.split("\n")
+pathname = homedir + "/" + hostfileName
+for eachline in wholestring:
+  if eachline == "\n" or eachline == "":
+    continue
+  line = eachline.split()
+  if line[0] == "vsys_ipList:":
+    g = open(hostfileName, "w+")
+    nodeNames = line[1]
+    nodes = nodeNames.split(",")
+    for i in nodes:
+      g.write(i + "\n")
+    g.close()
+
+nodes = open(hostfileName, "r")
+
+username = getpass.getuser()
+wholefile = nodes.readlines()
+
+for n in wholefile[1:]:
+  node = n.rstrip()
+  # wait until node is alive
+  while (True):
+    str = "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no " + username + "@" + node + " true"
+    x = os.system(str)
+    if x == 0:
+      break
+    else:
+      os.system("sleep 10")
+  str = "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no " + username + "@" + node + " \"if [ ! -d " + directory + " ]; then mkdir " + directory + "; fi\""
+  os.system(str)
+  for eachfile in fileList:
+     str = "scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no " + eachfile + " " + username + "@" + node + ":" + directory
+     os.system(str)
diff --git a/scripts/sshd_config b/scripts/sshd_config
new file mode 100644 (file)
index 0000000..0b28bb3
--- /dev/null
@@ -0,0 +1,136 @@
+#      $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
+
+# This is the sshd server system-wide configuration file.  See
+# sshd_config(5) for more information.
+
+# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
+
+# The strategy used for options in the default sshd_config shipped with
+# OpenSSH is to specify options with their default value where
+# possible, but leave them commented.  Uncommented options change a
+# default value.
+
+#AddressFamily any
+#ListenAddress 0.0.0.0
+#ListenAddress ::
+
+# Disable legacy (protocol version 1) support in the server for new
+# installations. In future the default will change to require explicit
+# activation of protocol 1
+Protocol 2
+
+# HostKey for protocol version 1
+#HostKey /etc/ssh/ssh_host_key
+# HostKeys for protocol version 2
+#HostKey /etc/ssh/ssh_host_rsa_key
+#HostKey /etc/ssh/ssh_host_dsa_key
+
+# Lifetime and size of ephemeral version 1 server key
+#KeyRegenerationInterval 1h
+#ServerKeyBits 1024
+
+# Logging
+# obsoletes QuietMode and FascistLogging
+#SyslogFacility AUTH
+SyslogFacility AUTHPRIV
+#LogLevel INFO
+
+# Authentication:
+
+#LoginGraceTime 2m
+#PermitRootLogin yes
+#StrictModes yes
+#MaxAuthTries 6
+#MaxSessions 10
+
+#RSAAuthentication yes
+#PubkeyAuthentication yes
+#AuthorizedKeysFile    .ssh/authorized_keys
+#PubkeyAgent none
+#PubkeyAgentRunAs nobody
+
+# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
+#RhostsRSAAuthentication no
+# similar for protocol version 2
+#HostbasedAuthentication no
+# Change to yes if you don't trust ~/.ssh/known_hosts for
+# RhostsRSAAuthentication and HostbasedAuthentication
+#IgnoreUserKnownHosts no
+# Don't read the user's ~/.rhosts and ~/.shosts files
+#IgnoreRhosts yes
+
+# To disable tunneled clear text passwords, change to no here!
+#PasswordAuthentication yes
+#PermitEmptyPasswords no
+PasswordAuthentication yes
+
+# Change to no to disable s/key passwords
+#ChallengeResponseAuthentication yes
+ChallengeResponseAuthentication no
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+#KerberosGetAFSToken no
+
+# GSSAPI options
+#GSSAPIAuthentication no
+GSSAPIAuthentication yes
+#GSSAPICleanupCredentials yes
+GSSAPICleanupCredentials yes
+#GSSAPIStrictAcceptorCheck yes
+#GSSAPIKeyExchange no
+
+# Set this to 'yes' to enable PAM authentication, account processing, 
+# and session processing. If this is enabled, PAM authentication will 
+# be allowed through the ChallengeResponseAuthentication and
+# PasswordAuthentication.  Depending on your PAM configuration,
+# PAM authentication via ChallengeResponseAuthentication may bypass
+# the setting of "PermitRootLogin without-password".
+# If you just want the PAM account and session checks to run without
+# PAM authentication, then enable this but set PasswordAuthentication
+# and ChallengeResponseAuthentication to 'no'.
+#UsePAM no
+UsePAM yes
+
+# Accept locale-related environment variables
+AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
+AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
+AcceptEnv XMODIFIERS
+
+#AllowAgentForwarding yes
+#AllowTcpForwarding yes
+#GatewayPorts no
+#X11Forwarding no
+X11Forwarding yes
+#X11DisplayOffset 10
+#X11UseLocalhost yes
+#PrintMotd yes
+#PrintLastLog yes
+#TCPKeepAlive yes
+#UseLogin no
+#UsePrivilegeSeparation yes
+#PermitUserEnvironment no
+#Compression delayed
+#ClientAliveInterval 0
+#ClientAliveCountMax 3
+#ShowPatchLevel no
+#UseDNS yes
+#PidFile /var/run/sshd.pid
+#MaxStartups 10
+#PermitTunnel no
+#ChrootDirectory none
+
+# no default banner path
+#Banner none
+
+# override default of no subsystems
+Subsystem      sftp    /usr/libexec/openssh/sftp-server
+
+# Example of overriding settings on a per-user basis
+#Match User anoncvs
+#      X11Forwarding no
+#      AllowTcpForwarding no
+#      ForceCommand cvs server