forked from HumanArk/hafarm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
slurm_frames_job.schema
64 lines (56 loc) · 1.75 KB
/
slurm_frames_job.schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#SBATCH --array={{ slurm_array_list|join(',') }}
#SBATCH --nice={{ priority }}
#SBATCH -N {{ tile_x }}-{{ tile_x * tile_y }}
#SBATCH{% if slots %} -n {{ slots }}{% else %} --exclusive{% endif %}
{%- if rerun_on_error %}
#SBATCH --requeue
{%- endif %}
{%- if job_on_hold %}
#SBATCH -H
{%- endif %}
{%- if req_tmpdir %}
#SBATCH --tmp={{ req_tmpdir* 1024 }}
{%- endif %}
{%- if req_memory %}
#SBATCH --mem={{ req_memory* 1024 }}
{%- endif %}
{%- if req_license %}
#SBATCH -L {{ req_license.split('=') | join(':') }}
{%- endif %}
{%- if slurm_aftercorr %}
#SBATCH -d aftercorr:{{ slurm_aftercorr|join(',') }}
{%- endif %}
{%- if email_list %}
#SBATCH --mail-user={{ email_list|join(',') }}
{%- endif %}
{%- if queue %}
#SBATCH -p {{ queue }}
{%- endif %}
HAFARM_VERSION={{ env['REZ_HAFARM_VERSION'] }}
OUTPUT_PICTURE="{{ output_picture }}"
echo Job start: `date`
echo Machine name: ${HOSTNAME}
echo User name: ${USER}
echo Slots: $NSLOTS
echo Memory stats: `egrep 'Mem|Cache|Swap' /proc/meminfo`
echo Scene file : {{ scene_file }}
{%- if pre_render_script %}
{{ pre_render_script }}
{%- endif %}
for tile in `seq 0 {{ (tile_x * tile_y)-1 }}`; do
output_image=`printf '{{ output_picture }}' ${tile}`
srun -N 1 --ntasks 1 --exclusive sh -c "{{ command }} -t count={{ tile_x }}x{{ tile_y }},index=${tile} {{ command_arg|join(' ') }} {{ scene_file }} $output_image " &
pids[${i}]=$!
done
for pid in ${pids[*]}; do
wait $pid
done
exit_code=0
{%- if post_render_script %}
{{ post_render_script }}
{%- endif %}
echo Job ends: `date`
echo Render target: "{{ output_picture }}"
echo Commands was: "{{ command }} -t count={{ tile_x }}x{{ tile_y }},index=${tile},suffix={{ tile_suffix }} {{ command_arg|join(' ') }} {{ scene_file }} {{ output_picture }}"
exit $exit_code