-
Notifications
You must be signed in to change notification settings - Fork 0
/
eb_wrap
executable file
·63 lines (55 loc) · 2.04 KB
/
eb_wrap
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
#!/bin/bash
# This script is a wrapper of EasyBuild command line (eb) that submits a job via Slurm
# Workload manager for each architecture
#
# * It provides a comprehensive log in order to know who installed what.
# * It routes the interactive job to a defined partition
# * It uses an specific account to build and install the applications (UID)
# In order to run the job as a different user, you will need to setup a similar
# rule in /etc/sudoers:
# %admin ALL=(ALL) /usr/bin/sbatch
#
# Developed by Jordi Blasco <[email protected]>
# Based on Alan Orth interactive script
# URL : https://github.com/alanorth/hpc_infrastructure_scripts/blob/master/slurm/interactive
#
# defaults
if [ $USER != "snow" ] ; then
echo "You need to use snow account!"
exit 0
fi
DEF_NUM_CPUS=8
DEF_MEM_PER_CPU=4
DEF_PARTITION=easybuild
DEF_JOB_NAME=EasyBuild
DEF_ACCOUNT=snow
DEF_UID=1000
DEF_TIME=12:00:00
DEF_RUNEXEC="eb --tmp-logdir=/sNow/easybuild/log/tmp $@"
######
function envsetup() {
SBATCH_BIN=/usr/bin/sbatch
SBATCH_OPTS="--cpus-per-task=$DEF_NUM_CPUS"
SBATCH_OPTS="$SBATCH_OPTS --mem-per-cpu=$(($DEF_MEM_PER_CPU*1024))"
SBATCH_OPTS="$SBATCH_OPTS -J $DEF_JOB_NAME"
SBATCH_OPTS="$SBATCH_OPTS -A $DEF_ACCOUNT"
SRUN_BIN="/usr/bin/srun"
# add the interactive partition
SBATCH_OPTS="$SBATCH_OPTS -p $DEF_PARTITION"
# add the snow UID
SBATCH_OPTS="$SBATCH_OPTS --uid=$DEF_UID"
# add the default time limit
SBATCH_OPTS="$SBATCH_OPTS -t $DEF_TIME"
# add working directory
SBATCH_OPTS="$SBATCH_OPTS -D /sNow/easybuild/jobs"
SRUN_OPTS="$DEF_RUNEXEC"
}
# setup the defaults
envsetup
echo "$(date) $(logname) $SRUN_OPTS $INTERACTIVE_SHELL" >> /sNow/easybuild/log/eb_batch.log
echo "---------------------------------------------------"
echo "EB activity log : /sNow/easybuild/log/eb_batch.log"
echo "EB tmp logs : /sNow/easybuild/log/tmp"
echo "---------------------------------------------------"
$SBATCH_BIN $SBATCH_OPTS --wrap "$SRUN_BIN $SRUN_OPTS ; /sNow/utils/bin/update_module_index"
squeue -u snow