mpifix directory, orted and mpirun to rewrite addresses
[mpi-image.git] / scripts / init.py
old mode 100755 (executable)
new mode 100644 (file)
index 61a943c..894f7c4
@@ -15,7 +15,9 @@ HTML_SOURCE = "www.vicci.org/files/mpi/"
 MPI_COPY_URL = HTML_SOURCE + "mpi-copy.py"
 GENERATE_HOSTFILE_URL = HTML_SOURCE + "generate-hostfile.py"
 SSHD_CONFIG_URL = HTML_SOURCE + "sshd_config"
-
+ORTED_URL = HTML_SOURCE + "orted"
+BIND_PUBLIC_URL = HTML_SOURCE + "bind_public.so"
+MPIRUN_URL = HTML_SOURCE + "mpirun"
 
 def alarm(signum, junk):
     # Do nothing, default implementation does needful
@@ -67,12 +69,19 @@ def fetch_output_nofail(inpath,outpath):
 
 ### main()
 
+os.system("sudo mkdir -m 777 /usr/local/mpifix")
+
 os.system("wget -q -O /usr/bin/mpi-copy.py " + MPI_COPY_URL)
 os.system("wget -q -O /usr/bin/generate-hostfile.py " + GENERATE_HOSTFILE_URL)
 os.system("wget -q -O /tmp/sshd_config " + SSHD_CONFIG_URL)
+os.system("wget -q -O /usr/local/mpifix/orted " + ORTED_URL)
+os.system("wget -q -O /usr/local/mpifix/bind_public.so " + BIND_PUBLIC_URL)
+os.system("wget -q -O /usr/local/mpifix/mpirun " + MPIRUN_URL)
 
 os.system("chmod 755 /usr/bin/mpi-copy.py")
 os.system("chmod 755 /usr/bin/generate-hostfile.py")
+os.system("chmod 755 /usr/local/mpifix/orted")
+os.system("chmod 755 /usr/local/mpifix/mpirun")
 
 for fn in ["/usr/bin/mpi-copy.py", "/usr/bin/generate-hostfile.py", "/tmp/sshd_config"]:
     if not os.path.exists(fn):
@@ -134,7 +143,7 @@ try:
         if line[len(line)-1] == "KEY-----":
           s = line[0] + " " + line[1] + " " + line[2] + " " + line[3] + "\n"
           g.write(s)
-          seenSSHKey = False 
+          seenSSHKey = False
           g.close()
         else:
           g.write(line[0] + "\n")
@@ -179,6 +188,10 @@ try:
 #    s = "sudo chmod u+x " + homedir + "/mpi-copy.py"
 #    os.system(s)
 
+    # /etc/profile isn't working for noninteractive ssh sessions, so set the mpi
+    # paths in .bashrc
+    open(homedir+"/.bashrc","w").write("export PATH=/usr/local/mpifix:$PATH:/usr/lib64/openmpi/bin\nexport LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH\n")
+
     os.system("chmod og-rw " + homedir + "/.ssh/id_rsa")
     os.system("chmod og-rw " + homedir + "/.ssh/id_rsa.pub")
     os.system("chmod og-rw " + homedir + "/.ssh/config")