Skip to content

.github: Add GitHub Actions workflow to build wheels#50633

Closed
seemethere wants to merge 11 commits intomasterfrom
seemethere/actions_wheels
Closed

.github: Add GitHub Actions workflow to build wheels#50633
seemethere wants to merge 11 commits intomasterfrom
seemethere/actions_wheels

Conversation

@seemethere
Copy link
Copy Markdown
Member

@seemethere seemethere commented Jan 15, 2021

Adds an initial draft for a workflow that'll build our release binaries for Linux wheels

Signed-off-by: Eli Uriegas eliuriegas@fb.com

"gpu_arch_type": gpu_arch_type,
"container_image": CONTAINER_IMAGES[arch]
})
return json.dumps({"include": matrix})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's important that this is include and not includes

@seemethere seemethere force-pushed the seemethere/actions_wheels branch from 0200170 to e9bcbc1 Compare January 22, 2021 00:02
Comment thread .github/workflows/linux_wheel.yml
- id: set-matrix
run: |
# outputting for debugging purposes
python .github/scripts/generate_binary_build_matrix.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason to run the script twice rather than running once and echoing the output twice (the second time with ::set-output)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I like outputting the matrix in the first run for debugging purposes so we can see what the actual json blob looks like. perhaps it’d be better to just store that json blob as an artifact for later debugging purposes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess I just meant, why run the script twice when the output is the same? Why not instead do something like this?

MATRIX=$(python .github/scripts/generate_binary_build_matrix.py)
echo "${MATRIX}" # outputting for debugging purposes
echo "::set-output name=matrix::${MATRIX}"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh you could potentially do that, but running the script is at a fairly low cost

uses: actions/checkout@v2
- id: set-matrix
run: |
# outputting for debugging purposes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

apparently omitting the name here causes GHA to use the first line of the shell script as the step name

Comment on lines +20 to +22
MATRIX=$(python .github/scripts/generate_binary_build_matrix.py)
echo "::set-output name=matrix::${MATRIX}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a limit to the size of a string that can be passed this way as an output to the next job?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No limit afaik

Comment on lines +17 to +46
CUDA_ARCHES = [
"10.1",
"10.2",
"11.0"
]

ROCM_ARCHES = [
"3.10",
"4.0"
]

FULL_ARCHES = [
"cpu",
*CUDA_ARCHES,
*ROCM_ARCHES
]

