Skip to content

Commit 848d037

Browse files
committed
Use bash style
1 parent b9d5f1a commit 848d037

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

DATA/common/setenv.sh

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

33
# Make sure we can open sufficiently many files / allocate enough memory
4-
if [ "0$SETENV_NO_ULIMIT" != "01" ]; then
5-
ulimit -S -n 4096 && ulimit -S -m unlimited && ulimit -S -v unlimited && [ -z "$GPUTYPE" ] || [ "$GPUTYPE" == "CPU" ] || ulimit -S -l unlimited
6-
if [ $? != 0 ]; then
4+
if [[ "0$SETENV_NO_ULIMIT" != "01" ]]; then
5+
ulimit -S -n 4096 && ulimit -S -m unlimited && ulimit -S -v unlimited && [[ -z "$GPUTYPE" ]] || [[ "$GPUTYPE" == "CPU" ]] || ulimit -S -l unlimited
6+
if [[ $? != 0 ]]; then
77
echo Error setting ulimits
88
exit 1
99
fi
@@ -25,92 +25,92 @@ LIST_OF_DETECTORS="ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,ZDC,FDD,HMP,FV0,TRD,MCH,C
2525
LIST_OF_GLORECO="ITSTPC,TPCTRD,ITSTPCTRD,TPCTOF,ITSTPCTOF,MFTMCH,PRIMVTX,SECVTX,AOD"
2626

