Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make methods.get_cpus_and_memory more general #171

Open
zhuchcn opened this issue Mar 13, 2024 · 0 comments
Open

Make methods.get_cpus_and_memory more general #171

zhuchcn opened this issue Mar 13, 2024 · 0 comments

Comments

@zhuchcn
Copy link
Member

zhuchcn commented Mar 13, 2024

The definition of the methods.get_cpus_and_memory function is too specific and should be converted to more general.

detect_cpus_and_memory = {
if (params.partition ==~ /F\d*/) {
def cpus = params.partition.replaceAll('F', '') as Integer
// F-series 1:2 CPU:memory ratio
def memory = 2 * cpus * 0.95 // 5% of memory is unavailable based on Slurm configuration
return ['cpus': cpus, 'memory': memory]
} else if (params.partition ==~ /M\d*/) {
def cpus = params.partition.replaceAll('M', '') as Integer
// M-series 1:16 CPU:memory ratio
def memory = 16 * cpus * 0.95 // %5 of memory is unavailable based on Slurm configuration
return ['cpus': cpus, 'memory': memory]
} else {
System.out.println("Failed to detect CPUs and memory for ${params.partition}. Using default values.")
return [:]
}
}

Options:

  1. Always require users to specify the number of cpus and memory per sample
  2. Use SLURM commands to get the number of cpus and memory per partition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant