Commit 2e23ff83 authored by Lukas Weber's avatar Lukas Weber
Browse files

automatic system type detection for yrun

parent f6111f25
......@@ -4,7 +4,7 @@ import os
batchscript_claix18 = '''
#!/usr/bin/env zsh
# Autogenerated by load-leveller targeting the claix18 cluster. Do not edit.
# Autogenerated by loadleveller targeting the claix18 cluster. Do not edit.
#SBATCH --job-name={jobname}
#SBATCH --time={walltime}
......@@ -28,6 +28,8 @@ batch_commands = {
'claix18': 'sbatch {batchscript}'
}
valid_systems = ['local', 'claix18']
def generate_batchscript(template, cmd, jobname, jobconfig):
return template.format(
jobname=jobname,
......@@ -38,16 +40,26 @@ def generate_batchscript(template, cmd, jobname, jobconfig):
custom_cmds=jobconfig['custom_cmds'],
mc_cmd=' '.join(cmd)
)
def run(jobname, jobconfig, cmd):
def determine_system():
sysinfo = os.environ.get('MCLL_SYSTEM_INFO')
if not sysinfo:
print('Warning: environment variable $MCLL_SYSTEM_INFO not set. Will assume value \'local\'.')
sysinfo = 'local'
if sysinfo != 'local' and sysinfo not in batch_commands.keys():
print('Warning: $MCLL_SYSTEM_INFO set to \'{}\' which is not supported. Will assume value \'local\'.'.format(sysinfo))
if sysinfo == "":
import socket
hostname = socket.gethostname()
if hostname.endswith('.hpc.itc.rwth-aachen.de'):
sysinfo = 'claix18'
if not sysinfo in valid_systems:
sysinfo = 'local'
return sysinfo
def run(jobname, jobconfig, cmd):
sysinfo = determine_system()
print('running on system \'{}\''.format(sysinfo))
if sysinfo == 'local':
mpicmd = '{} -n {} {}'.format(jobconfig['mpirun'], jobconfig['num_cores'], ' '.join(cmd))
print('$ '+mpicmd)
......
......@@ -20,7 +20,8 @@ args = parser.parse_args()
jobdir = os.path.dirname(args.jobfile)
jobfile_name = os.path.basename(args.jobfile)
os.chdir(jobdir)
if jobdir != '':
os.chdir(jobdir)
if args.single and args.merge:
print('Error: cannot merge and run in single mode at the same time.')
......
......@@ -6,7 +6,7 @@
#include "runner_single.h"
namespace load_leveller {
inline int merge_only(jobinfo job, const mc_factory &mccreator, int argc, char **argv) {
inline int merge_only(jobinfo job, const mc_factory &mccreator, int, char **) {
for(size_t task_id = 0; task_id < job.task_names.size(); task_id++) {
std::vector<evalable> evalables;
std::unique_ptr<abstract_mc> sys{mccreator(job.jobfile_name, job.task_names[task_id])};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment