File: lamexecLsm

package info (click to toggle)
esys-particle 2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,284 kB
  • sloc: cpp: 77,304; python: 5,647; makefile: 1,176; sh: 10
file content (33 lines) | stat: -rw-r--r-- 839 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
from esys.lsm.util import InstallInfo
from esys.lsm.util import PathSearcher

import os
import sys

moduleName = sys.argv[1]
exec("import " + moduleName)
moduleFileName = eval(moduleName + ".__file__")

#
# LAM mpiexec needs a -machinefile option to tell it
# on which hosts to boot LAM. Run unit tests it on the localhost.
#
machineFileName = os.tmpnam() + "_lam_hosts.txt"
f=file(machineFileName, "w")
f.write(os.uname()[1])
f.close()

mpiexec = PathSearcher().find("mpiexec")
os.execv(
  mpiexec,
  [
    mpiexec,                           # argv[0]
    "-machinefile", machineFileName,
    "-np", "1",                        # Start one MPI process and
                                       # the workers get spawned.
    os.path.join(InstallInfo.binDir, "mpipython"),
    moduleFileName
  ] +\
  sys.argv[2:]
)