From a41d5998b3095ab2ad2b8a6aeb675c1cc3975a4b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Jan 2024 16:13:10 +0200 Subject: [PATCH] Testing rtools-compatible tbb build --- .github/workflows/rtools-make.yml | 186 ++++++++++++++++++++++++++++++ lib/tbb_2020.3/build/windows.inc | 2 +- make/libraries | 10 +- 3 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/rtools-make.yml diff --git a/.github/workflows/rtools-make.yml b/.github/workflows/rtools-make.yml new file mode 100644 index 00000000000..60311376772 --- /dev/null +++ b/.github/workflows/rtools-make.yml @@ -0,0 +1,186 @@ +name: Windows Rtools40 + +on: + pull_request: + branches: [ develop, master ] + push: + branches: [ tbb-rtools-make ] + 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: + prim-rev: + name: prim and rev tests + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 4.1.3 + + - name: Set path for Rtools40 + if: runner.os == 'Windows' + run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Build Math libs + shell: powershell + run: | + Add-Content make\local "O=1`n" + make -f make/standalone math-libs -j2 + - name: Add TBB to PATH + shell: powershell + run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Run prim and rev unit tests + shell: powershell + run: | + python.exe runTests.py -j2 test/unit/*_test.cpp + python.exe runTests.py -j2 test/unit/math/*_test.cpp + python.exe runTests.py -j2 test/unit/math/prim + python.exe runTests.py -j2 test/unit/math/rev + python.exe runTests.py -j2 test/unit/math/memory + + - name: Upload gtest_output xml + uses: actions/upload-artifact@v4 + if: failure() + with: + name: gtest_outputs_xml + path: '**/*_test.xml' + + fwd-non-fun-mix: + name: fwd tests and non-fun mix tests + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 4.1.3 + + - name: Set path for Rtools40 + if: runner.os == 'Windows' + run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Build Math libs + shell: powershell + run: | + Add-Content make\local "O=1`n" + make -f make/standalone math-libs -j2 + - name: Add TBB to PATH + shell: powershell + run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Disable running fwd/mix tests + shell: powershell + run: echo "CXXFLAGS+= -DSTAN_MATH_TESTS_REV_ONLY" | Out-File -Append -FilePath make/local -Encoding utf8 + - name: Run fwd unit tests and all the mix tests except those in mix/fun + shell: powershell + run: | + python.exe runTests.py test/unit/math/fwd -j2 + python.exe runTests.py test/unit/math/mix/core -j2 + python.exe runTests.py test/unit/math/mix/functor -j2 + python.exe runTests.py test/unit/math/mix/meta -j2 + python.exe runTests.py test/unit/math/mix/prob -j2 + python.exe runTests.py test/unit/math/mix/*_test.cpp -j2 + + - name: Upload gtest_output xml + uses: actions/upload-artifact@v4 + if: failure() + with: + name: gtest_outputs_xml + path: '**/*_test.xml' + + mix-fun-1: + name: mix/fun tests 1 + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 4.1.3 + + - name: Set path for Rtools40 + if: runner.os == 'Windows' + run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Build Math libs + shell: powershell + run: | + Add-Content make\local "O=1`n" + make -f make/standalone math-libs -j2 + - name: Add TBB to PATH + shell: powershell + run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Run mix/fun unit tests + shell: powershell + run: | + $MixFunTests = Get-ChildItem -Path test\unit\math\mix\fun\* -Include *.cpp | Resolve-Path -Relative + $NumberTests = $MixFunTests.Length + $HalfNumberTests = [math]::Floor($NumberTests / 2) + python.exe runTests.py $MixFunTests[0..$HalfNumberTests] + + - name: Upload gtest_output xml + uses: actions/upload-artifact@v4 + if: failure() + with: + name: gtest_outputs_xml + path: '**/*_test.xml' + + mix-fun-2: + name: mix/fun tests 2 + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 4.1.3 + + - name: Set path for Rtools40 + if: runner.os == 'Windows' + run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Build Math libs + shell: powershell + run: | + Add-Content make\local "O=1`n" + make -f make/standalone math-libs -j2 + - name: Add TBB to PATH + shell: powershell + run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Run mix/fun unit tests + shell: powershell + run: | + $MixFunTests = Get-ChildItem -Path test\unit\math\mix\fun\* -Include *.cpp | Resolve-Path -Relative + $NumberTests = $MixFunTests.Length + $HalfNumberTests = [math]::Floor($NumberTests / 2) + python.exe runTests.py $MixFunTests[($HalfNumberTests + 1)..($NumberTests - 1)] + + - name: Upload gtest_output xml + uses: actions/upload-artifact@v4 + if: failure() + with: + name: gtest_outputs_xml + path: '**/*_test.xml' diff --git a/lib/tbb_2020.3/build/windows.inc b/lib/tbb_2020.3/build/windows.inc index dafd8928523..ed74edb07b6 100644 --- a/lib/tbb_2020.3/build/windows.inc +++ b/lib/tbb_2020.3/build/windows.inc @@ -22,7 +22,7 @@ endif # A convenience wrapper for calls to detect.js. # $(1) is the full command line for the script, e.g. /minversion icl 12 -detect_js = $(shell cmd /C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js $(1)") +detect_js = $(shell $(CMD) "cscript //NoLogo //E:jscript $(tbb_root)/build/detect.js $(1)") # TODO give an error if archs doesn't match ifndef arch diff --git a/make/libraries b/make/libraries index 516318cdfcf..be3bba7c849 100644 --- a/make/libraries +++ b/make/libraries @@ -158,11 +158,11 @@ ifeq ($(OS),Windows_NT) ifneq ($(MAKE),$(MAKE_ESCAPED)) $(error '$nError:$n$nThe RTools toolchain is installed in a path with spaces or brackets.$nPlease reinstall the toolchain.$n$n') else - if ! [[ $(MAKE) =~ mingw32 ]]; then \ - echo "ERROR: Please use mingw32-make on Windows to build the Intel TBB library."; \ - echo "This is packaged with RTools, for example."; \ - exit 1; \ - fi +# if ! [[ $(MAKE) =~ mingw32 ]]; then \ +# echo "ERROR: Please use mingw32-make on Windows to build the Intel TBB library."; \ +# echo "This is packaged with RTools, for example."; \ +# exit 1; \ +# fi endif endif @mkdir -p $(TBB_BIN)