Skip to content

Commit

Permalink
github: workflows: Refactor macos pipelines
Browse files Browse the repository at this point in the history
Introduce cross-platform scripts in prep for linux aarch64 runners.

Signed-off-by: Hamza Butt <hamza.butt@arm.com>
  • Loading branch information
theComputeKid committed Sep 27, 2024
1 parent c4b2695 commit b2ccb3f
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 106 deletions.
53 changes: 53 additions & 0 deletions .github/automation/build_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# *******************************************************************************

# Build oneDNN for aarch64.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

export ACL_ROOT_DIR=${ACL_ROOT_DIR:-"${PWD}/ComputeLibrary"}

CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-"Release"}

if [[ "$OS" == "Linux" ]]; then
ONEDNN_TEST_SET=SMOKE
ONEDNN_RUNTIME=OMP
elif [[ "$OS" == "Darwin" ]]; then
ONEDNN_TEST_SET=SMOKE
ONEDNN_RUNTIME=SEQ
fi

set -x
cmake \
-Bbuild -S. \
-DDNNL_AARCH64_USE_ACL=ON \
-DONEDNN_BUILD_GRAPH=0 \
-DDNNL_CPU_RUNTIME=$ONEDNN_RUNTIME \
-DONEDNN_WERROR=ON \
-DDNNL_BUILD_FOR_CI=ON \
-DONEDNN_TEST_SET=$ONEDNN_TEST_SET \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE

cmake --build build $MP
set +x
94 changes: 51 additions & 43 deletions .github/automation/build_acl.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2020-2023 Arm Limited and affiliates.
# Copyright 2020-2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,45 +17,53 @@
# limitations under the License.
# *******************************************************************************

# Compute Library build defaults
ACL_VERSION="v23.11"
ACL_DIR="${PWD}/ComputeLibrary"
ACL_ARCH="armv8a"
ACL_MULTI_ISA_SUPPORT=0

while [[ $# -gt 0 ]]; do
case $1 in
--version)
ACL_VERSION="v$2"
shift
;;
--arch)
ACL_ARCH="$2"
shift
;;
--multi_isa)
ACL_MULTI_ISA_SUPPORT=1
;;
--root-dir)
ACL_DIR="$2"
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
shift
done

readonly ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"
MAKE_NP="-j$(grep -c processor /proc/cpuinfo)"

git clone --branch $ACL_VERSION --depth 1 $ACL_REPO $ACL_DIR
cd $ACL_DIR

scons --silent $MAKE_NP Werror=0 debug=0 neon=1 opencl=0 embed_kernels=0 \
os=linux arch=$ACL_ARCH build=native multi_isa=$ACL_MULTI_ISA_SUPPORT \
fixed_format_kernels=1

exit $?
# Build ACL from github.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

ACL_CONFIG=${ACL_CONFIG:-"Release"}
ACL_ROOT_DIR=${ACL_ROOT_DIR:-"${PWD}/ComputeLibrary"}
ACL_VERSION=${ACL_VERSION:-v24.08.1}
ACL_ARCH=${ACL_ARCH:-"armv8.2-a"}
ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"

if [[ "$OS" == "Linux" ]]; then
ACL_MULTI_ISA_SUPPORT=1
ACL_OPENMP=${ACL_OPENMP:-1}
ACL_OS="linux"
elif [[ "$OS" == "Darwin" ]]; then
ACL_MULTI_ISA_SUPPORT=0
ACL_OPENMP=${ACL_OPENMP:-0}
ACL_OS="macos"
else
echo "Unknown OS: $OS"
exit 1
fi

if [[ "$ACL_CONFIG" == "Release" ]]; then
ACL_DEBUG=0
elif [[ "$ACL_CONFIG" == "Debug" ]]; then
ACL_DEBUG=1
else
echo "Unknown build config: $ACL_CONFIG"
exit 1
fi

echo "Compiler version:"
$CC --version

set -x
git clone --branch $ACL_VERSION --depth 1 $ACL_REPO $ACL_ROOT_DIR

cd $ACL_ROOT_DIR

scons $MP Werror=0 debug=$ACL_DEBUG neon=1 opencl=0 embed_kernels=0 \
os=$ACL_OS arch=$ACL_ARCH build=native multi_isa=$ACL_MULTI_ISA_SUPPORT \
fixed_format_kernels=1 cppthreads=0 openmp=$ACL_OPENMP examples=0 \
validation_tests=0
set +x
47 changes: 47 additions & 0 deletions .github/automation/common_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# *******************************************************************************

# Common variables for aarch64 ci. Exports:
# CC, CXX, OS, MP

set -o errexit -o pipefail -o noclobber

export OS=$(uname)

# Num threads on system.
if [[ "$OS" == "Darwin" ]]; then
export MP="-j$(sysctl -n hw.ncpu)"
elif [[ "$OS" == "Linux" ]]; then
export MP="-j$(nproc)"
fi

if [[ "$BUILD_TOOLSET" == "gcc" ]]; then
export CC=gcc-${GCC_VERSION}
export CXX=g++-${GCC_VERSION}
elif [[ "$BUILD_TOOLSET" == "clang" ]]; then
export CC=clang
export CXX=clang++
fi

# Print every exported variable.
echo "OS: $OS"
echo "Toolset: $BUILD_TOOLSET"
echo "CC: $CC"
echo "CXX: $CXX"
echo "MP: $MP"
66 changes: 66 additions & 0 deletions .github/automation/test_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#! /bin/bash

# *******************************************************************************
# Copyright 2024 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# *******************************************************************************

# Test oneDNN for aarch64.

set -o errexit -o pipefail -o noclobber

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# Defines MP, CC, CXX and OS.
source ${SCRIPT_DIR}/common_aarch64.sh

# We currently have some OS and config specific test failures.
if [[ "$OS" == "Linux" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|cpu-primitives-matmul-cpp"
SKIPPED_TEST_FAILURES+="|test_convolution_backward_weights_f32"
SKIPPED_TEST_FAILURES+="|test_matmul"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_conv_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_deconv_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_matmul_smoke_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
fi
elif [[ "$OS" == "Darwin" ]]; then
if [[ "$CMAKE_BUILD_TYPE" == "Debug" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_brgemm_smoke_cpu"
elif [[ "$CMAKE_BUILD_TYPE" == "Release" ]]; then
SKIPPED_TEST_FAILURES="cpu-primitives-deconvolution-cpp"
SKIPPED_TEST_FAILURES+="|test_benchdnn_modeC_lnorm_smoke_cpu"
fi
fi

if [[ "$OS" == "Darwin" ]]; then
# Since macos does not build with OMP, we can use multiple ctest threads.
CTEST_MP=$MP
elif [[ "$OS" == "Linux" ]]; then
# Already built with some form of threading.
CTEST_MP=-j2
fi

set -x
ctest $CTEST_MP --no-tests=error -E "$SKIPPED_TEST_FAILURES"
set +x
Loading

0 comments on commit b2ccb3f

Please sign in to comment.