Configuring number of GPUs requested

For CryoSPARC 4.6.0, is there a way to set a maximum number of GPUs requested? The request is from the line in cluster_script.sh:

#SBATCH --gres=gpu:{{ num_gpu }}

I can replace {{ num_gpu }} with a constant, but that isn’t what we need. Is there syntax that can be used here which would have the meaning of max(2, num_gpu)?

Do you mean
{{ [2, num_gpu] | max }}? That filter would request at least 2 GPUs. May I ask about the circumstances of your question?

I accidentally wrote max when I meant min. Sorry for the confusion. It sounds like {{ [2, num_gpu] | min }} would give the result we need. This is due to the limited number of GPUs available on the nodes. Thanks for the help!

Would not a request for fewer than num_gpu GPUs result in an insufficient resource allocation and, consequently, failing jobs?

I wondered about that, but have been asked to test using at most 2 GPUs. The Guide at CryoSPARC Architecture and System Requirements | CryoSPARC Guide seems to list a worker node requirement as needing at least 1 GPU (unless I’m misreading it).

More GPUs may be needed if users specify a Number of GPUs to parallelize larger than 1 in certain job types.

yes, understood, thanks!