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

GKE GPU A3 with TCPX support #517

Merged
merged 45 commits into from
Jun 29, 2024
Merged

GKE GPU A3 with TCPX support #517

merged 45 commits into from
Jun 29, 2024

Conversation

samos123
Copy link
Contributor

@samos123 samos123 commented Jun 11, 2024

Add the ability to launch GPU jobs directly on GKE

Test cases I ran:

Fuji 7b single host per device batch 8 is working too:

BASTION_TIER=1 axlearn gcp gke start --instance_type=gpu-a3-highgpu-8g-8 \
        --cluster=daily-run-single-zone-gker27 --num_replicas=1 \
        --queue multislice-queue \
        --bundler_spec=allow_dirty=True \
        --bundler_type=artifactregistry --bundler_spec=image=gpu \
        --bundler_spec=dockerfile=Dockerfile --bundler_spec=target=gpu \
        -- mkdir -p /tmp/test_trainer\; python3 -m axlearn.common.launch_trainer_main \
  --module=text.gpt.c4_trainer --config=fuji-7B-v1-single-host \
  --trainer_dir=/tmp/test_trainer --data_dir=gs://axlearn-public/tensorflow_datasets \
  --jax_backend=gpu

step time on single node: 2.06 seconds

Fuji 7b 32 nodes batch per device 8:

BASTION_TIER=1 axlearn gcp gke start --instance_type=gpu-a3-highgpu-8g-256 \
        --cluster=daily-run-single-zone-gker27 --num_replicas=32 \
        --queue multislice-queue \
        --bundler_spec=allow_dirty=True \
        --bundler_type=artifactregistry --bundler_spec=image=gpu \
        --bundler_spec=dockerfile=Dockerfile --bundler_spec=target=gpu \
        -- mkdir -p /tmp/test_trainer\; python3 -m axlearn.common.launch_trainer_main \
  --module=text.gpt.c4_trainer --config=fuji-7B-v1 \
  --trainer_dir=/tmp/test_trainer --data_dir=gs://axlearn-public/tensorflow_datasets \
  --jax_backend=gpu

step time on 32 nodes: 3.03 seconds

Fuji 7b 64 nodes batch per device 4:

BASTION_TIER=1 axlearn gcp gke start --instance_type=gpu-a3-highgpu-8g-512 \
        --cluster=daily-run-single-zone-gker27 --num_replicas=64 \
        --queue multislice-queue \
        --bundler_spec=allow_dirty=True \
        --bundler_type=artifactregistry --bundler_spec=image=gpu \
        --bundler_spec=dockerfile=Dockerfile --bundler_spec=target=gpu \
        -- mkdir -p /tmp/test_trainer\; python3 -m axlearn.common.launch_trainer_main \
  --module=text.gpt.c4_trainer --config=fuji-7B-v1 \
  --trainer_dir=/tmp/test_trainer --data_dir=gs://axlearn-public/tensorflow_datasets \
  --jax_backend=gpu

Step time A3 3.92 seconds (note A3+ this is 1.785 seconds).

I plan to work on A3+ support in a separate PR.

@samos123 samos123 marked this pull request as draft June 11, 2024 05:54
Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

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

A quick skim through...

Dockerfile Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/common/launch.py Show resolved Hide resolved
axlearn/cloud/gcp/jobs/gke_runner.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
@samos123 samos123 requested a review from markblee June 13, 2024 07:17
@samos123 samos123 changed the title WIP GKE GPU A3 with TCPX support GKE GPU A3 with TCPX support Jun 13, 2024
@samos123 samos123 marked this pull request as ready for review June 13, 2024 17:28
@samos123 samos123 force-pushed the gke-gpu branch 2 times, most recently from 0ca01ac to 4aa8b09 Compare June 13, 2024 19:11
Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

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

Thanks, overall looks reasonable. Can we add/update tests for changes in job.py and gke_runner.py?

axlearn/cloud/gcp/job.py Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/experiments/text/gpt/c4_trainer.py Outdated Show resolved Hide resolved
@samos123
Copy link
Contributor Author

samos123 commented Jun 14, 2024

I have addressed all comments, some with fixes and some with responses instead.

I've added tests for GPUGKEJob. I also added some basic tests in the gke_runner

@samos123 samos123 requested a review from markblee June 14, 2024 23:25
Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me after final comments.

axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/common/launch.py Show resolved Hide resolved
@samos123 samos123 requested a review from markblee June 17, 2024 22:29
@samos123
Copy link
Contributor Author

I did another test on single node but still waiting for multi-node results. The single node result was able to verify that ; works instead of \n.

Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

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

