Project

General

Profile

Installing OpenBlas on Windows » History » Version 6

John Cary, 04/27/2019 09:55 AM

1 1 John Cary
# Installing OpenBlas on Windows
2
3 6 John Cary
These instructions largely derive from [Installing OpenBLAS using Conda](https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio#1-native-msvc-abi).
4 4 John Cary
5 5 John Cary
Install 64bit Miniconda3 with Python-2.7. It should be easily found in your preferred search engine's results.  The current link is https://docs.conda.io/en/latest/miniconda.html.  Install options: 
6 4 John Cary
7
* All users.
8
* Do not add Anaconda to the system path variable.
9 1 John Cary
* Do not register Python as the system Python 2.7.
10 4 John Cary
11 5 John Cary
Open the "Anaconda Command Prompt", which should be available in the start menu, with administrative privileges.  Execute
12 1 John Cary
13 5 John Cary
~~~
14
conda update -n base conda
15
conda config --add channels conda-forge
16
conda install -y cmake flang clangdev perl libflang
17
conda install -y -c isuruf kitware-ninja
18
~~~
19
20
Activate the 64-bit build environment with Visual Studio.  E.g., 
21
22
~~~
23
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
24
~~~
25
26
In a cygwin window, untar openblas into /winsame/builds-vs2017, and create the build directory
27
28
~~~
29
mkdir -p /winsame/builds-vs2017/openblas
30
cd /winsame/builds-vs2017/openblas
31
tar xf ~/svnpkgs/openblas-0.3.4.tar.xz
32
~~~
33
34
Back in the Anaconda prompt, move to the openblas area, create the build subdirectory, and set needed environment variables.  E.g.,
35
36
~~~
37
D:
38
cd \winsame\builds-vs2017openblas\openblas-0.3.4
39
mkdir build
40
cd build
41
set "LIB=%CONDA_INSTALL_LOCN%\Library\lib;%LIB%"
42
set "CPATH=%CONDA_INSTALL_LOCN%\Library\include;%CPATH%
43
~~~
44
45
Configure, build, install shared openblas for installation into your contrib dir.  E.g.,
46
47
~~~
48
cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=D:/winsame/contrib-vs2017/openblas-0.3.4-sersh
49
ninja clean
50
cmake --build . --config Release
51
ninja install
52
~~~
53
54
Configure, build, install static openblas without autolinking of the shared runtime libraries for installation into your contrib dir.  E.g.,
55
56
~~~
57
cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE -DCMAKE_C_FLAGS_RELEASE:STRING="/O2 /Ob2 /D NDEBUG" -DCMAKE_CXX_FLAGS_RELEASE:STRING="/O2 /Ob2 /D NDEBUG" -DCMAKE_INSTALL_PREFIX:PATH=D:/winsame/contrib-vs2017/openblas-0.3.4-ser
58
ninja clean
59
cmake --build . --config Release
60
ninja install
61
~~~