diff --git a/.github/workflows/header_checks.yml b/.github/workflows/header_checks.yml.bak similarity index 100% rename from .github/workflows/header_checks.yml rename to .github/workflows/header_checks.yml.bak diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml.bak similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/main.yml.bak diff --git a/.github/workflows/multiarch_checks.yml b/.github/workflows/multiarch_checks.yml new file mode 100644 index 00000000000..b839e3e7272 --- /dev/null +++ b/.github/workflows/multiarch_checks.yml @@ -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' diff --git a/Jenkinsfile b/Jenkinsfile.bak similarity index 100% rename from Jenkinsfile rename to Jenkinsfile.bak diff --git a/make/compiler_flags b/make/compiler_flags index 1552381f232..d1ced2ab234 100644 --- a/make/compiler_flags +++ b/make/compiler_flags @@ -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) @@ -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 diff --git a/test/unit/math/prim/fun/offset_multiplier_transform_test.cpp b/test/unit/math/prim/fun/offset_multiplier_transform_test.cpp index a17b98b9023..52390060d69 100644 --- a/test/unit/math/prim/fun/offset_multiplier_transform_test.cpp +++ b/test/unit/math/prim/fun/offset_multiplier_transform_test.cpp @@ -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)); @@ -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)); @@ -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)); diff --git a/test/unit/math/prim/prob/neg_binomial_test.cpp b/test/unit/math/prim/prob/neg_binomial_test.cpp index ac5b0f611cb..5d9d091f002 100644 --- a/test/unit/math/prim/prob/neg_binomial_test.cpp +++ b/test/unit/math/prim/prob/neg_binomial_test.cpp @@ -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))); }