Skip to content

Commit 2aef279

Browse files
authored
Simplify OpenBLAS installation on Windows (#2016)
* Use cmake-install instead of funny manual copying * Build parallel * Upload build artifacts for debugging * Silence stupid MSVC copyright messages
1 parent cfe49a1 commit 2aef279

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

.github/workflows/test_windows.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ jobs:
1515
env:
1616
AMICI_SKIP_CMAKE_TESTS: "TRUE"
1717
openBLAS_version: "0.3.19"
18-
AMICI_DLL_DIRS: "C:\\BLAS\\bin"
18+
AMICI_DLL_DIRS: "C:\\BLAS\\OpenBLAS\\bin"
19+
LIB: "C:/BLAS/OpenBLAS/lib"
20+
CFLAGS: "-nologo"
21+
CXXFLAGS: "-nologo"
22+
LDFLAGS: "-nologo"
1923

2024
strategy:
2125
matrix:
@@ -33,11 +37,11 @@ jobs:
3337
- shell: bash
3438
run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
3539
- shell: bash
36-
run: echo "C:\\BLAS\\bin" >> $GITHUB_PATH
40+
run: echo "C:\\BLAS\\OpenBLAS\\bin" >> $GITHUB_PATH
3741
- shell: bash
38-
run: echo "BLAS_LIBS=/LIBPATH:C:/BLAS/lib openblas.lib" >> $GITHUB_ENV
42+
run: echo "BLAS_LIBS=-LIBPATH:C:/BLAS/OpenBLAS/lib openblas.lib" >> $GITHUB_ENV
3943
- shell: bash
40-
run: echo "BLAS_CFLAGS=-IC:/BLAS/OpenBLAS-${openBLAS_version}/OpenBLAS-${openBLAS_version}" >> $GITHUB_ENV
44+
run: echo "BLAS_CFLAGS=-IC:/BLAS/OpenBLAS/include/openblas/" >> $GITHUB_ENV
4145

4246
# Developer Command Prompt for Microsoft Visual C++
4347
- uses: ilammy/msvc-dev-cmd@v1
@@ -53,6 +57,11 @@ jobs:
5357
shell: powershell
5458
run: scripts/installOpenBLAS
5559

60+
- uses: actions/upload-artifact@v3
61+
with:
62+
name: OpenBLAS
63+
path: C:\BLAS\OpenBLAS
64+
5665
- name: Create sdist
5766
working-directory: python/sdist
5867
run: pip install build && python -m build --sdist

scripts/compileBLAS.cmd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
echo compileBLAS.cmd started for openBLAS version %1
22
cd /D "C:\BLAS\OpenBLAS-%1\OpenBLAS-%1"
33
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
4-
cmake -G "Ninja" ^
4+
cmake -S . -B build ^
5+
-G "Ninja" ^
56
-DBUILD_DOUBLE=1 ^
67
-DBUILD_SHARED_LIBS=ON ^
7-
-DCMAKE_INSTALL_PREFIX:PATH="C:\BLAS\OpenBLAS-%1\OpenBLAS-%1\out\install\x64-Release" ^
8+
-DCMAKE_INSTALL_PREFIX:PATH="C:/BLAS/OpenBLAS" ^
89
-DCMAKE_C_COMPILER:FILEPATH=cl ^
910
-DCMAKE_BUILD_TYPE=Release ^
10-
-DCMAKE_MAKE_PROGRAM=ninja ^
11-
"C:\BLAS\OpenBLAS-%1\OpenBLAS-%1"
12-
cmake --build "C:\BLAS\OpenBLAS-%1\OpenBLAS-%1" --parallel 2
11+
-DCMAKE_MAKE_PROGRAM=ninja
12+
cmake --build build --parallel 2
13+
cmake --install build
1314
echo compileBLAS.cmd completed

scripts/installOpenBLAS.ps1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ $webclient = New-Object System.Net.WebClient
99
$webclient.DownloadFile($uri,"$output")
1010
Expand-Archive -Path "C:\BLAS\v$version.zip" -DestinationPath "C:\BLAS\OpenBLAS-$version" -Force # expand zip file
1111
cmd /c "scripts\compileBLAS.cmd $version"
12-
cmd /c dumpbin /DEPENDENTS "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\openblas.dll"
13-
New-Item -Path 'C:\BLAS\lib' -ItemType Directory -Force # create directory
14-
Copy-Item "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\Release\openblas.lib" -Destination "C:\BLAS\lib" -Recurse
15-
New-Item -Path 'C:\BLAS\bin' -ItemType Directory -Force # create directory
16-
Copy-Item "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\openblas.dll" -Destination "C:\BLAS\bin" -Recurse
12+
cmd /c dumpbin /DEPENDENTS "C:\BLAS\OpenBLAS\bin\openblas.dll"
1713
Get-ChildItem -Path "C:\BLAS" -Include "openblas.lib" -Recurse # check for file
1814
Get-ChildItem -Path "C:\BLAS" -Include "openblas.dll" -Recurse # check for file
15+
Get-ChildItem -Path "C:\BLAS" -Include "cblas.h" -Recurse # check for file
1916
Get-Item -Path Env:BLAS_* # check environment variables
2017
$VerbosePreference = "SilentlyContinue" # don't display verbose messages
2118
Write-Host 'script installOpenBLAS.ps1 completed'

0 commit comments

Comments
 (0)