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

[TorchDISC] setup torch-disc building environment and CI job #158

Merged

Conversation

Yancey1989
Copy link
Collaborator

@Yancey1989 Yancey1989 commented Mar 10, 2022

This PR builds the TorchDISC pybind library _torch_disc.so with Torch LTC, Torch Blade, and official PyTorch source code.
And also add a CI job to test it with a rough way: import _torch_disc.

The CI job includes two parts to reduce the CI time:

  1. building devel docker: install PyTorch with lazy_tensor_staging branch from source code.
  2. build and test torch-disc with the devel image from step1.

Develops can build from zero with the guide https://github.com/alibaba/BladeDISC/blob/de3a386114dfcd6038c16c9fbe0737c0a6c5f6ef/torch_disc/README.md

@Yancey1989 Yancey1989 changed the title [TorchDISC] Add torch-disc building env and CI script [TorchDISC] setup torch-disc building environment and CI job Mar 10, 2022
Copy link
Collaborator

@tanyokwok tanyokwok left a comment

Choose a reason for hiding this comment

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

Overall LGTM

# CPU-TORCH181:
# uses: ./.github/workflows/cpu_reusable.yml
# with:
# extra_envs: -e TORCH_BLADE_BUILD_WITH_CUDA_SUPPORT=OFF
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Delete these codes if we don't need them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should remove the comment symbol when merging to main in the future, so I keep these jobs in the current feature branch.

apt-get install -y clang-8 clang++-8 python3.8 python3.8-dev && \
rm /usr/bin/python && \
ln -s /usr/bin/python3.8 /usr/bin/python && \
python -m pip install --upgrade pip && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use multi-stage command would improve cache hit rate, such as:

RUN apt-get install lib1 lib2
RUN python -m pip install wheel1 whee2



setup(
name='torch_disc',
Copy link
Collaborator

@tanyokwok tanyokwok Mar 15, 2022

Choose a reason for hiding this comment

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

I prefer to eventually build only one wheel between torch_blade and torch_disc since they share a lot of things. And users of PyTorch may be confused why we should have two package to support inference and training.

But I think it's fine currently in our POC version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree with that, but a latency problem is that torch-disc depends on lazy_tensor_staging feature branch of PyTorch which is different from the current version TorchBlade.

@Yancey1989 Yancey1989 merged commit 0cfccb9 into alibaba:features/torch_disc_devel Mar 15, 2022
@Yancey1989 Yancey1989 deleted the torch_disc_build_env branch March 15, 2022 03:02
Yancey1989 added a commit that referenced this pull request Apr 13, 2022
This PR builds the TorchDISC pybind library  `_torch_disc.so` with Torch LTC, Torch Blade, and official PyTorch source code.
And also add a CI job to test it with a rough way: `import _torch_disc`.

The CI job includes two parts to reduce the CI time:
1. building devel docker: install PyTorch with `lazy_tensor_staging` branch from source code.
2. build and test torch-disc with the devel image from step1.

Develops can build from zero with the guide https://github.com/alibaba/BladeDISC/blob/de3a386114dfcd6038c16c9fbe0737c0a6c5f6ef/torch_disc/README.md
Yancey1989 added a commit to Yancey1989/BladeDISC that referenced this pull request Apr 18, 2022
…#158)

This PR builds the TorchDISC pybind library  `_torch_disc.so` with Torch LTC, Torch Blade, and official PyTorch source code.
And also add a CI job to test it with a rough way: `import _torch_disc`.

The CI job includes two parts to reduce the CI time:
1. building devel docker: install PyTorch with `lazy_tensor_staging` branch from source code.
2. build and test torch-disc with the devel image from step1.

Develops can build from zero with the guide https://github.com/alibaba/BladeDISC/blob/de3a386114dfcd6038c16c9fbe0737c0a6c5f6ef/torch_disc/README.md
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.

2 participants