Skip to content

Commit cbd68d7

Browse files
parmeetseemetherefmassa
authored andcommitted
[fbsync] add ROCm binary wheels (#3575)
Summary: * add ROCm binary wheels * fix lint error Reviewed By: fmassa Differential Revision: D27433917 fbshipit-source-id: 8c5845c28d3bd705d7d5028552d3787d0aebdd5f Co-authored-by: Eli Uriegas <[email protected]> Co-authored-by: Francisco Massa <[email protected]>
1 parent bb4ce5f commit cbd68d7

File tree

3 files changed

+159
-7
lines changed

3 files changed

+159
-7
lines changed

.circleci/config.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,11 @@ workflows:
829829
name: binary_linux_wheel_py3.6_cu111
830830
python_version: '3.6'
831831
wheel_docker_image: pytorch/manylinux-cuda111
832+
- binary_linux_wheel:
833+
cu_version: rocm4.0.1
834+
name: binary_linux_wheel_py3.6_rocm4.0.1
835+
python_version: '3.6'
836+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
832837
- binary_linux_wheel:
833838
conda_docker_image: pytorch/conda-builder:cpu
834839
cu_version: cpu
@@ -853,6 +858,11 @@ workflows:
853858
name: binary_linux_wheel_py3.7_cu111
854859
python_version: '3.7'
855860
wheel_docker_image: pytorch/manylinux-cuda111
861+
- binary_linux_wheel:
862+
cu_version: rocm4.0.1
863+
name: binary_linux_wheel_py3.7_rocm4.0.1
864+
python_version: '3.7'
865+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
856866
- binary_linux_wheel:
857867
conda_docker_image: pytorch/conda-builder:cpu
858868
cu_version: cpu
@@ -877,6 +887,11 @@ workflows:
877887
name: binary_linux_wheel_py3.8_cu111
878888
python_version: '3.8'
879889
wheel_docker_image: pytorch/manylinux-cuda111
890+
- binary_linux_wheel:
891+
cu_version: rocm4.0.1
892+
name: binary_linux_wheel_py3.8_rocm4.0.1
893+
python_version: '3.8'
894+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
880895
- binary_linux_wheel:
881896
conda_docker_image: pytorch/conda-builder:cpu
882897
cu_version: cpu
@@ -901,6 +916,11 @@ workflows:
901916
name: binary_linux_wheel_py3.9_cu111
902917
python_version: '3.9'
903918
wheel_docker_image: pytorch/manylinux-cuda111
919+
- binary_linux_wheel:
920+
cu_version: rocm4.0.1
921+
name: binary_linux_wheel_py3.9_rocm4.0.1
922+
python_version: '3.9'
923+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
904924
- binary_macos_wheel:
905925
conda_docker_image: pytorch/conda-builder:cpu
906926
cu_version: cpu
@@ -1607,6 +1627,36 @@ workflows:
16071627
python_version: '3.6'
16081628
requires:
16091629
- nightly_binary_linux_wheel_py3.6_cu111_upload
1630+
- binary_linux_wheel:
1631+
cu_version: rocm4.0.1
1632+
filters:
1633+
branches:
1634+
only: nightly
1635+
tags:
1636+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1637+
name: nightly_binary_linux_wheel_py3.6_rocm4.0.1
1638+
python_version: '3.6'
1639+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
1640+
- binary_wheel_upload:
1641+
context: org-member
1642+
filters:
1643+
branches:
1644+
only: nightly
1645+
tags:
1646+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1647+
name: nightly_binary_linux_wheel_py3.6_rocm4.0.1_upload
1648+
requires:
1649+
- nightly_binary_linux_wheel_py3.6_rocm4.0.1
1650+
subfolder: rocm4.0.1/
1651+
- smoke_test_linux_pip:
1652+
filters:
1653+
branches:
1654+
only:
1655+
- nightly
1656+
name: nightly_binary_linux_wheel_py3.6_rocm4.0.1_smoke_test_pip
1657+
python_version: '3.6'
1658+
requires:
1659+
- nightly_binary_linux_wheel_py3.6_rocm4.0.1_upload
16101660
- binary_linux_wheel:
16111661
conda_docker_image: pytorch/conda-builder:cpu
16121662
cu_version: cpu
@@ -1731,6 +1781,36 @@ workflows:
17311781
python_version: '3.7'
17321782
requires:
17331783
- nightly_binary_linux_wheel_py3.7_cu111_upload
1784+
- binary_linux_wheel:
1785+
cu_version: rocm4.0.1
1786+
filters:
1787+
branches:
1788+
only: nightly
1789+
tags:
1790+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1791+
name: nightly_binary_linux_wheel_py3.7_rocm4.0.1
1792+
python_version: '3.7'
1793+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
1794+
- binary_wheel_upload:
1795+
context: org-member
1796+
filters:
1797+
branches:
1798+
only: nightly
1799+
tags:
1800+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1801+
name: nightly_binary_linux_wheel_py3.7_rocm4.0.1_upload
1802+
requires:
1803+
- nightly_binary_linux_wheel_py3.7_rocm4.0.1
1804+
subfolder: rocm4.0.1/
1805+
- smoke_test_linux_pip:
1806+
filters:
1807+
branches:
1808+
only:
1809+
- nightly
1810+
name: nightly_binary_linux_wheel_py3.7_rocm4.0.1_smoke_test_pip
1811+
python_version: '3.7'
1812+
requires:
1813+
- nightly_binary_linux_wheel_py3.7_rocm4.0.1_upload
17341814
- binary_linux_wheel:
17351815
conda_docker_image: pytorch/conda-builder:cpu
17361816
cu_version: cpu
@@ -1855,6 +1935,36 @@ workflows:
18551935
python_version: '3.8'
18561936
requires:
18571937
- nightly_binary_linux_wheel_py3.8_cu111_upload
1938+
- binary_linux_wheel:
1939+
cu_version: rocm4.0.1
1940+
filters:
1941+
branches:
1942+
only: nightly
1943+
tags:
1944+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1945+
name: nightly_binary_linux_wheel_py3.8_rocm4.0.1
1946+
python_version: '3.8'
1947+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
1948+
- binary_wheel_upload:
1949+
context: org-member
1950+
filters:
1951+
branches:
1952+
only: nightly
1953+
tags:
1954+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
1955+
name: nightly_binary_linux_wheel_py3.8_rocm4.0.1_upload
1956+
requires:
1957+
- nightly_binary_linux_wheel_py3.8_rocm4.0.1
1958+
subfolder: rocm4.0.1/
1959+
- smoke_test_linux_pip:
1960+
filters:
1961+
branches:
1962+
only:
1963+
- nightly
1964+
name: nightly_binary_linux_wheel_py3.8_rocm4.0.1_smoke_test_pip
1965+
python_version: '3.8'
1966+
requires:
1967+
- nightly_binary_linux_wheel_py3.8_rocm4.0.1_upload
18581968
- binary_linux_wheel:
18591969
conda_docker_image: pytorch/conda-builder:cpu
18601970
cu_version: cpu
@@ -1979,6 +2089,36 @@ workflows:
19792089
python_version: '3.9'
19802090
requires:
19812091
- nightly_binary_linux_wheel_py3.9_cu111_upload
2092+
- binary_linux_wheel:
2093+
cu_version: rocm4.0.1
2094+
filters:
2095+
branches:
2096+
only: nightly
2097+
tags:
2098+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
2099+
name: nightly_binary_linux_wheel_py3.9_rocm4.0.1
2100+
python_version: '3.9'
2101+
wheel_docker_image: pytorch/manylinux-rocm:4.0.1
2102+
- binary_wheel_upload:
2103+
context: org-member
2104+
filters:
2105+
branches:
2106+
only: nightly
2107+
tags:
2108+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
2109+
name: nightly_binary_linux_wheel_py3.9_rocm4.0.1_upload
2110+
requires:
2111+
- nightly_binary_linux_wheel_py3.9_rocm4.0.1
2112+
subfolder: rocm4.0.1/
2113+
- smoke_test_linux_pip:
2114+
filters:
2115+
branches:
2116+
only:
2117+
- nightly
2118+
name: nightly_binary_linux_wheel_py3.9_rocm4.0.1_smoke_test_pip
2119+
python_version: '3.9'
2120+
requires:
2121+
- nightly_binary_linux_wheel_py3.9_rocm4.0.1_upload
19822122
- binary_macos_wheel:
19832123
conda_docker_image: pytorch/conda-builder:cpu
19842124
cu_version: cpu

.circleci/regenerate.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ def build_workflows(prefix='', filter_branch=None, upload=False, indentation=6,
2929
for btype in ["wheel", "conda"]:
3030
for os_type in ["linux", "macos", "win"]:
3131
python_versions = PYTHON_VERSIONS
32-
cu_versions_dict = {"linux": ["cpu", "cu101", "cu102", "cu111"],
32+
cu_versions_dict = {"linux": ["cpu", "cu101", "cu102", "cu111", "rocm4.0.1"],
3333
"win": ["cpu", "cu101", "cu102", "cu111"],
3434
"macos": ["cpu"]}
3535
cu_versions = cu_versions_dict[os_type]
3636
for python_version in python_versions:
3737
for cu_version in cu_versions:
38+
# ROCm conda packages not yet supported
39+
if cu_version.startswith('rocm') and btype == "conda":
40+
continue
3841
for unicode in ([False, True] if btype == "wheel" and python_version == "2.7" else [False]):
3942
fb = filter_branch
4043
if windows_latest_only and os_type == "win" and filter_branch is None and \
@@ -108,18 +111,22 @@ def upload_doc_job(filter_branch):
108111

109112

110113
def get_manylinux_image(cu_version):
111-
cu_suffix = "102"
112-
if cu_version.startswith('cu'):
114+
if cu_version == "cpu":
115+
return "pytorch/manylinux-cuda102"
116+
elif cu_version.startswith('cu'):
113117
cu_suffix = cu_version[len('cu'):]
114-
return f"pytorch/manylinux-cuda{cu_suffix}"
118+
return f"pytorch/manylinux-cuda{cu_suffix}"
119+
elif cu_version.startswith('rocm'):
120+
rocm_suffix = cu_version[len('rocm'):]
121+
return f"pytorch/manylinux-rocm:{rocm_suffix}"
115122

116123

117124
def get_conda_image(cu_version):
118125
if cu_version == "cpu":
119126
return "pytorch/conda-builder:cpu"
120-
if cu_version.startswith('cu'):
127+
elif cu_version.startswith('cu'):
121128
cu_suffix = cu_version[len('cu'):]
122-
return f"pytorch/conda-builder:cuda{cu_suffix}"
129+
return f"pytorch/conda-builder:cuda{cu_suffix}"
123130

124131

125132
def generate_base_workflow(base_workflow_name, python_version, cu_version,
@@ -136,7 +143,9 @@ def generate_base_workflow(base_workflow_name, python_version, cu_version,
136143

137144
if os_type != "win":
138145
d["wheel_docker_image"] = get_manylinux_image(cu_version)
139-
d["conda_docker_image"] = get_conda_image(cu_version)
146+
# ROCm conda packages not yet supported
147+
if "rocm" not in cu_version:
148+
d["conda_docker_image"] = get_conda_image(cu_version)
140149

141150
if filter_branch is not None:
142151
d["filters"] = {

packaging/pkg_helpers.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ setup_cuda() {
126126
;;
127127
cpu)
128128
;;
129+
rocm*)
130+
export FORCE_CUDA=1
131+
;;
129132
*)
130133
echo "Unrecognized CU_VERSION=$CU_VERSION"
131134
exit 1

0 commit comments

Comments
 (0)