Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion xmanager/cloud/vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ def get_machine_spec(job: xm.Job) -> Dict[str, Any]:
for resource, value in requirements.task_requirements.items():
accelerator_type = None
if resource in xm.GpuType:
accelerator_type = 'NVIDIA_TESLA_' + str(resource).upper()
# TODO(b/289373107): Remove this special case.
if resource == xm.GpuType.L4_24TH:
accelerator_type = 'NVIDIA_L4'
else:
accelerator_type = 'NVIDIA_TESLA_' + str(resource).upper()
elif resource in xm.TpuType:
accelerator_type = _CLOUD_TPU_ACCELERATOR_TYPES[resource]
if accelerator_type:
Expand Down
18 changes: 18 additions & 0 deletions xmanager/cloud/vertex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@ def test_get_machine_spec_a100(self):
},
)

def test_get_machine_spec_l4(self):
job = xm.Job(
executable=local_executables.GoogleContainerRegistryImage('name', ''),
executor=local_executors.Vertex(
requirements=xm.JobRequirements(l4_24th=2)
),
args={},
)
machine_spec = vertex.get_machine_spec(job)
self.assertDictEqual(
machine_spec,
{
'machine_type': 'g2-standard-4',
'accelerator_type': vertex.aip_v1.AcceleratorType.NVIDIA_L4,
'accelerator_count': 2,
},
)

def test_get_machine_spec_tpu(self):
job = xm.Job(
executable=local_executables.GoogleContainerRegistryImage('name', ''),
Expand Down