@@ -299,40 +299,6 @@ def install_condaforge_python(host: RemoteHost, python_version="3.8") -> None:
299299 )
300300
301301
302- def build_OpenBLAS (host : RemoteHost , git_clone_flags : str = "" ) -> None :
303- print ("Building OpenBLAS" )
304- host .run_cmd (
305- f"git clone https://github.com/xianyi/OpenBLAS -b v0.3.28 { git_clone_flags } "
306- )
307- make_flags = "NUM_THREADS=64 USE_OPENMP=1 NO_SHARED=1 DYNAMIC_ARCH=1 TARGET=ARMV8"
308- host .run_cmd (
309- f"pushd OpenBLAS && make { make_flags } -j8 && sudo make { make_flags } install && popd && rm -rf OpenBLAS"
310- )
311-
312-
313- def build_ArmComputeLibrary (host : RemoteHost , git_clone_flags : str = "" ) -> None :
314- print ("Building Arm Compute Library" )
315- acl_build_flags = " " .join (
316- [
317- "debug=0" ,
318- "neon=1" ,
319- "opencl=0" ,
320- "os=linux" ,
321- "openmp=1" ,
322- "cppthreads=0" ,
323- "arch=armv8a" ,
324- "multi_isa=1" ,
325- "fixed_format_kernels=1" ,
326- "build=native" ,
327- ]
328- )
329- host .run_cmd (
330- f"git clone https://github.com/ARM-software/ComputeLibrary.git -b v25.02 { git_clone_flags } "
331- )
332-
333- host .run_cmd (f"cd ComputeLibrary && scons Werror=1 -j8 { acl_build_flags } " )
334-
335-
336302def embed_libgomp (host : RemoteHost , use_conda , wheel_name ) -> None :
337303 host .run_cmd ("pip3 install auditwheel" )
338304 host .run_cmd (
@@ -442,7 +408,7 @@ def build_torchvision(
442408 if host .using_docker ():
443409 build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
444410
445- host .run_cmd (f"cd vision && { build_vars } python3 setup.py bdist_wheel " )
411+ host .run_cmd (f"cd vision && { build_vars } python3 -m build --wheel --no-isolation " )
446412 vision_wheel_name = host .list_dir ("vision/dist" )[0 ]
447413 embed_libgomp (host , use_conda , os .path .join ("vision" , "dist" , vision_wheel_name ))
448414
@@ -497,7 +463,7 @@ def build_torchdata(
497463 if host .using_docker ():
498464 build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
499465
500- host .run_cmd (f"cd data && { build_vars } python3 setup.py bdist_wheel " )
466+ host .run_cmd (f"cd data && { build_vars } python3 -m build --wheel --no-isolation " )
501467 wheel_name = host .list_dir ("data/dist" )[0 ]
502468 embed_libgomp (host , use_conda , os .path .join ("data" , "dist" , wheel_name ))
503469
@@ -553,7 +519,7 @@ def build_torchtext(
553519 if host .using_docker ():
554520 build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
555521
556- host .run_cmd (f"cd text && { build_vars } python3 setup.py bdist_wheel " )
522+ host .run_cmd (f"cd text && { build_vars } python3 -m build --wheel --no-isolation " )
557523 wheel_name = host .list_dir ("text/dist" )[0 ]
558524 embed_libgomp (host , use_conda , os .path .join ("text" , "dist" , wheel_name ))
559525
@@ -614,7 +580,7 @@ def build_torchaudio(
614580 host .run_cmd (
615581 f"cd audio && export FFMPEG_ROOT=$(pwd)/third_party/ffmpeg && export USE_FFMPEG=1 \
616582 && ./packaging/ffmpeg/build.sh \
617- && { build_vars } python3 setup.py bdist_wheel "
583+ && { build_vars } python3 -m build --wheel --no-isolation "
618584 )
619585
620586 wheel_name = host .list_dir ("audio/dist" )[0 ]
@@ -700,7 +666,6 @@ def start_build(
700666 configure_system (
701667 host , compiler = compiler , use_conda = use_conda , python_version = python_version
702668 )
703- build_OpenBLAS (host , git_clone_flags )
704669
705670 if host .using_docker ():
706671 print ("Move libgfortant.a into a standard location" )
@@ -723,10 +688,12 @@ def start_build(
723688 f"git clone --recurse-submodules -b { branch } https://github.com/pytorch/pytorch { git_clone_flags } "
724689 )
725690
691+ host .run_cmd ("pytorch/.ci/docker/common/install_openblas.sh" )
692+
726693 print ("Building PyTorch wheel" )
727694 build_opts = ""
728695 if pytorch_build_number is not None :
729- build_opts += f" -- build-number { pytorch_build_number } "
696+ build_opts += f" -C-- build-option=--build- number= { pytorch_build_number } "
730697 # Breakpad build fails on aarch64
731698 build_vars = "USE_BREAKPAD=0 "
732699 if branch == "nightly" :
@@ -743,15 +710,18 @@ def start_build(
743710 if host .using_docker ():
744711 build_vars += " CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000"
745712 if enable_mkldnn :
746- build_ArmComputeLibrary ( host , git_clone_flags )
713+ host . run_cmd ( "pytorch/.ci/docker/common/install_acl.sh" )
747714 print ("build pytorch with mkldnn+acl backend" )
748715 build_vars += " USE_MKLDNN=ON USE_MKLDNN_ACL=ON"
716+ build_vars += " BLAS=OpenBLAS"
717+ build_vars += " OpenBLAS_HOME=/opt/OpenBLAS"
718+ build_vars += " ACL_ROOT_DIR=/acl"
749719 host .run_cmd (
750- f"cd $HOME/pytorch && export ACL_ROOT_DIR=$HOME/ComputeLibrary && { build_vars } python3 setup.py bdist_wheel { build_opts } "
720+ f"cd $HOME/pytorch && { build_vars } python3 -m build --wheel --no-isolation { build_opts } "
751721 )
752722 print ("Repair the wheel" )
753723 pytorch_wheel_name = host .list_dir ("pytorch/dist" )[0 ]
754- ld_library_path = "$HOME /acl/build:$HOME/pytorch/build/lib"
724+ ld_library_path = "/acl/build:$HOME/pytorch/build/lib"
755725 host .run_cmd (
756726 f"export LD_LIBRARY_PATH={ ld_library_path } && auditwheel repair $HOME/pytorch/dist/{ pytorch_wheel_name } "
757727 )
@@ -763,7 +733,7 @@ def start_build(
763733 else :
764734 print ("build pytorch without mkldnn backend" )
765735 host .run_cmd (
766- f"cd pytorch && { build_vars } python3 setup.py bdist_wheel { build_opts } "
736+ f"cd pytorch && { build_vars } python3 -m build --wheel --no-isolation { build_opts } "
767737 )
768738
769739 print ("Deleting build folder" )
@@ -907,7 +877,7 @@ def terminate_instances(instance_type: str) -> None:
907877def parse_arguments ():
908878 from argparse import ArgumentParser
909879
910- parser = ArgumentParser ("Builid and test AARCH64 wheels using EC2" )
880+ parser = ArgumentParser ("Build and test AARCH64 wheels using EC2" )
911881 parser .add_argument ("--key-name" , type = str )
912882 parser .add_argument ("--debug" , action = "store_true" )
913883 parser .add_argument ("--build-only" , action = "store_true" )
0 commit comments