<#1843 [Extended Resources] GPU Accelerators > Pul...
# flyte-github
a
#1843 [Extended Resources] GPU Accelerators Pull request opened by jeevb TL;DR Adds support for specifying extended resources (e.g. accelerator type - gpu device, partition size etc.) to allocate to a task. Type ☐ Bug Fix ☑︎ Feature ☐ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☑︎ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description Added support for populating
ExtendedResources
from the
@task
decorator or node
.with_overrides()
. Currently only supports the ability to specify the GPU accelerator to use for a specific task node. The following syntaxes are valid when specifying a task: No preference of GPU accelerator to use:
Copy code
@task(limits=Resources(gpu="1"))
def my_task() -> None:
    ...
Schedule on a specific GPU accelerator:
Copy code
from flytekit.extras.accelerators import T4


@task(
    limits=Resources(gpu="1"),
    accelerator=T4,
)
def my_task() -> None:
    ...
Schedule on a Multi-instance GPU (MIG) accelerator with no preference of partition size:
Copy code
from flytekit.extras.accelerators import A100


@task(
    limits=Resources(gpu="1"),
    accelerator=A100,
)
def my_task() -> None:
    ...
Schedule on a Multi-instance GPU (MIG) accelerator with a specific partition size:
Copy code
from flytekit.extras.accelerators import A100


@task(
    limits=Resources(gpu="1"),
    accelerator=A100.partition_1g_5gb,
)
def my_task() -> None:
    ...
Schedule on an unpartitioned Multi-instance GPU (MIG) accelerator:
Copy code
from flytekit.extras.accelerators import A100


@task(
    limits=Resources(gpu="1"),
    accelerator=A100.unpartitioned,
)
def my_task() -> None:
    ...
An override can also be specified for the GPU accelerator to use, as follows:
Copy code
from flytekit.extra.accelerators import A100, T4


@task(
    limits=Resources(gpu="1"),
    accelerator=T4,
)
def my_task() -> str:
    return "hello"

@workflow
def my_wf() -> str:
    return my_task().with_overrides(
        accelerator=A100.partition_1g_5gb
    )
Tracking Issue https://github.com/flyteorg/flyte/issues/ Follow-up issue NA OR https://github.com/flyteorg/flyte/issues/ flyteorg/flytekit ✅ All checks have passed 30/30 successful checks