@@ -453,10 +453,11 @@ class GCPCluster(VMCluster):
453
453
extra_bootstrap: list[str] (optional)
454
454
Extra commands to be run during the bootstrap phase.
455
455
ngpus: int (optional)
456
- The number of GPUs to atatch to the instance.
456
+ The number of GPUs to atatch to the worker instance. No work is expected to be done on scheduler, so no
457
+ GPU there.
457
458
Default is ``0``.
458
459
gpu_type: str (optional)
459
- The name of the GPU to use. This must be set if ``ngpus>0``.
460
+ The name of the GPU to use on worker . This must be set if ``ngpus>0``.
460
461
You can see a list of GPUs available in each zone with ``gcloud compute accelerator-types list``.
461
462
filesystem_size: int (optional)
462
463
The VM filesystem size in GB. Defaults to ``50``.
@@ -616,6 +617,8 @@ def __init__(
616
617
if machine_type is None :
617
618
self .scheduler_machine_type = scheduler_machine_type or self .config .get ("scheduler_machine_type" )
618
619
self .worker_machine_type = worker_machine_type or self .config .get ("worker_machine_type" )
620
+ if self .scheduler_machine_type is None or self .worker_machine_type is None :
621
+ raise ValueError ("machine_type and scheduler_machine_type must be set" )
619
622
else :
620
623
if scheduler_machine_type is not None or worker_machine_type is not None :
621
624
raise ValueError ("If you specify machine_type, you may not specify scheduler_machine_type or worker_machine_type" )
@@ -657,12 +660,12 @@ def __init__(
657
660
self .scheduler_options ["machine_type" ] = self .scheduler_machine_type
658
661
self .worker_options ["machine_type" ] = self .worker_machine_type
659
662
660
- if ngpus is not None :
661
- self .scheduler_options ["ngpus" ] = 0
662
- self .scheduler_options ["gpu_type" ] = None
663
- self .scheduler_options ["gpu_instance" ] = False
663
+ # Scheduler always does not have GPUs as no work is expected to be done there
664
+ self .scheduler_options ["ngpus" ] = 0
665
+ self .scheduler_options ["gpu_type" ] = None
666
+ self .scheduler_options ["gpu_instance" ] = False
664
667
665
- self .worker_ngpus = ngpus
668
+ if ngpus or self .config . get ( " ngpus" ):
666
669
self .worker_options ["ngpus" ] = ngpus or self .config .get ("ngpus" )
667
670
self .worker_options ["gpu_type" ] = gpu_type or self .config .get ("gpu_type" )
668
671
self .worker_options ["gpu_instance" ] = True
0 commit comments