do_io = True # generate_q0(Nx, Ny, Nz) Nproc = 24 Niter_max = 5 # read the run command to use plus possible options with open("system.defs", "r") as rfile: system = rfile.readline() system = system.rstrip() runcmd = rfile.readline() runcmd = runcmd.rstrip() rfile.close() # Run serial reference timemesh = generate_timemesh(0.0, Tend, dt_fine, dt_coarse, 1) Nfine = timemesh.get('Nfine') Ncoarse = timemesh.get('Ncoarse') param_file = "fine_serial.in" build_namelist(nu, Nx, Ny, Nz, Nfine, Ncoarse, Niter, Tend, do_io, be_verbose, param_file) if system == "mac": os.system("time bin/run_timestepper.out " + param_file + " F") else: jobname = "fine_serial" build_runscript(1, jobname, "serial_f", system, param_file) os.system("sbatch submit_serial_f_Np1.sh") # for Niter in range(1, Niter_max):
# generate_q0(Nx, Ny, Nz) #Nproc = [2, 4, 8] Nproc = [8] # read the run command to use plus possible options with open("system.defs", "r") as rfile: system = rfile.readline() system = system.rstrip() runcmd = rfile.readline() runcmd = runcmd.rstrip() rfile.close() for np in Nproc: #types = [ 'mpi', 'openmp', 'openmp_pipe' ] types = [ 'mpi' ] timemesh = generate_timemesh(0.0, Tend, dt_fine, dt_coarse, np) Nfine = timemesh.get('Nfine') Ncoarse = timemesh.get('Ncoarse') for ii in range(0,len(types)): type=types.pop(0) param_file = "param_para_"+type+"_Np"+str(np)+".in" build_namelist(nu, Nx, Ny, Nz, Nfine, Ncoarse, Niter, Tend, do_io, be_verbose, param_file) if system=="mac": if type=="mpi": os.system("time "+runcmd+" -n "+str(np)+" bin/run_parareal_"+type+".out "+param_file) elif type=="openmp": os.system("time OMP_NUM_THREADS="+str(np)+" mpirun -n 1 bin/run_parareal_"+type+".out "+param_file) elif type=="openmp_pipe": os.system("time OMP_NUM_THREADS="+str(np)+" mpirun -n 1 bin/run_parareal_"+type+".out "+param_file) else: jobname="parareal_"+type+"_Np"+str(np)
# Prepare generation of a bash script to rename RUR output... # These log files are identified using the JobID. Running rename.sh after all jobs are finished will # rename these from something like rur.123456 into e.g. serial_f_Np1.rur os.system("rm -f rename.sh") os.system("touch rename.sh") os.system("chmod u=rwx rename.sh") # read the run command to use plus possible options with open("system.defs", "r") as rfile: system = rfile.readline() system = system.rstrip() runcmd = rfile.readline() runcmd = runcmd.rstrip() rfile.close() timemesh = generate_timemesh(0.0, Tend, dt_fine, dt_coarse, 1) Nfine = timemesh.get('Nfine') Ncoarse = timemesh.get('Ncoarse') param_file = "param_fine_ref.in" build_namelist(nu, Nx, Ny, Nz, Nfine, Ncoarse, Niter, Tend, do_io, be_verbose, param_file) # Run serial reference if system=="mac": os.system("time bin/run_timestepper.out "+param_file+" F") else: jobname="fine_serial" build_runscript(1, jobname, "serial_f", system, param_file) os.system("sbatch submit_serial_f_Np1.sh") param_file = "param_coarse.in" build_namelist(nu, Nx, Ny, Nz, Nfine, Ncoarse, Niter, Tend, do_io, be_verbose, param_file)
# Prepare generation of a bash script to rename RUR output... # These log files are identified using the JobID. Running rename.sh after all jobs are finished will # rename these from something like rur.123456 into e.g. serial_f_Np1.rur os.system("rm -f rename.sh") os.system("touch rename.sh") os.system("chmod u=rwx rename.sh") # read the run command to use plus possible options with open("system.defs", "r") as rfile: system = rfile.readline() system = system.rstrip() runcmd = rfile.readline() runcmd = runcmd.rstrip() rfile.close() timemesh = generate_timemesh(0.0, Tend, dt_fine, dt_coarse, Nproc) Nfine = timemesh.get('Nfine') Ncoarse = timemesh.get('Ncoarse') for kk in range(0,Nsamples): types = [ 'mpi', 'openmp', 'openmp_pipe' ] for ii in range(0,len(types)): type=types.pop(0) param_file = "param_para_"+type+"_Np"+str(Nproc)+".in" build_namelist(nu, Nx, Ny, Nz, Nfine, Ncoarse, Niter, Tend, do_io, be_verbose, param_file) if system=="mac": print "Can run energy measurements on Cray only" else: jobname=str(kk)+"_"+"parareal_"+type+"_Np"+str(Nproc)