From 6310dd6ffe07778d6f231fcabeabb60bf0f797d0 Mon Sep 17 00:00:00 2001 From: David Himmelstrup Date: Thu, 9 Jul 2020 12:55:47 +0800 Subject: [PATCH] CI: Install hmatrix (#101) New behavior: * hmatrix is always enabled on macos and Linux. * hmatrix is disabled by default on windows but can be enabled by passing '--flag reanimate:hmatrix'. * hmatrix is enabled for Windows on CI servers. * hmatrix for macos and Linux defaults to blas and lapack (but can also use openblas). * hmatrix for Windows has to use openblas. --- .azure/azure-linux-template.yml | 3 +- .azure/azure-osx-template.yml | 6 ++-- .azure/azure-windows-template.yml | 46 ++++++++----------------------- reanimate.cabal | 6 ++-- 4 files changed, 20 insertions(+), 41 deletions(-) diff --git a/.azure/azure-linux-template.yml b/.azure/azure-linux-template.yml index 1798e2c..272df73 100644 --- a/.azure/azure-linux-template.yml +++ b/.azure/azure-linux-template.yml @@ -37,7 +37,8 @@ jobs: - script: | #sudo add-apt-repository ppa:jonathonf/ffmpeg-4 sudo apt-get update - sudo apt-get install libblas-dev liblapack-dev + # sudo apt-get install libopenblas-dev libgfortran4 + sudo apt-get install liblapack-dev libblas-dev #sudo apt-get install ffmpeg #sudo apt-get install texlive texlive-latex-base texlive-latex-extra texlive-fonts-extra texlive-science texlive-xetex texlive-latex-recommended texlive-lang-english texlive-lang-chinese #sudo apt-get install povray diff --git a/.azure/azure-osx-template.yml b/.azure/azure-osx-template.yml index 02f00ca..09e74f9 100644 --- a/.azure/azure-osx-template.yml +++ b/.azure/azure-osx-template.yml @@ -27,7 +27,9 @@ jobs: displayName: Cache stack root - script: | # brew install gcc - # brew install lapack + brew install blas + brew install lapack + # brew install openblas mkdir -p ~/.local/bin curl -skL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin; export PATH=$HOME/.local/bin:$PATH @@ -35,7 +37,7 @@ jobs: stack exec ghc -- --version || rm -fr $(STACK_ROOT) displayName: 'Setup' - script: | - stack --install-ghc build $ARGS --only-dependencies + stack --install-ghc build $ARGS --only-dependencies --extra-lib-dirs=/usr/local/opt/openblas/lib stack --install-ghc build --test $ARGS --flag reanimate:test --only-dependencies displayName: 'Install dependencies' - script: | diff --git a/.azure/azure-windows-template.yml b/.azure/azure-windows-template.yml index 0100f6b..0dd5fa0 100644 --- a/.azure/azure-windows-template.yml +++ b/.azure/azure-windows-template.yml @@ -9,7 +9,7 @@ jobs: matrix: stack: BUILD: stack - STACK_YAML: stack-lts-14.yaml # lts-15 is broken. "Access violation in generated code" :-/ + STACK_YAML: stack-lts-14.yaml ARGS: --pedantic stack-lts-14: BUILD: stack @@ -21,53 +21,29 @@ jobs: steps: - task: Cache@2 inputs: - key: ${{ parameters.name }} | ${{ parameters.vmImage }} | $(STACK_YAML) | stack-root | $(Agent.OS) | version 2 + key: ${{ parameters.name }} | ${{ parameters.vmImage }} | $(STACK_YAML) | stack-root | $(Agent.OS) | version3 path: $(STACK_ROOT) cacheHitVar: CACHE_RESTORED displayName: Cache stack root - bash: | set -o xtrace - #curl -sSkL https://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.7.0/Dynamic-MINGW/Win64/libblas.dll -o libblas.dll - # curl -sSkL https://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.7.0/Dynamic-MINGW/Win64/libblas.lib -o libblas.lib - #curl -sSkL https://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.7.0/Dynamic-MINGW/Win64/liblapack.dll -o liblapack.dll - # curl -sSkL https://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.7.0/Dynamic-MINGW/Win64/liblapack.lib -o liblapack.lib - # cp libblas.dll libblas.lib liblapack.dll liblapack.lib /usr/lib/ - # cp libblas.dll libblas.lib liblapack.dll liblapack.lib /lib/ - # cp libblas.dll libblas.lib liblapack.dll liblapack.lib /usr/local/lib/ - # cp libblas.dll libblas.lib liblapack.dll liblapack.lib /c/mingw810/prerequisites/x86_64-binutils-nomulti/x86_64-w64-mingw32/lib - # cp libblas.dll libblas.lib liblapack.dll liblapack.lib /c/mingw810/prerequisites/x86_64-binutils-nomulti/lib - echo $CONDA - echo $PATH - CWD=`pwd` - cd "$CONDA/condabin/" - export PATH=`pwd`:$PATH - cd $CWD - echo $PATH - echo `which conda.bat` - echo `which conda` - conda info --envs - ls $CONDA/condabin - # $CONDA/condabin/conda.bat create --yes --name reanimate - # $CONDA/condabin/conda.bat activate reanimate - $CONDA/condabin/conda.bat - $CONDA/condabin/conda.bat install --yes --quiet -c conda-forge libblas - $CONDA/condabin/conda.bat install --yes --quiet -c conda-forge liblapack - find "$CONDA" -name '*libblas*' - find "$CONDA" -name '*lapack*' - # export LIBRARY_PATH="`pwd`;$LIBRARY_PATH" + $CONDA/condabin/conda.bat install --yes --quiet -c msys2 m2w64-gcc-libgfortran m2w64-openblas + + cp $CONDA/Library/mingw-w64/bin/libgfortran-3.dll $CONDA/Library/mingw-w64/bin/libgfortran.dll + curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip unzip -o /usr/bin/stack.zip -d /usr/bin/ + displayName: 'Setup' - bash: | set -o xtrace - stack --install-ghc build $ARGS --no-keep-going --fast --only-dependencies - stack --install-ghc test $ARGS --no-keep-going --fast --flag reanimate:test --only-dependencies + stack --install-ghc build $ARGS --no-keep-going --fast --only-dependencies --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin + stack --install-ghc test $ARGS --no-keep-going --fast --flag reanimate:test --only-dependencies --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin displayName: 'Install dependencies' - bash: | set -o xtrace - stack ./examples/counter.hs check - rm examples/*.golden - stack test --flag reanimate:test --test-arguments="-j2" --fast + # stack ./examples/counter.hs check + stack test --flag reanimate:test --test-arguments="-j2" --fast --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin displayName: 'Build & Test' - bash: | # stack haddock --no-haddock-deps diff --git a/reanimate.cabal b/reanimate.cabal index b141638..15cbce7 100644 --- a/reanimate.cabal +++ b/reanimate.cabal @@ -37,8 +37,8 @@ Source-Repository head Location: git://github.com/lemmih/reanimate.git Flag hmatrix - Description: Enable hmatrix dependency (requires blas and lapack) - Default: True + Description: Enable hmatrix dependency on Windows (requires openblas) + Default: False Manual: True Flag test @@ -119,7 +119,7 @@ library optparse-applicative, chiphunk >= 0.1.2.1, geojson, aeson >= 1.3.0.0, split, fingertree, array, cereal, vector-space - if flag(hmatrix) && !os(windows) { + if flag(hmatrix) || !os(windows) { build-depends: hmatrix >= 0.20.0.0 exposed-modules: Reanimate.Morph.Rigid Reanimate.Math.Smooth