Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Workflow for basic testing across multiple archs #2937

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
76 changes: 76 additions & 0 deletions .github/workflows/multiarch_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Multiarch checks

on:
pull_request:
branches: [ develop, master ]
push:
branches: [ develop, master ]
paths-ignore:
- 'doygen/**'
- 'hooks/**'
- 'licenses/**'
- 'LICENSE.md'
- 'README.md'
- 'RELEASE-NOTES.txt'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
multiarch-prim-rev:
name: ${{ matrix.config.platform }} ${{ matrix.config.batch }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- { platform: ppc64le, batch: 0}
- { platform: ppc64le, batch: 1}
- { platform: ppc64le, batch: 2}
- { platform: ppc64le, batch: 3}
- { platform: ppc64le, batch: 4}
- { platform: ppc64le, batch: 5}
- { platform: ppc64le, batch: 6}
- { platform: ppc64le, batch: 7}
- { platform: ppc64le, batch: 8}
- { platform: ppc64le, batch: 9}
- { platform: ppc64le, batch: 10}
- { platform: ppc64le, batch: 11}
- { platform: ppc64le, batch: 12}
- { platform: ppc64le, batch: 13}
- { platform: ppc64le, batch: 14}
- { platform: ppc64le, batch: 15}
- { platform: ppc64le, batch: 16}
- { platform: ppc64le, batch: 17}
- { platform: ppc64le, batch: 18}
- { platform: ppc64le, batch: 19}

steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: addnab/docker-run-action@v3
with:
image: debian:sid-slim
options: -v ${{ github.workspace }}:/work --platform linux/${{ matrix.config.platform }} -e DEBIAN_FRONTEND=noninteractive
run: |
apt-get update && apt-get install -y build-essential python-is-python3
cd /work
TargetTests=(test/unit/math/prim/*/*.cpp)
NTests=${#TargetTests[@]}
TestsPerBatch="$(($NTests / 20))"
StartOfBatch="$((${{ matrix.config.batch }} * $TestsPerBatch))"
# Compile and run in sub-batches of 5 to fail faster
echo "${TargetTests[@]}" | xargs -n 5 python ./runTests.py -j2
shell: bash

- name: Upload gtest_output xml
uses: actions/upload-artifact@v3
if: failure()
with:
name: gtest_outputs_xml
path: '**/*_test.xml'
File renamed without changes.
6 changes: 6 additions & 0 deletions make/compiler_flags
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ ifeq ($(OS),Darwin)
ifeq (clang,$(CXX_TYPE))
CXXFLAGS_OS ?= -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare
endif
ifeq (arm64, $(shell uname -m))
CXXFLAGS_OS += -ffp-contract=off
endif
endif

ifeq ($(OS),Linux)
Expand All @@ -190,6 +193,9 @@ ifeq ($(OS),Linux)
ifeq (clang,$(CXX_TYPE))
LDLIBS_OS ?= -lpthread
endif
ifeq (aarch64, $(shell uname -m))
CXXFLAGS_OS += -ffp-contract=off
endif
endif

## makes reentrant version lgamma_r available from cmath
Expand Down
6 changes: 3 additions & 3 deletions test/unit/math/prim/fun/offset_multiplier_transform_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ TEST(prob_transform, offset_multiplier_constrain_matrix) {
EXPECT_FLOAT_EQ(result(i), stan::math::offset_multiplier_constrain(
x(i), offsetd, sigmad, lp1));
}
EXPECT_EQ(lp0, lp1);
EXPECT_FLOAT_EQ(lp0, lp1);
auto x_free = stan::math::offset_multiplier_free(result, offsetd, sigmad);
for (size_t i = 0; i < x.size(); ++i) {
EXPECT_FLOAT_EQ(x.coeff(i), x_free.coeff(i));
Expand Down Expand Up @@ -193,7 +193,7 @@ TEST(prob_transform, offset_multiplier_constrain_matrix) {
EXPECT_FLOAT_EQ(result(i), stan::math::offset_multiplier_constrain(
x(i), offsetd, sigma(i), lp1));
}
EXPECT_EQ(lp0, lp1);
EXPECT_FLOAT_EQ(lp0, lp1);
auto x_free = stan::math::offset_multiplier_free(result, offsetd, sigma);
for (size_t i = 0; i < x.size(); ++i) {
EXPECT_FLOAT_EQ(x.coeff(i), x_free.coeff(i));
Expand All @@ -211,7 +211,7 @@ TEST(prob_transform, offset_multiplier_constrain_matrix) {
EXPECT_FLOAT_EQ(result(i), stan::math::offset_multiplier_constrain(
x(i), offset(i), sigma(i), lp1));
}
EXPECT_EQ(lp0, lp1);
EXPECT_FLOAT_EQ(lp0, lp1);
auto x_free = stan::math::offset_multiplier_free(result, offset, sigma);
for (size_t i = 0; i < x.size(); ++i) {
EXPECT_FLOAT_EQ(x.coeff(i), x_free.coeff(i));
Expand Down
4 changes: 3 additions & 1 deletion test/unit/math/prim/prob/neg_binomial_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ TEST(ProbDistributionsNegBinomial, chiSquareGoodnessFitTest3) {

double chi = 0;

for (int j = 0; j < K; j++)
for (int j = 0; j < K; j++) {
if (expect[j] == 0) { continue; }
chi += ((bin[j] - expect[j]) * (bin[j] - expect[j]) / expect[j]);
}

EXPECT_LT(chi, boost::math::quantile(boost::math::complement(mydist, 1e-6)));
}
Expand Down
Loading