Skip to content

Commit c1447f3

Browse files
committed
[aarch64] add gcc-10 option to support SVE based library compilation
1 parent 550dbdd commit c1447f3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build_aarch64_wheel.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ def configure_system(host: RemoteHost, *,
420420

421421
host.run_cmd("pip3 install dataclasses typing-extensions")
422422

423+
# Install and switch to gcc-10 on Ubuntu-20.04. This is required to support
424+
# SVE instruction set for newer aarch64 architectures
425+
if not host.using_docker() and host.ami == ubuntu20_04_ami and compiler == 'gcc-10':
426+
host.run_cmd("sudo apt-get install -y g++-10 gfortran-10")
427+
host.run_cmd("sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100")
428+
host.run_cmd("sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100")
429+
host.run_cmd("sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-10 100")
430+
423431

424432
def start_build(host: RemoteHost, *,
425433
branch="master",
@@ -444,9 +452,9 @@ def start_build(host: RemoteHost, *,
444452
# HACK: pypa gforntran.a is compiled without PIC, which leads to the following error
445453
# libgfortran.a(error.o)(.text._gfortrani_st_printf+0x34): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
446454
# Workaround by copying gfortran library from the host
447-
host.run_ssh_cmd("sudo apt-get install -y gfortran-8")
448-
host.run_cmd("mkdir -p /usr/lib/gcc/aarch64-linux-gnu/8")
449-
host.run_ssh_cmd(["docker", "cp", "/usr/lib/gcc/aarch64-linux-gnu/8/libgfortran.a",
455+
host.run_ssh_cmd("sudo apt-get install -y gfortran-10")
456+
host.run_cmd("mkdir -p /usr/lib/gcc/aarch64-linux-gnu/10")
457+
host.run_ssh_cmd(["docker", "cp", "/usr/lib/gcc/aarch64-linux-gnu/10/libgfortran.a",
450458
f"{host.container_id}:/opt/rh/devtoolset-10/root/usr/lib/gcc/aarch64-redhat-linux/10/"
451459
])
452460

@@ -613,7 +621,7 @@ def parse_arguments():
613621
parser.add_argument("--instance-type", type=str, default="t4g.2xlarge")
614622
parser.add_argument("--branch", type=str, default="master")
615623
parser.add_argument("--use-docker", action="store_true")
616-
parser.add_argument("--compiler", type=str, choices=['gcc-7', 'gcc-8', 'gcc-9', 'clang'], default="gcc-8")
624+
parser.add_argument("--compiler", type=str, choices=['gcc-7', 'gcc-8', 'gcc-9', 'gcc-10', 'clang'], default="gcc-8")
617625
parser.add_argument("--use-torch-from-pypi", action="store_true")
618626
return parser.parse_args()
619627

0 commit comments

Comments
 (0)