Skip to content

Conversation

@kiukchung
Copy link
Contributor

Summary:
Context: D82556202

register_fractionals
def zion_4s_80g(fractional: float = 1.0) -> Resource:
   ...

Creates:

  1. def zion_4s_80g_1(): return zion_4s_80g(fractional=EIGHTH)
  2. zion_4s_80g_2(): return zion_4s_80g(fractional=QUARTER)
  3. zion_4s_80g_4(): return zion_4s_80g(fractional=HALF)
  4. zion_4s_80g_8(): return zion_4s_80g(fractional=WHOLE)

so that we don't have to manually do this

NOTE: each of the fractional types (including WHOLE) will have resource.capabilities[IS_FRACTIONAL] == True so that we can use it as a way to determine whether a resource originates from a fractional named resource.

Reviewed By: ajauhri

Differential Revision: D82594325

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 18, 2025
@facebook-github-bot
Copy link
Contributor

@kiukchung has exported this pull request. If you are a Meta employee, you can view the originating diff in D82594325.

@facebook-github-bot
Copy link
Contributor

@kiukchung has exported this pull request. If you are a Meta employee, you can view the originating diff in D82594325.

facebook-github-bot pushed a commit that referenced this pull request Sep 18, 2025
…togenerate aliases and fractionals, migrate zion_4s_80g to use it. (#1121)

Summary:

Context: D82556202

```
named_resource(aliases=["zion4s_80g"], fractionals=powers_of_two_gpus)
def zion_4s_80g(fractional: float = 1.0) -> Resource:
   ...
```

Registers the named resources:

1. `zion_4s_80g` and the alias `zion4s_80g`
1. `zion_4s_80g_1 == zion_4s_80g(fractional=EIGHTH)`
1. `zion_4s_80g_2 == zion_4s_80g(fractional=QUARTER)`
1. `zion_4s_80g_4 == zion_4s_80g(fractional=HALF)`
1. `zion_4s_80g_8 == zion_4s_80g(fractional=WHOLE)`

so that we don't have to manually do this.

The auto-generated fractionals will return `True` when:

```
from torchx.specs.fb.resource import is_fractional
from torchx.specs import get_named_resource

assert is_fractional(get_named_resource("zion_4s_80g_1")) == True
assert is_fractional(get_named_resource("zion_4s_80g_2")) == True
assert is_fractional(get_named_resource("zion_4s_80g_4")) == True
assert is_fractional(get_named_resource("zion_4s_80g_8")) == True

assert is_fractional(get_named_resource("zion_4s_80g")) == False
```

NOTE:  each of the fractional types (including WHOLE) will have `resource.capabilities[IS_FRACTIONAL] == True` so that we can use it as a way to determine whether a resource originates from a fractional named resource.

Reviewed By: ajauhri, highker

Differential Revision: D82594325
@facebook-github-bot
Copy link
Contributor

@kiukchung has exported this pull request. If you are a Meta employee, you can view the originating diff in D82594325.

…togenerate aliases and fractionals, migrate zion_4s_80g to use it. (#1121)

Summary:

Context: D82556202

```
named_resource(aliases=["zion4s_80g"], fractionals=powers_of_two_gpus)
def zion_4s_80g(fractional: float = 1.0) -> Resource:
   ...
```

Registers the named resources:

1. `zion_4s_80g` and the alias `zion4s_80g`
1. `zion_4s_80g_1 == zion_4s_80g(fractional=EIGHTH)`
1. `zion_4s_80g_2 == zion_4s_80g(fractional=QUARTER)`
1. `zion_4s_80g_4 == zion_4s_80g(fractional=HALF)`
1. `zion_4s_80g_8 == zion_4s_80g(fractional=WHOLE)`

so that we don't have to manually do this.

The auto-generated fractionals will return `True` when:

```
from torchx.specs.fb.resource import is_fractional
from torchx.specs import get_named_resource

assert is_fractional(get_named_resource("zion_4s_80g_1")) == True
assert is_fractional(get_named_resource("zion_4s_80g_2")) == True
assert is_fractional(get_named_resource("zion_4s_80g_4")) == True
assert is_fractional(get_named_resource("zion_4s_80g_8")) == True

assert is_fractional(get_named_resource("zion_4s_80g")) == False
```

NOTE:  each of the fractional types (including WHOLE) will have `resource.capabilities[IS_FRACTIONAL] == True` so that we can use it as a way to determine whether a resource originates from a fractional named resource.

Reviewed By: ajauhri, highker

Differential Revision: D82594325
@facebook-github-bot
Copy link
Contributor

@kiukchung has exported this pull request. If you are a Meta employee, you can view the originating diff in D82594325.

@facebook-github-bot facebook-github-bot merged commit 6ab9f69 into main Sep 18, 2025
21 of 22 checks passed
@facebook-github-bot facebook-github-bot deleted the export-D82594325 branch September 18, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants