Beispiel #1
0
def do_test(rootdir, J, name, factor=1):
    dirsx = glob.glob(rootdir + '*' + 'Jmax' + J + '*')
    plt.figure(1)
    for d in dirsx:
        d = insect_tools.load_t_file(d + '/timesteps_info.t')
        if factor == 4:
            plt.loglog(d[:, 3] * factor,
                       d[:, 1],
                       label=name,
                       marker='o',
                       linestyle='None',
                       color=[0.5, 0.5, 0.5])
        else:
            plt.loglog(d[:, 3] * factor,
                       d[:, 1],
                       label=name,
                       marker='o',
                       linestyle='None')
def do_test2(rootdir, tt, name, reffile):
    dirsx = glob.glob(rootdir)
    tcpu=[]
    err=[]
    f = '/fullphi_00000'+tt+'00000.h5'
    for d in dirsx:
        if (os.path.isfile(d+f)):
            e = wabbit_tools.wabbit_error_vs_flusi( d+f, reffile, norm=norm )
            err.append(e)
            ncpu = len( glob.glob(d+'/*times.dat') )
            d = insect_tools.load_t_file(d+'/timesteps_info.t')
            tcpu.append( np.sum( d[:,1] )*float(ncpu) )
        else:
            warnings.warn("No data in that dir="+d+f)

    # sort the lists (by eps)
    err, tcpu = zip(*sorted(zip(err, tcpu )))

    plt.figure(1)
    plt.loglog( err, tcpu, label=name, marker='o')
else:
    dir = args.directory

if dir[-1] is not '/':
    dir = dir + '/'

#------------------------------------------------------------------------------
# look for the ini file, this gives us the information at what time the run is done
if args.paramsfile is None:
    l = glob.glob(dir + '*.ini')
    inifile = l[0]
else:
    inifile = args.paramsfile

#------------------------------------------------------------------------------
if not os.path.isfile(dir + 'timesteps_info.t'):
    raise ValueError("The file timesteps_info.t has not been found here.")

# load the data file
d = insect_tools.load_t_file(dir + 'timesteps_info.t', verbose=False)

# final time to reach according to paramsfile
T = wabbit_tools.get_ini_parameter(inifile, 'Time', 'time_max', float)

if d[-1, 0] >= 0.99 * T:
    # run is done
    print('0   (The simulation is done!)')
    sys.exit(0)
else:
    print('1   (The simulation is not yet complete!)')
    sys.exit(1)
Beispiel #4
0
        i += 1

    if not right_inifile:
        raise ValueError(
            "We did not find an inifile which tells us what the target time is."
        )

else:
    inifile = args.paramsfile

if verbose:
    print("We found and extract the final time in the simulation from: " +
          inifile)

# load the data file
d = insect_tools.load_t_file(dir + 'performance.t', verbose=verbose)

# if we consider only a few time steps, we discard the others:
if args.first_n_time_steps is not None:
    d = d[0:args.first_n_time_steps + 1, :]

# if we consider only a few time steps, we discard the others:
if args.last_m_time_steps is not None:
    d = d[-args.last_m_time_steps:, :]

# figure out how many RHS evaluatins we do per time step
method = wabbit_tools.get_ini_parameter(inifile,
                                        'Time',
                                        'time_step_method',
                                        str,
                                        default="RungeKuttaGeneric")
plt.close('all')

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--directory", nargs='?', const='.',
                    help="directory of simulation files, if not ./")
args = parser.parse_args()


if args.directory is None:
    # default is working directory
    root = './'
else:
    root = args.directory


d = insect_tools.load_t_file( root+'/timesteps_info.t')

if d.shape[1] == 7:
    # this is a recent file (>20/12/2018) it contains the number of procs in every line
    ncpu = d[:,6]

else:
    # this is an older run, and we can only try to fetch the number of mpiranks from other data
    # unfortunately, we will not be able to tell if the number of procs has been changed during the run.
    e = insect_tools.load_t_file( root+'/blocks_per_mpirank_rhs.t')
    ncpu = e.shape[1]-5


blocks_per_rank = d[:,3] / ncpu
tcpu_per_block = ncpu*d[:,1] / d[:,3]
tcpu = ncpu*d[:,1]