Skip to content

Instantly share code, notes, and snippets.

@Tushar-N
Last active August 28, 2019 22:51
Show Gist options
  • Save Tushar-N/11fc5b57d369af4d00a2c143492e0326 to your computer and use it in GitHub Desktop.
Save Tushar-N/11fc5b57d369af4d00a2c143492e0326 to your computer and use it in GitHub Desktop.
Condor submit script: use csub <cmd> from a submit node
cmd=$@
cv_dir=`expr "$cmd" : '.*--cv_dir \([^ ]*\).*'`
mkdir -p $cv_dir
# temporarily create two files: submit.sh and run.sh
cat > $cv_dir/submit.sh << EOF
universe = vanilla
Executable = /lusr/bin/bash
Arguments = $cv_dir/run.sh
+Group = "GRAD"
+Project = "AI_ROBOTICS"
+ProjectDescription = "Research Work"
Requirements = TARGET.GPUSlot
getenv = True
request_GPUs = 1
+GPUJob = true
Log = $cv_dir/run.log
Error = $cv_dir/run.err
Output = $cv_dir/run.out
Queue 1
EOF
# For CPU jobs:
# Requirements = (Narsil == true) || (Uvanimor == true) || (Rhavan == true)
# Rank = ((Narsil == true)*3) + ((Uvanimor == true)*2) + (Rhavan == true)
cat > $cv_dir/run.sh << EOF
source activate cuda10; $cmd
EOF
# Call condor_submit on the generated submit_file
source ~/.bashrc
condor_submit $cv_dir/submit.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment