From f7f3f2896e19a876b6cfd00a8fb59798c4fc5f98 Mon Sep 17 00:00:00 2001 From: Yassin Khalifa Date: Fri, 23 Aug 2024 12:15:24 -0400 Subject: [PATCH] Adding gres handling for teach (#259) Adding srun's gres parameter handling logic for teach in order to pass the requested gres and set the default num_gpus if not requested when c=teach and p=gpu --- apps/crc_interactive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/crc_interactive.py b/apps/crc_interactive.py index 84b382a..35fcb8e 100755 --- a/apps/crc_interactive.py +++ b/apps/crc_interactive.py @@ -116,7 +116,7 @@ def parse_args(self, args=None, namespace=None) -> Namespace: # Set defaults that need to be determined dynamically if not args.num_gpus: - args.num_gpus = 1 if args.gpu else 0 + args.num_gpus = 1 if (args.gpu or (args.teach and (args.partition == 'gpu'))) else 0 # Check wall time is between limits, enable both %H:%M format and integer hours check_time = args.time.hour + args.time.minute / 60 + args.time.second / 3600 @@ -171,7 +171,7 @@ def create_srun_command(self, args: Namespace) -> str: srun_args += ' ' + srun_arg_name.format(arg_value) # The --gres argument in srun needs some special handling so is missing from the above dict - if (args.gpu or args.invest) and args.num_gpus: + if (args.gpu or args.invest or (args.teach and (args.partition == 'gpu'))) and args.num_gpus: srun_args += ' ' + f'--gres=gpu:{args.num_gpus}' try: