Skip to content

Commit 3996e08

Browse files
authored
ci: CI tests on MacOS ARM, and fixes found consequently (#4026)
There's a new GitHub runner in town! Set up CI to run on Mac ARM. But not all the time -- it's too expensive! This runner is only available for paid accounts, and it's 20x more expensive than paying for a Linux runner. The ASWF can't afford to run this job on every iteration of every PR, and again upon merge. We split it into a separate workflow so we can direct it to run only for tagged releases, branches with names containng "-alpha", "-beta", "release", or contain the substring "macarm" (this last one is so we can force a particular PR that we think is directly relevant to ARM to test, even though it's not one of those other release-related cases). We also run it once a month, on the 27th -- a few days before each monthly release -- to try to catch any ARM problems we've accidentally introduced by PRs that didn't test. It's also rigged to run only on the ASWF repo, so you don't need to worry that you will get charged for pushes to your own fork. (On the other hand, it also means you aren't testing against ARM when you push to your fork prior to making a PR.) In the process of testing this, of course I found some minor things that needed to be fixed on ARM -- a couple compile issues, and several testsuite reference outputs that needed to be updated because they differ ever so slightly in some math calculations on the different CPU architecture. Signed-off-by: Larry Gritz <[email protected]>
1 parent 824e6df commit 3996e08

File tree

17 files changed

+1475
-3
lines changed

17 files changed

+1475
-3
lines changed

.github/workflows/macarm.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Copyright Contributors to the OpenImageIO project.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# https://github.com/AcademySoftwareFoundation/OpenImageIO
4+
5+
6+
# This workflow is for CI for ARM-based MacOS. In an ideal world, this would
7+
# just be another matrix entry in the main CI workflow, but MacOS ARM runners
8+
# too expensive to run on every PR push. So we break into a separate workflow
9+
# to have more fine-grained control over when it runs.
10+
11+
name: CI-Mac-ARM
12+
13+
# This section controls when the workflow runs.
14+
on:
15+
# Run upon push, but only for tagged versions, or if the branch name
16+
# contains the substrings "macarm", "-alpha", "-beta", or is called
17+
# "release".
18+
push:
19+
tags:
20+
- v**
21+
branches:
22+
- '*macarm*'
23+
- '*alpha*'
24+
- '*beta*'
25+
- 'release'
26+
# Run for pull requests whose branch name includes "macarm" (this allows
27+
# us to test specific PRs that we think need ARM verification).
28+
pull_request:
29+
if: contains(github.head_ref, 'macarm')
30+
# Run monthly on the 27th (a few days before patch releases) to make sure we
31+
# haven't broken anything among the many PRs that didn't test on ARM.
32+
schedule:
33+
- cron: "0 8 27 * *"
34+
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
35+
36+
permissions: read-all
37+
38+
39+
jobs:
40+
# This section should remain an identical copy of the main CI workflow job
41+
# for MacOS.
42+
macos-arm:
43+
name: "${{matrix.os}} appleclang${{matrix.aclang}}/C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}} boost1.76 exr3.1 ocio2.1"
44+
# Needs special runners, only run on the main repo,
45+
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
include:
50+
- desc: MacOS-13 ARM
51+
os: macos-13-xlarge
52+
nametag: macos13-arm-py311
53+
cxx_std: 17
54+
python_ver: "3.11"
55+
aclang: 14
56+
setenvs: export CTEST_TEST_TIMEOUT=600 USE_OPENCV=0 USE_QT=0 PARALLEL=8
57+
runs-on: ${{ matrix.os }}
58+
env:
59+
CC: clang
60+
CXX: clang++
61+
CMAKE_CXX_STANDARD: ${{ matrix.cxx_std }}
62+
PYTHON_VERSION: ${{ matrix.python_ver }}
63+
steps:
64+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
65+
- name: Prepare ccache timestamp
66+
id: ccache_cache_keys
67+
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
68+
- name: ccache
69+
id: ccache
70+
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
71+
with:
72+
path: /Users/runner/.ccache
73+
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
74+
restore-keys: ${{github.job}}-
75+
- name: Build setup
76+
run: |
77+
${{matrix.setenvs}}
78+
src/build-scripts/ci-startup.bash
79+
- name: Dependencies
80+
run: |
81+
src/build-scripts/install_homebrew_deps.bash
82+
${{matrix.depcmds}}
83+
- name: Build
84+
run: |
85+
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
86+
src/build-scripts/ci-build.bash
87+
- name: Testsuite
88+
run: src/build-scripts/ci-test.bash
89+
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
90+
if: failure()
91+
with:
92+
name: oiio-${{github.job}}-${{matrix.nametag}}
93+
path: |
94+
build/cmake-save
95+
build/testsuite/*/*.*
96+
!build/testsuite/oiio-images
97+
!build/testsuite/openexr-images
98+
!build/testsuite/fits-images
99+
!build/testsuite/j2kp4files_v1_5

src/build-scripts/install_homebrew_deps.bash

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ brew install --display-times -q freetype libraw dcmtk pybind11 numpy || true
4242
brew install --display-times -q ffmpeg libheif ptex || true
4343
brew install --display-times -q tbb || true
4444
brew install --display-times -q openvdb || true
45-
brew install --display-times -q opencv || true
46-
brew install --display-times -q qt${QT_VERSION}
45+
if [[ "${USE_OPENCV}" != "0" ]] ; then
46+
brew install --display-times -q opencv || true
47+
fi
48+
if [[ "${USE_QT}" != "0" ]] ; then
49+
brew install --display-times -q qt${QT_VERSION}
50+
fi
4751

4852
echo ""
4953
echo "After brew installs:"

src/include/OpenImageIO/simd.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646

4747
#include <OpenImageIO/detail/fmt.h>
4848

49+
// Without SSE, we need to fall back on Imath for matrix44 invert
50+
#if !OIIO_SIMD_SSE
51+
# include <OpenImageIO/Imath.h>
52+
#endif
53+
4954

5055
//////////////////////////////////////////////////////////////////////////
5156
// Sort out which SIMD capabilities we have and set definitions
@@ -8536,6 +8541,8 @@ OIIO_FORCEINLINE matrix44 matrix44::inverse() const {
85368541
OIIO_FORCEINLINE matrix44 matrix44::inverse() const {
85378542
return matrix44 (((Imath::M44f*)this)->inverse());
85388543
}
8544+
#else
8545+
#error "Don't know how to compute matrix44::inverse()"
85398546
#endif
85408547

85418548

0 commit comments

Comments
 (0)