CONTAINER_IMAGES = {
**{
# TODO: Re-do manylinux CUDA image tagging scheme to be similar to
# ROCM so we don't have to do this replacement
gpu_arch: f"pytorch/manylinux-cuda{gpu_arch.replace('.', '')}"
for gpu_arch in CUDA_ARCHES
},
**{
gpu_arch: f"pytorch/manylinux-rocm:{gpu_arch}"
for gpu_arch in ROCM_ARCHES
},
"cpu": "pytorch/manylinux-cpu"
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this is assuming that no cuda version shares its version number with a rocm version? is there a reason we don't just put "cuda" or "rocm" directly into the arch name?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's because I don't want to do a transformation of the value from here to the build scripts, so basically it's to just keep the number as transparent as possible from this point to the build point.

Although a better solution would be to not pass a variable at all and just have it all depend on the container image where the arch version would be automatically baked in as a number into the container image.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This approached is outlined in this PR: #45091

seemethere and others added 5 commits January 25, 2021 18:18
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
@seemethere seemethere force-pushed the seemethere/actions_wheels branch from f73d373 to e42efe4 Compare January 26, 2021 02:18
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2021

Codecov Report

Merging #50633 (5a3be0f) into master (5adbace) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #50633      +/-   ##
==========================================
- Coverage   80.91%   80.91%   -0.01%     
==========================================
  Files        1926     1926              
  Lines      210291   210291              
==========================================
- Hits       170152   170149       -3     
- Misses      40139    40142       +3     

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
@seemethere seemethere changed the title WIP actions workflow to build wheels .github: Add GitHub Actions workflow to build wheels Jan 26, 2021
@seemethere seemethere added the module: ci Related to continuous integration label Jan 26, 2021
@seemethere seemethere requested a review from a team January 26, 2021 20:48
@seemethere seemethere marked this pull request as ready for review January 26, 2021 20:48
@seemethere
Copy link
Copy Markdown
Member Author

This is now ready for review, the workflow won't actually run (except on workflow_dispatch), but there'll be follow up PR to disable the wheel builds in the nightly CircleCI run and enable the cron trigger for this workflow (with uploads)

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@seemethere has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
@seemethere seemethere force-pushed the seemethere/actions_wheels branch from ce37fec to 1e134f4 Compare January 26, 2021 20:52
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@seemethere has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.


jobs:
generate-build-matrix:
if: ${{ github.repository_owner == 'pytorch' }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does this just mean "if not on a fork"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Basically, this was added in response to #49934

Comment on lines +15 to +16
container:
image: python:3.9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could do this, doesn't matter too much though:

Suggested change
container:
image: python:3.9
container: python:3.9

Comment on lines +34 to +35
container:
image: ${{ matrix.container_image }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same idea as above:

Suggested change
container:
image: ${{ matrix.container_image }}
container: ${{ matrix.container_image }}

although I'm not sure if this has the potential break things e.g. if matrix.container_image is itself a map rather than just a string

parser.add_argument(
"--no-build-suffix",
type=strtobool,
help="Whether or not to add a build suffix typically (+cpu)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found these helpstrings a bit hard to understand (similar suggestions for the other two below); maybe something like this?

Suggested change
help="Whether or not to add a build suffix typically (+cpu)",
help="Don't add a build suffix (e.g. '+cpu')",

parser.add_argument(
"--gpu-arch-type",
type=str,
help="GPU arch you are building for, typically (cpu, cuda, rocm)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
help="GPU arch you are building for, typically (cpu, cuda, rocm)",
help="GPU arch you are building for (e.g. cpu, cuda, rocm)",

parser.add_argument(
"--gpu-arch-version",
type=str,
help="GPU arch version, typically (10.2, 4.0), leave blank for CPU",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
help="GPU arch version, typically (10.2, 4.0), leave blank for CPU",
help="GPU arch version (e.g. 10.2 or 4.0), leave blank for CPU",

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@seemethere merged this pull request in 1b7a4f9.

facebook-github-bot pushed a commit that referenced this pull request Mar 19, 2021
Summary:
Based on #50633 and #51243.

Things left to do:

- [x] modify `.github/scripts/generate_binary_build_matrix.py` further
  - [x] add option for not iterating over Python version
  - [x] add `LIBTORCH_VARIANT`
  - [x] add option for cxx11
  - [x] fix the artifact uploading
  - [x] remove `pull_request` hook before merging

Pull Request resolved: #53292

Test Plan: [CI](https://github.com/pytorch/pytorch/actions/runs/665781075).

Reviewed By: seemethere

Differential Revision: D27189150

Pulled By: samestep

fbshipit-source-id: ec91e1f0b75b8c93613d55801585ed975697be03
@github-actions github-actions Bot deleted the seemethere/actions_wheels branch February 10, 2024 01:54
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Fixes #{issue number}

Pull Request resolved: pytorch#50633

Reviewed By: samestep

Differential Revision: D26083492

Pulled By: seemethere

fbshipit-source-id: c133671b9cf5074539133ee79fca5c680793a85d
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Based on pytorch#50633 and pytorch#51243.

Things left to do:

- [x] modify `.github/scripts/generate_binary_build_matrix.py` further
  - [x] add option for not iterating over Python version
  - [x] add `LIBTORCH_VARIANT`
  - [x] add option for cxx11
  - [x] fix the artifact uploading
  - [x] remove `pull_request` hook before merging

Pull Request resolved: pytorch#53292

Test Plan: [CI](https://github.com/pytorch/pytorch/actions/runs/665781075).

Reviewed By: seemethere

Differential Revision: D27189150

Pulled By: samestep

fbshipit-source-id: ec91e1f0b75b8c93613d55801585ed975697be03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged module: ci Related to continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants