예제 #1
0
    # CREATE THE WORKDIR CORRESPONDING TO THE INPUT FILE
    WORKDIR = WORKDIR_BASE + s + 'wd_' + path.basename(path.splitext(BENCH)[0])
    mkdir(WORKDIR)

    WORKDIR += s + str(MPI)
    mkdir(WORKDIR)

    WORKDIR += s + str(OMP)
    mkdir(WORKDIR)

    # If there are restarts, prepare a Checkpoints block to the namelist
    RESTART_INFO = ""
    if nb_restarts > 0:
        # Load the namelist
        namelist = happi.openNamelist(SMILEI_BENCH)
        niter = namelist.Main.simulation_time / namelist.Main.timestep
        # If the simulation does not have enough timesteps, change the number of restarts
        if nb_restarts > niter - 4:
            nb_restarts = max(0, niter - 4)
            if VERBOSE:
                print("Not enough timesteps for restarts. Changed to " +
                      str(nb_restarts) + " restarts")
    if nb_restarts > 0:
        # Find out the optimal dump_step
        dump_step = int((niter + 3.) / (nb_restarts + 1))
        # Prepare block
        if len(namelist.Checkpoints) > 0:
            RESTART_INFO = (" \"" + "Checkpoints.keep_n_dumps=" +
                            str(nb_restarts) + ";" +
                            "Checkpoints.dump_minutes=0.;" +
예제 #2
0
파일: validation.py 프로젝트: ALaDyn/Smilei
	if not os.path.exists(WORKDIR):
		os.mkdir(WORKDIR)

	WORKDIR += s+str(MPI)
	if not os.path.exists(WORKDIR):
		os.mkdir(WORKDIR)

	WORKDIR += s+str(OMP)
	if not os.path.exists(WORKDIR):
		os.mkdir(WORKDIR)

	# If there are restarts, prepare a Checkpoints block to the namelist
	RESTART_INFO = ""
	if nb_restarts > 0:
		# Load the namelist
		namelist = happi.openNamelist(SMILEI_BENCH)
		niter = namelist.Main.simulation_time / namelist.Main.timestep
		# If the simulation does not have enough timesteps, change the number of restarts
		if nb_restarts > niter - 4:
			nb_restarts = max(0, niter - 4)
			if VERBOSE :
				print("Not enough timesteps for restarts. Changed to "+str(nb_restarts)+" restarts")
	if nb_restarts > 0:
		# Find out the optimal dump_step
		dump_step = int( (niter+3.) / (nb_restarts+1) )
		# Prepare block
		if len(namelist.Checkpoints) > 0:
			RESTART_INFO = (" \""
				+ "Checkpoints.keep_n_dumps="+str(nb_restarts)+";"
				+ "Checkpoints.dump_minutes=0.;"
				+ "Checkpoints.dump_step="+str(dump_step)+";"