mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Migration of Docker conda builds to pytorch/pytorch from pytorch/builder: https://github.com/pytorch/builder/blob/main/.github/workflows/build-conda-images.yml Related to: https://github.com/pytorch/builder/issues/1849 Migrate scripts and worklfows, adds logic to execute on PR and upload to ecr with github hash tag in order to test Docker build and nightly on PR. Test when executing on PR, upload to ecr: https://github.com/pytorch/pytorch/actions/runs/9799439218/job/27059691327 ``` 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/conda-builder-cpu:789cf8fcd738088860056160f6e9ea7cd005972b ``` Test With-Push, upload to dockerhub: https://github.com/pytorch/pytorch/actions/runs/9799783407/job/27060633427 ``` docker.io/pytorch/conda-builder:cpu done ``` Will upload here: https://hub.docker.com/r/pytorch/conda-builder/ Test using ecr image in the nightly workflow: https://github.com/pytorch/pytorch/actions/runs/9798428933/job/27057835235#step:16:87 Note: This is first part that will build docker and upload it to either dockerhub or ecr. After merging followup PR will need to change conda nightly workflows to either use ecr image or dockerhub image, depending if we are running it on PR or from main/release branch. Cleanup of workflows and scripts from builder repo: https://github.com/pytorch/builder/pull/1923 Co-authored-by: atalman <atalman@fb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/129022 Approved by: https://github.com/atalman, https://github.com/seemethere, https://github.com/malfet, https://github.com/chuanqi129
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
# Logic copied from PEP 513
|
|
|
|
|
|
def is_manylinux1_compatible():
|
|
# Only Linux, and only x86-64 / i686
|
|
from distutils.util import get_platform
|
|
|
|
if get_platform() not in ["linux-x86_64", "linux-i686", "linux-s390x"]:
|
|
return False
|
|
|
|
# Check for presence of _manylinux module
|
|
try:
|
|
import _manylinux
|
|
|
|
return bool(_manylinux.manylinux1_compatible)
|
|
except (ImportError, AttributeError):
|
|
# Fall through to heuristic check below
|
|
pass
|
|
|
|
# Check glibc version. CentOS 5 uses glibc 2.5.
|
|
return have_compatible_glibc(2, 5)
|
|
|
|
|
|
def have_compatible_glibc(major, minimum_minor):
|
|
import ctypes
|
|
|
|
process_namespace = ctypes.CDLL(None)
|
|
try:
|
|
gnu_get_libc_version = process_namespace.gnu_get_libc_version
|
|
except AttributeError:
|
|
# Symbol doesn't exist -> therefore, we are not linked to
|
|
# glibc.
|
|
return False
|
|
|
|
# Call gnu_get_libc_version, which returns a string like "2.5".
|
|
gnu_get_libc_version.restype = ctypes.c_char_p
|
|
version_str = gnu_get_libc_version()
|
|
# py2 / py3 compatibility:
|
|
if not isinstance(version_str, str):
|
|
version_str = version_str.decode("ascii")
|
|
|
|
# Parse string and check against requested version.
|
|
version = [int(piece) for piece in version_str.split(".")]
|
|
assert len(version) == 2
|
|
if major != version[0]:
|
|
return False
|
|
if minimum_minor > version[1]:
|
|
return False
|
|
return True
|
|
|
|
|
|
import sys
|
|
|
|
|
|
if is_manylinux1_compatible():
|
|
print(f"{sys.executable} is manylinux1 compatible")
|
|
sys.exit(0)
|
|
else:
|
|
print(f"{sys.executable} is NOT manylinux1 compatible")
|
|
sys.exit(1)
|