In NamedGPUCombination.should_execute_combination, check if number_of_required_gpus > 0
before making a call to context.num_gpus(), since if number_of_required_gpus
is zero, it does not even need to query the number of gpus available.
This alleviates the requirement that collective ops needs to be configured at program startup for cases where gpu is not needed, because this code path is run when using combinations, which forces collective ops to be configured even before the test body is run. PiperOrigin-RevId: 281685344 Change-Id: Ic53c3a50c95c512bd88cf685a6f50c1867b469b7
This commit is contained in:
parent
a2435de245
commit
915bef5c6a
@ -79,7 +79,8 @@ class NamedGPUCombination(test_combinations.TestCombination):
|
||||
|
||||
if not number_of_required_gpus and GPUCombination.GPU_TEST:
|
||||
return (False, "Test that doesn't require GPUs.")
|
||||
elif context.num_gpus() < number_of_required_gpus:
|
||||
elif (number_of_required_gpus > 0
|
||||
and context.num_gpus() < number_of_required_gpus):
|
||||
return (False, ("Only {} of {} required GPUs are available.".format(
|
||||
context.num_gpus(), number_of_required_gpus)))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user