Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AWS Inf2 instances support for aws_batch scheduler #977

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shixianc
Copy link

Add AWS Inf2 instances support for aws_batch scheduler. There're usecases to use torchx to launch data parallel inference jobs on inf2 instances on AWS Batch.

Configurations are referencing https://aws.amazon.com/ec2/instance-types/inf2/

Test plan:
Updated unittest to cover new changes.

671 passed, 98 warnings in 177.52s (0:02:57)
❯ torchx run -s local_docker --dryrun dist.ddp -h aws_inf2.48xlarge -j 1 --m abc

=== SCHEDULER REQUEST ===

  • !!python/object:torchx.schedulers.docker_scheduler.DockerContainer
    command:
    • bash
    • -c
    • torchrun --rdzv_backend c10d --rdzv_endpoint localhost:0 --rdzv_id 'abc-kr12qr37093rz'
      --nnodes 1 --nproc_per_node 1 --tee 3 --role '' -m abc
      image: sha256:3f8f845e25030d9523bf299dee1c3ca6f2b008fc2bf0a2161ed949efe168a3e1
      kwargs:
      devices:
      • /dev/neuron0:/dev/neuron0:rwm
      • /dev/neuron1:/dev/neuron1:rwm
      • /dev/neuron2:/dev/neuron2:rwm
      • /dev/neuron3:/dev/neuron3:rwm
      • /dev/neuron4:/dev/neuron4:rwm
      • /dev/neuron5:/dev/neuron5:rwm
      • /dev/neuron6:/dev/neuron6:rwm
      • /dev/neuron7:/dev/neuron7:rwm
      • /dev/neuron8:/dev/neuron8:rwm
      • /dev/neuron9:/dev/neuron9:rwm
      • /dev/neuron10:/dev/neuron10:rwm
      • /dev/neuron11:/dev/neuron11:rwm
        environment:
        LOGLEVEL: WARNING
        TORCHX_JOB_ID: local_docker://torchx/abc-kr12qr37093rz
        TORCHX_RANK0_HOST: abc-kr12qr37093rz-abc-0
        TORCHX_TRACKING_EXPERIMENT_NAME: default-experiment
        hostname: abc-kr12qr37093rz-abc-0
        labels:
        torchx.pytorch.org/app-id: abc-kr12qr37093rz
        torchx.pytorch.org/replica-id: '0'
        torchx.pytorch.org/role-name: abc
        torchx.pytorch.org/version: 0.8.0dev0
        mem_limit: 377472m
        mounts: []
        name: abc-kr12qr37093rz-abc-0
        nano_cpus: 192000000000
        network: torchx
        privileged: false
        shm_size: 377472m

@facebook-github-bot
Copy link
Contributor

Hi @shixianc!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@shixianc
Copy link
Author

@d4l3k, @kiukchung could you help review? thanks!

Copy link
Member

@d4l3k d4l3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- can you sign the CLA?

@shixianc
Copy link
Author

LGTM -- can you sign the CLA?

Signed a few mins ago, probably take some time to propagate.

@facebook-github-bot facebook-github-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 Nov 25, 2024
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@shixianc
Copy link
Author

Hi @d4l3k
Could you help check on the lint failure? I ran locally lintrunner --skip PYRE --force-color --all-files
and returns ok No lint issues.
Is this something I need to further look into from my end?

@kiukchung
Copy link
Collaborator

@shixianc can you rebase onto main? 53933e3 updates pyre version.

@shixianc
Copy link
Author

shixianc commented Nov 26, 2024

@kiukchung @d4l3k rebased. Could you help rerun the checks?

return Resource(
cpu=4,
gpu=0,
memMB=32 * GiB,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16GB of memory not 32? Pretty sure this refers to the CPU memory not the accelerator memory

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashvinnihalani Good catch, thanks for pointing this out.

I was referencing trn1 and thought the field is for GPU memory, but then realize trn1 has same GPU and CPU memory.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashvinnihalani Updated

return Resource(
cpu=32,
gpu=0,
memMB=32 * GiB,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

128 GB of RAM

return Resource(
cpu=96,
gpu=0,
memMB=192 * GiB,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

384 GB of RAM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's 384 according to the spec: https://aws.amazon.com/ec2/instance-types/inf2/
In reality we have to use smaller number or we will get this from Batch:

Invalid memory value. It should be within the range [1, 376832]

With the current MEM_TAX=0.96:
376832/(384*1024*0.96) = 0.99826388888 => thus it has to be at most 383 with the current mem tax

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clumsy This is good insights - I gave it a bit more thoughts, I prefer to have this config to stick to actual values of the instances, and have this mem_tax logic somewhere else, so that it can apply to other instances as well.

Also, probably it depends on your setup, we did observe similar issues on inf2.48xlarge batch queue tho.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with any solution that works. This right now I'm not sure works...

)


def aws_inf2_48xlarge() -> Resource:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

768 GB of RAM

@shixianc
Copy link
Author

@ashvinnihalani @d4l3k @kiukchung I made a small correction on the config, could you help merging the CR? (not sure if linting blocker still there)

@ashvinnihalani
Copy link

@kiukchung Small ping about this.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants