diff --git a/config.py b/config.py index 8540c43d..a84fe691 100644 --- a/config.py +++ b/config.py @@ -71,6 +71,8 @@ def __init__(self, casename): # Specific settings based on the node type ('gpu' or 'mc') if self.machine == 'daint': self.set_node_info() + if self.machine == 'eiger': + self.set_node_info() def load_config_file(self): """Load configuration settings from a YAML file and set them as attributes. @@ -152,6 +154,8 @@ def set_machine(self): self.machine = 'daint' elif hostname.startswith('eu-'): self.machine = 'euler' + elif hostname.startswith('eiger'): + self.machine = 'eiger' else: raise ValueError(f"Unsupported hostname: {hostname}") print(f"You are on the {self.machine} machine.") @@ -472,6 +476,22 @@ def submit_basic_python(self, job_name): f'./run_chain.py {self.casename} -j {job_name} -c {self.chunk_id} -f -s --no-logging', '', ] + elif self.machine == 'eiger': + script_lines = [ + '#!/usr/bin/env bash', + f'#SBATCH --job-name={job_name}', + '#SBATCH --nodes=1', + f'#SBATCH --time={walltime}', + f'#SBATCH --output={self.logfile}', + '#SBATCH --open-mode=append', + f'#SBATCH --account={self.compute_account}', + f'#SBATCH --partition={self.compute_queue}', + f'#SBATCH --constraint={self.constraint}', + '', + f'cd {self.chain_src_dir}', + f'./run_chain.py {self.casename} -j {job_name} -c {self.chunk_id} -f -s --no-logging', + '', + ] job_path = self.chain_root / 'job_scripts' job_path.mkdir(parents=True, exist_ok=True) @@ -516,6 +536,17 @@ def wait_for_previous(self): f'#SBATCH --dependency=afterany:{dep_str}', '', '# Do nothing', 'exit 0' ] + elif self.machine == 'eiger': + script_lines = [ + '#!/usr/bin/env bash', '#SBATCH --job-name="wait"', + '#SBATCH --nodes=1', '#SBATCH --time=00:01:00', + f'#SBATCH --output={log_file}', + f'#SBATCH --account={self.compute_account}', + f'#SBATCH --partition={self.compute_queue}', + f'#SBATCH --constraint={self.constraint}', + f'#SBATCH --dependency=afterany:{dep_str}', '', + '# Do nothing', 'exit 0' + ] with open(job_file, mode='w') as wait_job: wait_job.write('\n'.join(script_lines)) diff --git a/run_chain.py b/run_chain.py index 522f0d45..d69a3e4f 100755 --- a/run_chain.py +++ b/run_chain.py @@ -323,6 +323,9 @@ def main(): if cfg.constraint and cfg.machine == 'daint': assert cfg.constraint in ['gpu', 'mc'], ("Unknown constraint, use" "gpu or mc") + elif cfg.constraint and cfg.machine == 'eiger': + assert cfg.constraint in ['mc'], ("Unknown constraint, use" + "gpu or mc") # Get complete chunk list cfg.get_chunk_list()