Can we leave a comment "Done" for comments which have been addressed? (See also: https://github.com/apple/axlearn/blob/main/CONTRIBUTING.md)

axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/job.py Outdated Show resolved Hide resolved
@samos123 samos123 requested a review from markblee June 17, 2024 22:59
@samos123
Copy link
Contributor Author

I resolved all comments and fixed missing punctation

Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

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

Thanks!

@samos123 samos123 requested a review from markblee June 18, 2024 19:11
@samos123
Copy link
Contributor Author

Seems Circle CI is awaiting someone to approve the run?

@samos123
Copy link
Contributor Author

Seems it was approved but there was a Circe CI Apple Auth error: https://app.circleci.com/pipelines/github/apple/axlearn/1925/workflows/99dbcc0a-7a9f-4338-8ec3-0cc2724a9e28
I can't see what the error is though. So will probably need @markblee to take a look?

@samos123 samos123 force-pushed the gke-gpu branch 2 times, most recently from 0c54895 to 3877a39 Compare June 18, 2024 22:39
@samos123 samos123 requested a review from markblee June 18, 2024 22:39
@samos123
Copy link
Contributor Author

Looks like Apple Authenticate in circle ci is still failing but I don't see the logs.

@markblee markblee added this pull request to the merge queue Jun 28, 2024
Merged via the queue into apple:main with commit 4454f54 Jun 29, 2024
3 checks passed
madrob pushed a commit that referenced this pull request Jul 2, 2024
* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs
github-merge-queue bot pushed a commit that referenced this pull request Jul 3, 2024
* Open-source MoE (#547)

* MoE

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Xianzhi Du <[email protected]>

* Supports return_aux in PipelinedTransformerLayer. (#557)

* link fix (#561)

Co-authored-by: Xianzhi Du <[email protected]>

* GKE GPU A3 with TCPX support (#517)

* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs

* [inference] remove unncessary mocks and use absolute imports (#563)

Co-authored-by: guoli-yin <[email protected]>

* Minor style changes. (#564)

* add support different layer order in conformer

* update

* address review feedback

* fix formatting

* fix black

---------

Co-authored-by: xianzhi <[email protected]>
Co-authored-by: Xianzhi Du <[email protected]>
Co-authored-by: Mark Lee <[email protected]>
Co-authored-by: Sam Stoelinga <[email protected]>
Co-authored-by: Guoli Yin <[email protected]>
Co-authored-by: guoli-yin <[email protected]>
Co-authored-by: Yongqiang Wang <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jul 9, 2024
* Open-source MoE (#547)

* MoE

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Xianzhi Du <[email protected]>

* Supports return_aux in PipelinedTransformerLayer. (#557)

* link fix (#561)

Co-authored-by: Xianzhi Du <[email protected]>

* GKE GPU A3 with TCPX support (#517)

* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs

* [inference] remove unncessary mocks and use absolute imports (#563)

Co-authored-by: guoli-yin <[email protected]>

* Minor style changes. (#564)

* Increases the maximum number of outputs in tb image.

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host

---------

Co-authored-by: xianzhi <[email protected]>
Co-authored-by: Xianzhi Du <[email protected]>
Co-authored-by: Mark Lee <[email protected]>
Co-authored-by: Sam Stoelinga <[email protected]>
Co-authored-by: Guoli Yin <[email protected]>
Co-authored-by: guoli-yin <[email protected]>
qdavid1 pushed a commit to qdavid1/axlearn that referenced this pull request Dec 11, 2024
* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs
qdavid1 pushed a commit to qdavid1/axlearn that referenced this pull request Dec 11, 2024
* Open-source MoE (#547)

* MoE

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Xianzhi Du <[email protected]>

* Supports return_aux in PipelinedTransformerLayer. (apple#557)

* link fix (#561)

Co-authored-by: Xianzhi Du <[email protected]>

* GKE GPU A3 with TCPX support (apple#517)

* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs

* [inference] remove unncessary mocks and use absolute imports (apple#563)

Co-authored-by: guoli-yin <[email protected]>

* Minor style changes. (apple#564)

* add support different layer order in conformer

* update

* address review feedback

* fix formatting

* fix black

---------

Co-authored-by: xianzhi <[email protected]>
Co-authored-by: Xianzhi Du <[email protected]>
Co-authored-by: Mark Lee <[email protected]>
Co-authored-by: Sam Stoelinga <[email protected]>
Co-authored-by: Guoli Yin <[email protected]>
Co-authored-by: guoli-yin <[email protected]>
Co-authored-by: Yongqiang Wang <[email protected]>
qdavid1 pushed a commit to qdavid1/axlearn that referenced this pull request Dec 11, 2024
* Open-source MoE (#547)

* MoE

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Xianzhi Du <[email protected]>

* Supports return_aux in PipelinedTransformerLayer. (apple#557)

* link fix (#561)

Co-authored-by: Xianzhi Du <[email protected]>

* GKE GPU A3 with TCPX support (apple#517)

* add GKE GPU support to axlearn

* add volumes and initContainer

* finish up the pod spec

* add GKE runner for GPU

* extend != append duhh

* fix volume mount change

* add local queue for internal cluster

* move kueue annotation to jobset

* introduce gpu container image

* add ld_library_path

* add env variables for a3

* ensure replicas of jobset is 1

* automatically set distributed coordinator as env variables

* change NCCL_DEBUG to warn

* install gpu jax using pyproject.toml

* address comments from Mark

* fix missing sidecar

* remove accidental double quote

* add default XLA flags

* hardcode max step to 1000

* fix sidecar command

* fix sidecar termination

* allow passing queue name through flag

* port over remaining xla flags

* only use bare minimum xla flags

* address Marks' nit on using env_vars.update

* remove flags that make perf worse

* remove tpu np provionser from gpu runner

* add mesh rule

* Revert "hardcode max step to 1000"

This reverts commit 8cda4f91414c00deb28c7f15d54d183076101d8b.

* add doc for queue flag

* fix punctuation and add link to tcpx docs

* more puntuation

* document NCCL env vars

* throw error if GCS mount is set

* throw error when pre provisioner is enabled

* add testing coverage for GPUGKEJob

* add basic gke_runner tests

* add more gke_runner tests

* address pr comments

* add space

* fix missing .

* add missing space

* fix pytype error in job_test.py

* update golden configs

* [inference] remove unncessary mocks and use absolute imports (apple#563)

Co-authored-by: guoli-yin <[email protected]>

* Minor style changes. (apple#564)

* Increases the maximum number of outputs in tb image.

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host.txt

* Revert fuji-7B-v1-flash-single-host

---------

Co-authored-by: xianzhi <[email protected]>
Co-authored-by: Xianzhi Du <[email protected]>
Co-authored-by: Mark Lee <[email protected]>
Co-authored-by: Sam Stoelinga <[email protected]>
Co-authored-by: Guoli Yin <[email protected]>
Co-authored-by: guoli-yin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants