CBLAS for Windows
This page will have instructions for building CBLAS implementations for windows.
Build Instructions for following implementations are currently available. If you are contributor and was able to successfully use CBLAS implementation other than the one listed below, please update the wiki with necessary details.
Follow the below steps to build OpenBLAS for Windows 8.1 64-bit. You would require cygwin installation with 64-bit MinGW compilers for x86_64 architecture.
- Download cygwin from here and make sure you install
x86_64-w64-mingw32-gcc-*
andx86_64-w64-mingw32-gfortran
compiler packages. It would be better if you install all standard dev packages to avoid hiccups in the build process. Also, make sure<cygwin_install_root>/bin
is added to your path so that any cygwin dlls required by OpenBLAS library would be found later. - Launch cygwin64 terminal and change directory to where your git repositories are generally cloned.
git clone git@github.com:xianyi/OpenBLAS.git
cd OpenBLAS
-
make BINARY=64 CC=/usr/bin/x86_64-w64-mingw32-gcc-4.8.3.exe FC=/usr/bin/x86_64-w64-mingw32-gfortran.exe
. This step by itself will take from fifteen to twenty minutes. So, you can take a break. mkdir -p package
-
make PREFIX=./package install
. Now you should be seeing three folders created under package folder.- bin - libopenblas.dll
- include - openblas headers
- lib - library files
- Launch Visual Studio Command Prompt for x64 and change working directory to
OpenBLAS/exports
on your machine. You need to go here to create .lib file required by Visual Studio to compile with OpenBLAS. -
lib.exe /machine:x64 /def:libopenblas.def
. This will create two files,- libopenblas.exp - Exports Library File
- libopenblas - Object File Library
- Copy the two files generated in step 9 to
OpenBLAS/package/lib
.
Now, OpenBLAS/package
is your OpenBLAS installation root which should be later used during ArrayFire CMake build configuration.
Make sure to add OpenBLAS/package/bin
folder full path to the windows PATH environment variable so that any mingw DLLs required by OpenBLAS
can be located by any executable that requires it.
If you don't wish to compile the OpenBLAS source distribution, it is possible to use the pre-built binaries provided by the project by following the steps below:
- Visit the OpenBLAS project page (http://www.openblas.net/) and download the latest source archive (eg: http://sourceforge.net/projects/openblas/files/v0.2.12/)
-
Note: on 64bit Windows you should use the "int32" build (
OpenBLAS-<version>-Win64-int32
), so that the types used in OpenBLAS' headers are compatible with Arrayfire. Otherwise the BLAS backend won't build without manually editingopenblas_config.h
and setting theblasint
typedef toint
(or commenting out#define OPENBLAS_USE64BITINT
).
- Download DependencyWalker (http://www.dependencywalker.com/)
- Extract the OpenBlas and DependencyWalker archives
- Run DependencyWalker (
depends.exe
) and openlibopenblas.dll
(in the "bin" directory) - In the function list view, press CTRL+A to select all the entries, then right-click and "Copy Function Names"
- Create a new text file called
libopenblas.txt
in the same directory aslibopenblas.dll
, edit it and paste in the list of functions - At the very top of the file (first line), insert "EXPORTS" on a line by its own. Example:
EXPORTS
caxpy
caxpy_
CAXPY
ccopy
ccopy_
CCOPY
...
- Rename the file to
libopenblas.def
- Open the Visual Studio Developer Console (x64) in the same directory and run:
lib.exe /machine:x64 /def:libopenblas.def
There will now be a valid libopenblas.lib
file available.
Finally, if you don't have a MinGW distribution installed, you will need the DLLs provided in the mingw64_dll.zip
archive.
- The ArrayFire Community
-
Getting ArrayFire
- Installers
- Installing via Package Managers
- Source
- Using ArrayFire on
- Building from Source
- Linux
- OSX
- Windows
- Building Dependencies
- Known Issues
- Contributing Code to ArrayFire
- Development Guidelines
- Recognition