Skip to main content

HPC – Submission Tips

  •  When submitting a job that uses multiple cores, e.g. with foreach, in the batch submission file, make sure to include the line:
    #BSUB -R "span[hosts=1]"
    otherwise it will send your jobs across multiple nodes, which can cause issues. It’s better to have all your cores on one node which I didn’t realize. (The quotes are not in the online documentation but is apparently more general.)
  • Related to that, when assigning the number of cores in your script, use the code:
    ncores <- strtoi(Sys.getenv(c("LSB_DJOB_NUMPROC")))
    This command will pull the number of cores assigned to your job from the HPC environment. I had been using:
     ncores <- detectCores()
    When run on the HPC, detectCores() will detect the number of free cores on the node, so it will use more cores than your job had been assigned, up to 32 depending on what is available on the node. If your job is distributed on multiple nodes, it will do something like pull the max cores available on each node.
  • When submitting your batch submission file, if you don’t want to necessarily wait a long time for a node to free up with the number of cores you’re requesting, you can use:
    #BSUB -n "4,16" instead of  #BSUB -n 16
    This will assign a minimum of 4 cores and a maximum of 16 cores to your job.
  • There is now browser access to the HPC, from https://hpc.ncsu.edu/Documents/Login.php go to the link in the first sentence for Open OnDemand. You can open a terminal window in your browser without having to log in/use DuoMobile by selecting “Hazel Shell Access” under “Clusters.” By using the “Files” dropdown you can easily copy and paste files between your local machine and the cluster.
  • We should all have access to the statistics queue for jobs which we have higher priority for than other queues. In your batch submission file, include: #BSUB -q stat
  • Here is a sample batch submission file which incorporates these changes:
    #!/bin/tcsh
    #BSUB -n "8,16"
    #BSUB -W 16:00
    #BSUB -R "span[hosts=1]"
    #BSUB -J vs_sims_int
    #BSUB -e stderr.%J
    #BSUB -q stat
    cd /share/$GROUP/$USER/written_sims
    conda activate env_R421
    Rscript run_sims_vs_int.R