2727
# Detectors used in the workflow / enabled parameters
28-
if [ -z "${WORKFLOW_DETECTORS+x}" ] || [ "0$WORKFLOW_DETECTORS" == "0ALL" ]; then export WORKFLOW_DETECTORS=$LIST_OF_DETECTORS; fi
29-
if [ -z "${WORKFLOW_DETECTORS_QC+x}" ] || [ "0$WORKFLOW_DETECTORS_QC" == "0ALL" ]; then export WORKFLOW_DETECTORS_QC="$WORKFLOW_DETECTORS,$LIST_OF_GLORECO"; fi
30-
if [ -z "${WORKFLOW_DETECTORS_CALIB+x}" ] || [ "0$WORKFLOW_DETECTORS_CALIB" == "0ALL" ]; then export WORKFLOW_DETECTORS_CALIB=$WORKFLOW_DETECTORS; fi
31-
if [ -z "${WORKFLOW_DETECTORS_RECO+x}" ] || [ "0$WORKFLOW_DETECTORS_RECO" == "0ALL" ]; then export WORKFLOW_DETECTORS_RECO=$WORKFLOW_DETECTORS; fi
32-
if [ -z "${WORKFLOW_DETECTORS_CTF+x}" ] || [ "0$WORKFLOW_DETECTORS_CTF" == "0ALL" ]; then export WORKFLOW_DETECTORS_CTF=$WORKFLOW_DETECTORS; fi
33-
if [ "0$WORKFLOW_DETECTORS_FLP_PROCESSING" == "0ALL" ]; then export WORKFLOW_DETECTORS_FLP_PROCESSING=$WORKFLOW_DETECTORS; fi
34-
if [ -z "$WORKFLOW_PARAMETERS" ]; then export WORKFLOW_PARAMETERS=; fi
35-
36-
if [ -z "$TFLOOP" ]; then export TFLOOP=0; fi # loop over timeframes
37-
if [ -z "$NTIMEFRAMES" ]; then export NTIMEFRAMES=-1; fi # max number of time frames to process, <=0 : unlimited
38-
if [ -z "$CTFDICT_NTF" ]; then export CTFDICT_NTF=100; fi # auto-save CTF dictionary after each CTFDICT_NTF TFs (if > 0)
39-
if [ -z "$CTF_MAXDETEXT" ]; then export CTF_MAXDETEXT=0; fi # extend CTF output dir.name by detectors names if their number does not exceed this
40-
if [ -z "$TFDELAY" ]; then export TFDELAY=100; fi # Delay in seconds between publishing time frames
41-
if [ -z "$GPUTYPE" ]; then export GPUTYPE=CPU; fi # GPU Tracking backend to use, can be CPU / CUDA / HIP / OCL / OCL2
42-
if [ -z "$DDSHMSIZE" ]; then export DDSHMSIZE=$(( 8 << 10 )); fi # Size of shared memory for DD Input
43-
if [ -z "$DDHDRSIZE" ]; then export DDHDRSIZE=$(( 2 << 10 )); fi # Size of shared memory for DD Input
44-
if [ -z "$GPUMEMSIZE" ]; then export GPUMEMSIZE=$(( 24 << 30 )); fi # Size of allocated GPU memory (if GPUTYPE != CPU)
45-
if [ -z "$HOSTMEMSIZE" ]; then export HOSTMEMSIZE=0; fi # Size of allocated host memory for GPU reconstruction (0 = default)
46-
if [ -z "$CREATECTFDICT" ]; then export CREATECTFDICT=0; fi # Create CTF dictionary
47-
if [ -z "$SAVECTF" ]; then export SAVECTF=0; fi # Save the CTF to a ROOT file
48-
if [ -z "$SYNCMODE" ]; then export SYNCMODE=0; fi # Run only reconstruction steps of the synchronous reconstruction
49-
if [ -z "$NUMAID" ]; then export NUMAID=0; fi # SHM segment id to use for shipping data as well as set of GPUs to use (use 0 / 1 for 2 NUMA domains)
50-
if [ -z "$NUMAGPUIDS" ]; then export NUMAGPUIDS=0; fi # NUMAID-aware GPU id selection
51-
if [ -z "$CTFINPUT" ]; then export CTFINPUT=0; fi # Read input from CTF using o2-ctf-reader (incompatible to EXTINPUT=1 and RAWTFINPUT)
52-
if [ -z "$RAWTFINPUT" ]; then export RAWTFINPUT=0; fi # Read input from raw TFs using o2-raw-tf-reader (incompatible to EXTINPUT=1 and CTFINPUT=1)
53-
if [ -z "$DIGITINPUT" ]; then export DIGITINPUT=0; fi # Read input from digit files (incompatible to EXTINPUT / CTFINPUT / RAWTFINPUT)
54-
if [ -z "$NHBPERTF" ]; then export NHBPERTF=128; fi # Time frame length (in HBF)
55-
if [ -z "$GLOBALDPLOPT" ]; then export GLOBALDPLOPT=; fi # Global DPL workflow options appended at the end
56-
if [ -z "$SEVERITY" ]; then export SEVERITY="info"; fi # Log verbosity
57-
if [ -z "$NORATELOG" ]; then export NORATELOG=1; fi # Disable FairMQ Rate Logging
58-
if [ -z "$INRAWCHANNAME" ]; then export INRAWCHANNAME=stfb-to-dpl; fi # Raw channel name used to communicate with DataDistribution
59-
if [ -z "$WORKFLOWMODE" ]; then export WORKFLOWMODE=run; fi # Workflow mode, must be run, print, od dds
60-
if [ -z "$FILEWORKDIR" ]; then export FILEWORKDIR=`pwd`; fi # Override folder where to find grp, etc.
61-
if [ -z "$RAWINPUTDIR" ]; then export RAWINPUTDIR=$FILEWORKDIR; fi # Directory where to find input files (raw files / raw tf files / ctf files)
62-
if [ -z "$EPNSYNCMODE" ]; then export EPNSYNCMODE=0; fi # Is this workflow supposed to run on EPN for sync processing? Will enable InfoLogger / metrics / fetching QC JSONs from consul...
63-
if [ -z "$BEAMTYPE" ]; then export BEAMTYPE=PbPb; fi # Beam type, must be PbPb, pp, pPb, cosmic, technical
28+
if [[ -z "${WORKFLOW_DETECTORS+x}" ]] || [[ "0$WORKFLOW_DETECTORS" == "0ALL" ]]; then export WORKFLOW_DETECTORS=$LIST_OF_DETECTORS; fi
29+
if [[ -z "${WORKFLOW_DETECTORS_QC+x}" ]] || [[ "0$WORKFLOW_DETECTORS_QC" == "0ALL" ]]; then export WORKFLOW_DETECTORS_QC="$WORKFLOW_DETECTORS,$LIST_OF_GLORECO"; fi
30+
if [[ -z "${WORKFLOW_DETECTORS_CALIB+x}" ]] || [[ "0$WORKFLOW_DETECTORS_CALIB" == "0ALL" ]]; then export WORKFLOW_DETECTORS_CALIB=$WORKFLOW_DETECTORS; fi
31+
if [[ -z "${WORKFLOW_DETECTORS_RECO+x}" ]] || [[ "0$WORKFLOW_DETECTORS_RECO" == "0ALL" ]]; then export WORKFLOW_DETECTORS_RECO=$WORKFLOW_DETECTORS; fi
32+
if [[ -z "${WORKFLOW_DETECTORS_CTF+x}" ]] || [[ "0$WORKFLOW_DETECTORS_CTF" == "0ALL" ]]; then export WORKFLOW_DETECTORS_CTF=$WORKFLOW_DETECTORS; fi
33+
if [[ "0$WORKFLOW_DETECTORS_FLP_PROCESSING" == "0ALL" ]]; then export WORKFLOW_DETECTORS_FLP_PROCESSING=$WORKFLOW_DETECTORS; fi
34+
if [[ -z "$WORKFLOW_PARAMETERS" ]]; then export WORKFLOW_PARAMETERS=; fi
35+
36+
if [[ -z "$TFLOOP" ]]; then export TFLOOP=0; fi # loop over timeframes
37+
if [[ -z "$NTIMEFRAMES" ]]; then export NTIMEFRAMES=-1; fi # max number of time frames to process, <=0 : unlimited
38+
if [[ -z "$CTFDICT_NTF" ]]; then export CTFDICT_NTF=100; fi # auto-save CTF dictionary after each CTFDICT_NTF TFs (if > 0)
39+
if [[ -z "$CTF_MAXDETEXT" ]]; then export CTF_MAXDETEXT=0; fi # extend CTF output dir.name by detectors names if their number does not exceed this
40+
if [[ -z "$TFDELAY" ]]; then export TFDELAY=100; fi # Delay in seconds between publishing time frames
41+
if [[ -z "$GPUTYPE" ]]; then export GPUTYPE=CPU; fi # GPU Tracking backend to use, can be CPU / CUDA / HIP / OCL / OCL2
42+
if [[ -z "$DDSHMSIZE" ]]; then export DDSHMSIZE=$(( 8 << 10 )); fi # Size of shared memory for DD Input
43+
if [[ -z "$DDHDRSIZE" ]]; then export DDHDRSIZE=$(( 2 << 10 )); fi # Size of shared memory for DD Input
44+
if [[ -z "$GPUMEMSIZE" ]]; then export GPUMEMSIZE=$(( 24 << 30 )); fi # Size of allocated GPU memory (if GPUTYPE != CPU)
45+
if [[ -z "$HOSTMEMSIZE" ]]; then export HOSTMEMSIZE=0; fi # Size of allocated host memory for GPU reconstruction (0 = default)
46+
if [[ -z "$CREATECTFDICT" ]]; then export CREATECTFDICT=0; fi # Create CTF dictionary
47+
if [[ -z "$SAVECTF" ]]; then export SAVECTF=0; fi # Save the CTF to a ROOT file
48+
if [[ -z "$SYNCMODE" ]]; then export SYNCMODE=0; fi # Run only reconstruction steps of the synchronous reconstruction
49+
if [[ -z "$NUMAID" ]]; then export NUMAID=0; fi # SHM segment id to use for shipping data as well as set of GPUs to use (use 0 / 1 for 2 NUMA domains)
50+
if [[ -z "$NUMAGPUIDS" ]]; then export NUMAGPUIDS=0; fi # NUMAID-aware GPU id selection
51+
if [[ -z "$CTFINPUT" ]]; then export CTFINPUT=0; fi # Read input from CTF using o2-ctf-reader (incompatible to EXTINPUT=1 and RAWTFINPUT)
52+
if [[ -z "$RAWTFINPUT" ]]; then export RAWTFINPUT=0; fi # Read input from raw TFs using o2-raw-tf-reader (incompatible to EXTINPUT=1 and CTFINPUT=1)
53+
if [[ -z "$DIGITINPUT" ]]; then export DIGITINPUT=0; fi # Read input from digit files (incompatible to EXTINPUT / CTFINPUT / RAWTFINPUT)
54+
if [[ -z "$NHBPERTF" ]]; then export NHBPERTF=128; fi # Time frame length (in HBF)
55+
if [[ -z "$GLOBALDPLOPT" ]]; then export GLOBALDPLOPT=; fi # Global DPL workflow options appended at the end
56+
if [[ -z "$SEVERITY" ]]; then export SEVERITY="info"; fi # Log verbosity
57+
if [[ -z "$NORATELOG" ]]; then export NORATELOG=1; fi # Disable FairMQ Rate Logging
58+
if [[ -z "$INRAWCHANNAME" ]]; then export INRAWCHANNAME=stfb-to-dpl; fi # Raw channel name used to communicate with DataDistribution
59+
if [[ -z "$WORKFLOWMODE" ]]; then export WORKFLOWMODE=run; fi # Workflow mode, must be run, print, od dds
60+
if [[ -z "$FILEWORKDIR" ]]; then export FILEWORKDIR=`pwd`; fi # Override folder where to find grp, etc.
61+
if [[ -z "$RAWINPUTDIR" ]]; then export RAWINPUTDIR=$FILEWORKDIR; fi # Directory where to find input files (raw files / raw tf files / ctf files)
62+
if [[ -z "$EPNSYNCMODE" ]]; then export EPNSYNCMODE=0; fi # Is this workflow supposed to run on EPN for sync processing? Will enable InfoLogger / metrics / fetching QC JSONs from consul...
63+
if [[ -z "$BEAMTYPE" ]]; then export BEAMTYPE=PbPb; fi # Beam type, must be PbPb, pp, pPb, cosmic, technical
6464
if [[ -z $IS_SIMULATED_DATA ]]; then IS_SIMULATED_DATA=1; fi # processing simulated data
65-
if [ $EPNSYNCMODE == 0 ]; then
66-
if [ -z "$SHMSIZE" ]; then export SHMSIZE=$(( 8 << 30 )); fi # Size of shared memory for messages
67-
if [ -z "$NGPUS" ]; then export NGPUS=1; fi # Number of GPUs to use, data distributed round-robin
68-
if [ -z "$EXTINPUT" ]; then export EXTINPUT=0; fi # Receive input from raw FMQ channel instead of running o2-raw-file-reader
69-
if [ -z "$EPNPIPELINES" ]; then export EPNPIPELINES=0; fi # Set default EPN pipeline multiplicities
70-
if [ -z "$SHMTHROW" ]; then export SHMTHROW=1; fi # Throw exception when running out of SHM
71-
if [ -z "$EDJSONS_DIR" ]; then export EDJSONS_DIR="jsons"; fi # output directory for ED json files
72-
if [ -z "${WORKFLOW_DETECTORS_FLP_PROCESSING+x}" ]; then export WORKFLOW_DETECTORS_FLP_PROCESSING=""; fi # No FLP processing by default when we do not run the sync EPN workflow, e.g. full system test will also run full FLP processing
65+
if [[ $EPNSYNCMODE == 0 ]]; then
66+
if [[ -z "$SHMSIZE" ]]; then export SHMSIZE=$(( 8 << 30 )); fi # Size of shared memory for messages
67+
if [[ -z "$NGPUS" ]]; then export NGPUS=1; fi # Number of GPUs to use, data distributed round-robin
68+
if [[ -z "$EXTINPUT" ]]; then export EXTINPUT=0; fi # Receive input from raw FMQ channel instead of running o2-raw-file-reader
69+
if [[ -z "$EPNPIPELINES" ]]; then export EPNPIPELINES=0; fi # Set default EPN pipeline multiplicities
70+
if [[ -z "$SHMTHROW" ]]; then export SHMTHROW=1; fi # Throw exception when running out of SHM
71+
if [[ -z "$EDJSONS_DIR" ]]; then export EDJSONS_DIR="jsons"; fi # output directory for ED json files
72+
if [[ -z "${WORKFLOW_DETECTORS_FLP_PROCESSING+x}" ]]; then export WORKFLOW_DETECTORS_FLP_PROCESSING=""; fi # No FLP processing by default when we do not run the sync EPN workflow, e.g. full system test will also run full FLP processing
7373
else # Defaults when running on the EPN
7474
if [[ "0$GEN_TOPO_CALIB_WORKFLOW" != "01" ]]; then
75-
if [ -z "$SHMSIZE" ]; then export SHMSIZE=$(( 32 << 30 )); fi
75+
if [[ -z "$SHMSIZE" ]]; then export SHMSIZE=$(( 32 << 30 )); fi
7676
else
77-
if [ -z "$SHMSIZE" ]; then export SHMSIZE=$(( 256 << 30 )); fi
77+
if [[ -z "$SHMSIZE" ]]; then export SHMSIZE=$(( 256 << 30 )); fi
7878
fi
79-
if [ -z "$NGPUS" ]; then export NGPUS=4; fi
80-
if [ -z "$EXTINPUT" ]; then export EXTINPUT=1; fi
81-
if [ -z "$EPNPIPELINES" ]; then export EPNPIPELINES=1; fi
82-
if [ -z "$SHMTHROW" ]; then export SHMTHROW=0; fi
83-
if [ -z "$TIMEFRAME_SHM_LIMIT" ]; then export TIMEFRAME_SHM_LIMIT=$(( $SHMSIZE / 2 )); fi
84-
if [ -z "$TIMEFRAME_RATE_LIMIT" ]; then export TIMEFRAME_RATE_LIMIT=0; fi
85-
if [ -z "$EDJSONS_DIR" ]; then export EDJSONS_DIR="/home/ed/jsons"; fi
86-
if [ -z "${WORKFLOW_DETECTORS_FLP_PROCESSING+x}" ]; then export WORKFLOW_DETECTORS_FLP_PROCESSING="TOF"; fi # Current default in sync processing is that FLP processing is only enabled for TOF
87-
if [ -z "$GEN_TOPO_AUTOSCALE_PROCESSES" ]; then export GEN_TOPO_AUTOSCALE_PROCESSES=1; fi # On the EPN we should make sure to always use the node to the full extent
79+
if [[ -z "$NGPUS" ]]; then export NGPUS=4; fi
80+
if [[ -z "$EXTINPUT" ]]; then export EXTINPUT=1; fi
81+
if [[ -z "$EPNPIPELINES" ]]; then export EPNPIPELINES=1; fi
82+
if [[ -z "$SHMTHROW" ]]; then export SHMTHROW=0; fi
83+
if [[ -z "$TIMEFRAME_SHM_LIMIT" ]]; then export TIMEFRAME_SHM_LIMIT=$(( $SHMSIZE / 2 )); fi
84+
if [[ -z "$TIMEFRAME_RATE_LIMIT" ]]; then export TIMEFRAME_RATE_LIMIT=0; fi
85+
if [[ -z "$EDJSONS_DIR" ]]; then export EDJSONS_DIR="/home/ed/jsons"; fi
86+
if [[ -z "${WORKFLOW_DETECTORS_FLP_PROCESSING+x}" ]]; then export WORKFLOW_DETECTORS_FLP_PROCESSING="TOF"; fi # Current default in sync processing is that FLP processing is only enabled for TOF
87+
if [[ -z "$GEN_TOPO_AUTOSCALE_PROCESSES" ]]; then export GEN_TOPO_AUTOSCALE_PROCESSES=1; fi # On the EPN we should make sure to always use the node to the full extent
8888
fi
8989
# Some more options for running on the EPN
90-
if [ -z "$INFOLOGGER_SEVERITY" ]; then export INFOLOGGER_SEVERITY="important"; fi
91-
if [ -z "$MULTIPLICITY_FACTOR_RAWDECODERS" ]; then export MULTIPLICITY_FACTOR_RAWDECODERS=1; fi
92-
if [ -z "$MULTIPLICITY_FACTOR_CTFENCODERS" ]; then export MULTIPLICITY_FACTOR_CTFENCODERS=1; fi
93-
if [ -z "$MULTIPLICITY_FACTOR_REST" ]; then export MULTIPLICITY_FACTOR_REST=1; fi
90+
if [[ -z "$INFOLOGGER_SEVERITY" ]]; then export INFOLOGGER_SEVERITY="important"; fi
91+
if [[ -z "$MULTIPLICITY_FACTOR_RAWDECODERS" ]]; then export MULTIPLICITY_FACTOR_RAWDECODERS=1; fi
92+
if [[ -z "$MULTIPLICITY_FACTOR_CTFENCODERS" ]]; then export MULTIPLICITY_FACTOR_CTFENCODERS=1; fi
93+
if [[ -z "$MULTIPLICITY_FACTOR_REST" ]]; then export MULTIPLICITY_FACTOR_REST=1; fi
9494

95-
[ -z "${SEVERITY_TPC+x}" ] && SEVERITY_TPC="info" # overrides severity for the tpc workflow
96-
[ -z "${DISABLE_MC+x}" ] && DISABLE_MC="--disable-mc"
97-
[ -z "${DISABLE_ROOT_OUTPUT+x}" ] && DISABLE_ROOT_OUTPUT="--disable-root-output"
95+
[[ -z "${SEVERITY_TPC+x}" ]] && SEVERITY_TPC="info" # overrides severity for the tpc workflow
96+
[[ -z "${DISABLE_MC+x}" ]] && DISABLE_MC="--disable-mc"
97+
[[ -z "${DISABLE_ROOT_OUTPUT+x}" ]] && DISABLE_ROOT_OUTPUT="--disable-root-output"
9898

99-
if [ `uname` == Darwin ]; then export UDS_PREFIX=; else export UDS_PREFIX="@"; fi
99+
if [[ `uname` == Darwin ]]; then export UDS_PREFIX=; else export UDS_PREFIX="@"; fi
100100

101101
if [[ $(( $EXTINPUT + $CTFINPUT + $RAWTFINPUT + $DIGITINPUT )) -ge 2 ]]; then
102102
echo Only one of EXTINPUT / CTFINPUT / RAWTFINPUT / DIGITINPUT must be set
103103
exit 1
104104
fi
105-
if [ $SAVECTF == 1 ] && [ $CTFINPUT == 1 ]; then
105+
if [[ $SAVECTF == 1 ]] && [[ $CTFINPUT == 1 ]]; then
106106
echo SAVECTF and CTFINPUT are incompatible
107107
exit 1
108108
fi
109-
if [ $SYNCMODE == 1 ] && [ $CTFINPUT == 1 ]; then
109+
if [[ $SYNCMODE == 1 ]] && [[ $CTFINPUT == 1 ]]; then
110110
echo SYNCMODE and CTFINPUT are incompatible
111111
exit 1
112112
fi
113-
if [ $WORKFLOWMODE != "run" ] && [ $WORKFLOWMODE != "print" ] && [ $WORKFLOWMODE != "dds" ] && [ $WORKFLOWMODE != "dump" ]; then
113+
if [[ $WORKFLOWMODE != "run" ]] && [[ $WORKFLOWMODE != "print" ]] && [[ $WORKFLOWMODE != "dds" ]] && [[ $WORKFLOWMODE != "dump" ]]; then
114114
echo Invalid workflow mode
115115
exit 1
116116
fi

0 commit comments

Comments
 (0)