Skip to content
Snippets Groups Projects
Commit 2812a955 authored by Boris Martin's avatar Boris Martin
Browse files

slurm

parent 16300280
No related branches found
No related tags found
1 merge request!6Draft: "Flexible acquisition", a configuration with arbitrary sources and receivers read from a YAML file.
from string import Template
import os
all_files = [filename for filename in os.listdir() if filename.startswith('config_') and filename.endswith('.txt')]
all_files.sort()
slurm_template = '''#!/bin/bash
#SBATCH --job-name=$job_name
#SBATCH --output=$output
#SBATCH --error=$error
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --time=05:00:00
set -e
set -x
$command_line
'''
for i, freq in enumerate(all_files):
synth_job = Template(slurm_template).substitute(job_name="synth_{}".format(i),
output="synth_{}.out".format(i),
error="synth_{}.err".format(i),
command_line="~/fwi/build/synthetics synthetics.txt common.txt {} -verbose 2".format(freq))
with open('synth_{}.slurm'.format(i), 'w') as f:
f.write(synth_job)
inv_job = Template(slurm_template).substitute(job_name="inv_{}".format(i),
output="inv_{}.out".format(i),
error="inv_{}.err".format(i),
command_line="~/fwi/build/inversion inversion.txt common.txt localminimum_ncg.txt innerproduct_sst.txt {} -verbose 2".format(freq))
with open('inv_{}.slurm'.format(i), 'w') as f:
f.write(inv_job)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment