BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
batch_command.h
Go to the documentation of this file.
1#include "function_set.h"
2
3#include <map>
4#include <string>
5
7{
18 string job_begin;
43 batch_commands(string str_scheduler_run_job,
44 string str_array_dependency_option,
45 string str_job_dependency_option,
46 string str_sheduler_priority_option,
47 string str_sheduler_queue_option,
48 string str_sheduler_qos_option,
49 string str_sheduler_workdir_option,
50 string str_operative_memory1_option,
51 string str_sheduler_hosts_option,
52 string str_sheduler_exclude_hosts_option,
53 char c_sheduler_hosts_separation,
54 string str_set_job_variables,
55 string str_check_status_command,
56 string str_queue_count_command,
57 string str_cancel_command,
58 string str_run_command,
59 string str_container_run_command,
60 string str_batch_temp_directory,
61 string str_batch_task_id,
62 string str_job_begin,
63 char c_job_dependency_separator)
64 : scheduler_run_job(str_scheduler_run_job)
65 , array_dependency_option(str_array_dependency_option)
66 , job_dependency_option(str_job_dependency_option)
67 , sheduler_priority_option(str_sheduler_priority_option)
68 , sheduler_queue_option(str_sheduler_queue_option)
69 , sheduler_qos_option(str_sheduler_qos_option)
70 , sheduler_workdir_option(str_sheduler_workdir_option)
71 , operative_memory1_option(str_operative_memory1_option)
72 , sheduler_hosts_option(str_sheduler_hosts_option)
73 , sheduler_exclude_hosts_option(str_sheduler_exclude_hosts_option)
74 , sheduler_hosts_separation(c_sheduler_hosts_separation)
75 , set_job_variables(str_set_job_variables)
76 , check_status_command(str_check_status_command)
77 , queue_count_command(str_queue_count_command)
78 , cancel_command(str_cancel_command)
79 , run_command(str_run_command)
80 , container_run_command(str_container_run_command)
81 , batch_temp_directory(str_batch_temp_directory)
82 , batch_task_id(str_batch_task_id)
83 , job_begin(str_job_begin)
84 , job_dependency_separator(c_job_dependency_separator)
85 {}
86};
87
88map<BATCH_SYSTEM_NAME, batch_commands> mapBS = {
89 {SGE_BATCH_SYSTEM, // Sun Grid Engine commands
90 {/*string scheduler_run_job = */ "qsub -N %s %s -t 1-%d -tc %d",
91 /*string array_dependency_option = */ "-hold_jid_ad ",
92 /*string job_dependency_option = */ "-hold_jid ",
93 /*string sheduler_priority_option = */ " -p %d",
94 /*string sheduler_queue_option = */ " -q %s",
95 /*string sheduler_qos_option = */ "",
96 /*string sheduler_workdir_option = */ " -wd %s",
97 /*string operative_memory1_option = */ " -l h_vmem=%sM",
98 /*string sheduler_hosts_option = */ " -l h=\"(%s)\"",
99 /*string sheduler_exclude_hosts_option = */ " -l h=\"!(%s)\"",
100 /*char sheduler_hosts_separation = */ '|',
101 /*string set_job_variables = */ " -v ",
102 /*string check_status_command = */ "qstat",
103 /*string queue_count_command = */ "qstat -u \"$USER\" 2>/dev/null | awk 'NR>2 {count++} END {print count+0}'",
104 /*string cancel_command = */ "qdel %s",
105 /*string run_command = */ "qsub",
106 /*string container_run_command = */ "qrsh",
107 /*string batch_temp_directory = */ "${TMPDIR}",
108 /*string batch_task_id = */ "$SGE_TASK_ID",
109 /*string job_begin = */
110 "#!/bin/bash\n#$ -j y\n#$ -cwd\n#$ -S /bin/bash\n\n"
111 "echo \"Start date: `date` (host: `hostname`)\"\n"
112 "echo \"Current directory: `pwd`\"\n\n",
113 /*char job_dependency_separator = */ ','}},
114 {SLURM_BATCH_SYSTEM, // SLURM commands
115 {/*string scheduler_run_job = */ "sbatch -J %s %s -a 1-%d%%%d",
116 /*string array_dependency_option = */ "-d aftercorr:",
117 /*string job_dependency_option = */ "-d afterany:",
118 /*string sheduler_priority_option = */ " --nice=%d",
119 /*string sheduler_queue_option = */ " -p %s",
120 /*string sheduler_qos_option = */ " -q %s",
121 /*string sheduler_workdir_option = */ " -D %s",
122 /*string operative_memory1_option = */ " --mem-per-cpu=%sM",
123 /*string sheduler_hosts_option = */ " -w %s",
124 /*string sheduler_exclude_hosts_option = */ " -x %s",
125 /*char sheduler_hosts_separation = */ ',',
126 /*string set_job_variables = */ " --export=",
127 /*string check_status_command = */ "squeue",
128 /*string queue_count_command = */ "squeue -h -u \"$USER\" 2>/dev/null | wc -l",
129 /*string cancel_command = */ "scancel %s",
130 /*string run_command = */ "sbatch",
131 /*string container_run_command = */ "srun",
132 /*string batch_temp_directory = */ "${TMPDIR}",
133 /*string batch_task_id = */ "$SLURM_ARRAY_TASK_ID",
134 /*string job_begin = */
135 "#!/bin/bash\n\n"
136 "echo \"Start date: `date` (host: `hostname`)\"\n"
137 "echo \"Current directory: `pwd`\"\n\n",
138 /*char job_dependency_separator = */ ':'}},
139 {TORQUE_BATCH_SYSTEM, // Torque commands
140 {/*string scheduler_run_job = */ "qsub -N %s %s -t 1-%d%%%d",
141 /*string array_dependency_option = */ "-W depend=afteranyarray:", //? unclear for implementation
142 /*string job_dependency_option = */ "-W depend=afterany:",
143 /*string sheduler_priority_option = */ " -p %d",
144 /*string sheduler_queue_option = */ " -q %s",
145 /*string sheduler_qos_option = */ " -l qos=%s",
146 /*string sheduler_workdir_option = */ " -w %s",
147 /*string operative_memory1_option = */ " -l pmem=%smb",
148 /*string sheduler_hosts_option = */ " -l nodes=%s",
149 /*string sheduler_exclude_hosts_option = */ " -l excludenodes=%s",
150 /*char sheduler_hosts_separation = */ '+',
151 /*string set_job_variables = */ " -v ",
152 /*string check_status_command = */ "qstat",
153 /*string queue_count_command = */
154 "qstat -u \"$USER\" 2>/dev/null | awk -v user=\"$USER\" '$0 ~ user {count++} END {print count+0}'",
155 /*string cancel_command = */ "qdel %s",
156 /*string run_command = */ "qsub",
157 /*string container_run_command = */ "qrsh",
158 /*string batch_temp_directory = */ "${TMPDIR}",
159 /*string batch_task_id = */ "$PBS_ARRAYID",
160 /*string job_begin = */
161 "#!/bin/bash\n#PBS -j oe\n#PBS -d .\n#PBS -S /bin/bash\n\n"
162 "echo \"Start date: `date` (host: `hostname`)\"\n"
163 "echo \"Current directory: `pwd`\"\n\n",
164 /*char job_dependency_separator = */ ':'}}};
map< BATCH_SYSTEM_NAME, batch_commands > mapBS
@ TORQUE_BATCH_SYSTEM
@ SGE_BATCH_SYSTEM
@ SLURM_BATCH_SYSTEM
string sheduler_exclude_hosts_option
string check_status_command
string job_dependency_option
string operative_memory1_option
batch_commands(string str_scheduler_run_job, string str_array_dependency_option, string str_job_dependency_option, string str_sheduler_priority_option, string str_sheduler_queue_option, string str_sheduler_qos_option, string str_sheduler_workdir_option, string str_operative_memory1_option, string str_sheduler_hosts_option, string str_sheduler_exclude_hosts_option, char c_sheduler_hosts_separation, string str_set_job_variables, string str_check_status_command, string str_queue_count_command, string str_cancel_command, string str_run_command, string str_container_run_command, string str_batch_temp_directory, string str_batch_task_id, string str_job_begin, char c_job_dependency_separator)
string sheduler_hosts_option
string array_dependency_option
string container_run_command
char sheduler_hosts_separation
string sheduler_queue_option
string set_job_variables
string sheduler_priority_option
string cancel_command
string batch_temp_directory
string sheduler_qos_option
string scheduler_run_job
string sheduler_workdir_option
char job_dependency_separator
string queue_count_command