Skip to content

Commit

Permalink
hostname configuration for eiger machine
Browse files Browse the repository at this point in the history
  • Loading branch information
Kutay Donmez committed Dec 9, 2024
1 parent bb73b40 commit 673e657
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))

Expand Down
3 changes: 3 additions & 0 deletions run_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 673e657

Please sign in to comment.