Skip to content
chenyulue edited this page Oct 31, 2019 · 14 revisions

The installation steps here work for the newest GHC, and I hope others can improve this installation tutorial, esp. for windows os.

Linux

Fedora

sudo dnf install blas-devel
sudo dnf install lapack-devel
sudo dnf install gsl-devel
cabal install hmatrix-tests

In the shell, after running the above command, hmatrix and hmatrix-gsl are installed.

Windows

Install with OpenBLAS

On windows OS, according to the original installation help, OpenBLAS is recommended. So the first step is to install openblas. In the installation help, it tells to download the compiled openblas from http://www.openblas.net/. However, if you install hmatrix according to that tutorial, hmatrix can be installed, but an error telling that the libopenblas.dll can't be accessed will be shown when you implement some code in GHCi. So you need to compile and install openblas from the source manully. As for compiling openblas, please refer to the OpenBLAS wiki. Since there are more information on the OpenBLAS wiki, I'll give the simple steps that work for compiling openblas and installing hmatrix.

  1. Install MinGW (GCC) compiler suite, either either 32-bit (http://www.mingw.org/) or 64-bit (http://mingw-w64.sourceforge.net/), and install msys with MinGW. Note: there are some problems if you use mingw-w64 through msys2 to compile openblas. For details, please see issue 1503. So make sure you install MinGW and msys from http://mingw-w64.sourceforge.net/, which is important.
  2. Download the openblas source either by git clone or by zip-file.
  3. Open msys terminal, in which cd to the openblas folder, and compile the souce by make command
cd ~/OpenBLAS
make
  1. Install the library to a certain location.
make PREFIX=/your/installation/path install
  1. Copy
  • the compiled libopenblas.dll ---> C:\Users{yourname}\AppData\Local\Programs\stack\x86_64-windows\msys2-20161025\mingw64\bin,
  • files in include ---> C:\Users{yourname}\AppData\Local\Programs\stack\x86_64-windows\msys2-20161025\mingw64\include,
  • files in lib ---> C:\Users{yourname}\AppData\Local\Programs\stack\x86_64-windows\msys2-20161025\mingw64\lib,
  • or any locations that are in the search path.
  1. Install hmatrix.
stack install hmatrix --flag hmatrix:openblas

Or you can use cabal to install it.

After that, if the installation succeeds, it will work in GHCi without any errors.

Clone this wiki locally