Esempio n. 1
0
#parser.add_option("-p", dest="Nprepare_dirs", default=0, type="int",
#             help="prepare dirs only.  -p N, to prepare N directories")
(inp, args) = parser.parse_args()

print_args=False
if print_args:
  print inp
  if len(args) > 0:
    print "unparsed opt: ", args

if len(args) == 1:
  rank = int(args[0])
  if rank < 0:
    print "usage: parallelEPrun.py x, where x is rank number, cannot be negative"
else:
  print "usage: parallelEPrun.py x, where x is rank number"
  exit(0)

# run for each rank
dir = epopt.rundirname(rank)
os.chdir(dir) 

print "  running parallelEPrun.py in dir="+os.getcwd()

# might keep this command fixed, and have prepareDirs always link/copy a ./ep in here

os.system("python ./ss >& Results.txt")

os.chdir("..")

# various other checks
#if not os.path.exists(epopt.idfname(ir)):
epopt.checkexe(epopt.simple_executable())
epopt.checkexe("./parallelEPrun.py")
epopt.checkexe("./serialScoop.py")
epopt.checkexe("./serialFinalize.py")
epopt.checkexe("./a.out")  # the simple C++ executable

# 
# SimplePSOOpt Specific stuff.
# 
epopt.checkfile(input_file)
  
for ir in range(Nranks):
  dir = epopt.rundirname(ir)
  print dir

  # make dir if not there
  if not os.path.isdir(dir):
    os.system("mkdir -p "+dir)

  os.chdir(dir)
  os.system("ln -fs ../" + epopt.simple_executable() + " ss")
  os.chdir("..")

run_params, parameters = parseInputSpecificationFile( input_file )

NParticles = run_params["NumParticles"]
NIterations = run_params["MaxIterations"]
NConstantParticleIterations = run_params["MaxConstantBestParticleIterations"]
Esempio n. 3
0
parser.add_option("-i", dest="specific_dir", default=-1, type="int",
             help="scoop particular dir -i 5: scoop workdir 5")
(inp, args) = parser.parse_args()

print_args=False
if print_args:
  print inp
  if len(args) > 0:
    print "unparsed opt: ", args

print "Running SerialScrape with n = %s" % args[0]

dirList=[]
if len(args) == 0 and inp.specific_dir>-1:
  # looking in one specific dir
  dirList.append(epopt.rundirname(inp.specific_dir))
elif len(args) == 1:
  Nscoopdirs = int(args[0])
  if Nscoopdirs < 0:
    print "cannot have negative scoopdirs"
  for ir in range(Nscoopdirs):
    dirList.append(epopt.rundirname(ir))
else:
  print "usage: serialscoop.py x, where x is N dirs"
  exit(1)


done=False


pso_data = loadPickleFromFilename("Particle.Dat")