def METHOD_NAME(infile, outfile, mode, samples, mpi=None, replicates=1, write=True):
    data = collections.defaultdict(list)
    if mpi is None: mpi = [1]*len(samples)
    exe = mooseutils.find_moose_executable_recursive()
    for n_cores, n_samples in zip(mpi, samples):
        cmd = ['mpiexec', '-n', str(n_cores), exe, '-i', infile, 'Samplers/mc/num_rows={}'.format(int(n_samples)),
               'Executioner/num_steps={}'.format(replicates),
               'MultiApps/runner/mode={}'.format(mode),
               'Outputs/file_base={}'.format(mode)]
        print(' '.join(cmd))
        out = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
        local = pandas.read_csv('{}.csv'.format(mode))
        data['n_ranks'].append(n_cores)
        data['n_samples'].append(n_samples)
        data['mem_total'].append(local['total'].iloc[1])
        data['mem_per_proc'].append(local['per_proc'].iloc[1])
        data['mem_max_proc'].append(local['max_proc'].iloc[1])
        data['run_time'].append(statistics.mean(local['run_time'].iloc[1:]))
        data['run_time_min'].append(min(local['run_time'].iloc[1:]))
        data['run_time_max'].append(max(local['run_time'].iloc[1:]))
        df = pandas.DataFrame(data, columns=data.keys())
        if write:
            df.to_csv('results/{}_{}.csv'.format(outfile, mode))