Skip to content

Commit 202060c

Browse files
committed
add gcc-10 option to support SVE based library compilation
1 parent bca176c commit 202060c

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
@@ -422,6 +422,14 @@ def configure_system(host: RemoteHost, *,
422422

423423
host.run_cmd("pip3 install dataclasses typing-extensions")
424424

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

426434
def start_build(host: RemoteHost, *,
427435
branch="master",
@@ -446,9 +454,9 @@ def start_build(host: RemoteHost, *,
446454
# HACK: pypa gforntran.a is compiled without PIC, which leads to the following error
447455
# 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'
448456
# Workaround by copying gfortran library from the host
449-
host.run_ssh_cmd("sudo apt-get install -y gfortran-8")
450-
host.run_cmd("mkdir -p /usr/lib/gcc/aarch64-linux-gnu/8")
451-
host.run_ssh_cmd(["docker", "cp", "/usr/lib/gcc/aarch64-linux-gnu/8/libgfortran.a",
457+
host.run_ssh_cmd("sudo apt-get install -y gfortran-10")
458+
host.run_cmd("mkdir -p /usr/lib/gcc/aarch64-linux-gnu/10")
459+
host.run_ssh_cmd(["docker", "cp", "/usr/lib/gcc/aarch64-linux-gnu/10/libgfortran.a",
452460
f"{host.container_id}:/opt/rh/devtoolset-10/root/usr/lib/gcc/aarch64-redhat-linux/10/"
453461
])
454462

@@ -615,7 +623,7 @@ def parse_arguments():
615623
parser.add_argument("--instance-type", type=str, default="t4g.2xlarge")
616624
parser.add_argument("--branch", type=str, default="master")
617625
parser.add_argument("--use-docker", action="store_true")
618-
parser.add_argument("--compiler", type=str, choices=['gcc-7', 'gcc-8', 'gcc-9', 'clang'], default="gcc-8")
626+
parser.add_argument("--compiler", type=str, choices=['gcc-7', 'gcc-8', 'gcc-9', 'gcc-10', 'clang'], default="gcc-8")
619627
parser.add_argument("--use-torch-from-pypi", action="store_true")
620628
return parser.parse_args()
621629

0 commit comments

Comments
 (0)