Nextflow.config file with Slurm compatibility
process {
executor = 'slurm'
time = < number of hours ('h') days ('d') to let job run eg. '3d' >
cpus = < number of cpus to request eg. 32>
memory = < amount of RAM to request eg.'100.GB'>
}
PLEASE NOTE
These values need to be chosen carefully. If the time variable is not high enough, then the nextflow job may quit before it can complete. This is because
nextflow submits these jobs through slurm which have a default max run time of 30 minutes. The longest your job can run on the HPC is 7 days.
Some tools required a certain amount of memory to be allocated (usually aligners). If you don't reserve enough, your job may error out.
Most tools have a flag to specify the number of cpus to use (may look like -cpu, -threads, --threads etc. Please see the documentation of the tool you're using to correctly specify)
to supply that information in the workflow block there is a parameter called ${task.cpus}
If you do not specify the number of threads for some processes (blastx is an offender) then it may default to a number of cpus specified in the tool - despite the fact you have requested to use a large number of cpus. This can severely increase the amount of time it will take your job to complete.
To correctly indicate the number of cpus for a process, see below.
(In nextflow.config)
process {
executor = 'slurm'
time = '5d'
cpus = 38
memory = '300.GB'
}
(In <your_nf_script>.nf)
process my_task {
script:
"""
my_command --threads ${task.cpus}
"""
}