2012-06-23 08:22:53 +08:00
# OpenBLAS
2011-01-25 00:05:00 +08:00
2015-08-20 11:21:09 +08:00
[](https://gitter.im/xianyi/OpenBLAS?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
2015-10-27 07:14:41 +08:00
Travis CI: [](https://travis-ci.org/xianyi/OpenBLAS)
2013-07-05 15:28:41 +08:00
2015-10-27 07:14:41 +08:00
AppVeyor: [](https://ci.appveyor.com/project/xianyi/openblas/branch/develop)
2012-06-23 08:22:53 +08:00
## Introduction
2014-06-28 03:05:18 +08:00
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
2011-01-25 00:05:00 +08:00
2012-06-23 08:34:40 +08:00
Please read the documents on OpenBLAS wiki pages < http: / / github . com / xianyi / OpenBLAS / wiki > .
2012-06-23 08:22:53 +08:00
2013-07-20 11:35:27 +08:00
## Binary Packages
We provide binary packages for the following platform.
* Windows x86/x86_64
You can download them from [file hosting on sourceforge.net ](https://sourceforge.net/projects/openblas/files/ ).
## Installation from Source
2011-02-19 00:18:17 +08:00
Download from project homepage. http://xianyi.github.com/OpenBLAS/
2012-06-23 08:34:40 +08:00
Or, check out codes from git://github.com/xianyi/OpenBLAS.git
2012-06-23 08:22:53 +08:00
### Normal compile
* type "make" to detect the CPU automatically.
2011-04-22 22:07:46 +08:00
or
2012-06-23 08:22:53 +08:00
* type "make TARGET=xxx" to set target CPU, e.g. "make TARGET=NEHALEM". The full target list is in file TargetList.txt.
2011-01-25 00:05:00 +08:00
2012-06-23 08:22:53 +08:00
### Cross compile
2011-01-25 16:52:36 +08:00
Please set CC and FC with the cross toolchains. Then, set HOSTCC with your host C compiler. At last, set TARGET explicitly.
2012-06-23 08:22:53 +08:00
Examples:
2011-01-25 16:52:36 +08:00
On X86 box, compile this library for loongson3a CPU.
2012-06-23 08:22:53 +08:00
make BINARY=64 CC=mips64el-unknown-linux-gnu-gcc FC=mips64el-unknown-linux-gnu-gfortran HOSTCC=gcc TARGET=LOONGSON3A
2013-04-07 15:42:07 +08:00
On X86 box, compile this library for loongson3a CPU with loongcc (based on Open64) compiler.
make CC=loongcc FC=loongf95 HOSTCC=gcc TARGET=LOONGSON3A CROSS=1 CROSS_SUFFIX=mips64el-st-linux-gnu- NO_LAPACKE=1 NO_SHARED=1 BINARY=32
2012-06-23 08:22:53 +08:00
### Debug version
make DEBUG=1
2013-07-01 00:36:13 +08:00
### Install to the directory (optional)
2012-06-23 08:22:53 +08:00
Example:
make install PREFIX=your_installation_directory
2011-02-22 13:40:40 +08:00
2011-06-20 18:36:29 +08:00
The default directory is /opt/OpenBLAS
2012-06-23 08:22:53 +08:00
## Support CPU & OS
2011-01-25 00:05:00 +08:00
Please read GotoBLAS_01Readme.txt
2012-06-23 08:34:40 +08:00
### Additional support CPU:
#### x86/x86-64:
2012-06-23 09:35:19 +08:00
- **Intel Xeon 56xx (Westmere)**: Used GotoBLAS2 Nehalem codes.
2014-09-17 22:01:07 +08:00
- **Intel Sandy Bridge**: Optimized Level-3 and Level-2 BLAS with AVX on x86-64.
- **Intel Haswell**: Optimized Level-3 and Level-2 BLAS with AVX2 and FMA on x86-64.
2012-06-23 09:35:19 +08:00
- **AMD Bobcat**: Used GotoBLAS2 Barcelona codes.
2014-09-17 22:01:07 +08:00
- **AMD Bulldozer**: x86-64 ?GEMM FMA4 kernels. (Thank Werner Saar)
- **AMD PILEDRIVER**: Uses Bulldozer codes with some optimizations.
2014-12-28 20:16:46 +08:00
- **AMD STEAMROLLER**: Uses Bulldozer codes with some optimizations.
2012-06-23 09:35:19 +08:00
2012-06-23 08:34:40 +08:00
#### MIPS64:
2012-06-23 09:35:19 +08:00
- **ICT Loongson 3A**: Optimized Level-3 BLAS and the part of Level-1,2.
- **ICT Loongson 3B**: Experimental
2014-09-17 22:01:07 +08:00
#### ARM:
- **ARMV6**: Optimized BLAS for vfpv2 and vfpv3-d16 ( e.g. BCM2835, Cortex M0+ )
- **ARMV7**: Optimized BLAS for vfpv3-d32 ( e.g. Cortex A8, A9 and A15 )
#### ARM64:
- **ARMV8**: Experimental
2016-02-13 00:33:53 +08:00
- **ARM Cortex-A57**: Experimental
2014-09-17 22:01:07 +08:00
2012-06-23 09:35:19 +08:00
### Support OS:
- **GNU/Linux**
2016-02-13 00:33:53 +08:00
- **MingWin or Visual Studio(CMake)/Windows**: Please read < https: // github . com / xianyi / OpenBLAS / wiki / How-to-use-OpenBLAS-in-Microsoft-Visual-Studio > .
2012-06-23 09:35:19 +08:00
- **Darwin/Mac OS X**: Experimental. Although GotoBLAS2 supports Darwin, we are the beginner on Mac OS X.
2013-07-01 00:36:13 +08:00
- **FreeBSD**: Supported by community. We didn't test the library on this OS.
2016-04-26 18:14:03 +08:00
- **Android**: Supported by community. Please read < https: // github . com / xianyi / OpenBLAS / wiki / How-to-build-OpenBLAS-for-Android > .
2011-02-19 00:18:17 +08:00
2012-06-23 08:22:53 +08:00
## Usages
2011-01-25 02:12:06 +08:00
Link with libopenblas.a or -lopenblas for shared library.
2011-01-25 00:05:00 +08:00
2014-06-28 03:05:18 +08:00
### Set the number of threads with environment variables.
2012-06-23 08:22:53 +08:00
Examples:
2012-06-23 08:34:40 +08:00
2012-06-23 08:22:53 +08:00
export OPENBLAS_NUM_THREADS=4
2011-02-24 15:16:21 +08:00
or
2012-06-23 08:22:53 +08:00
export GOTO_NUM_THREADS=4
2014-06-28 03:05:18 +08:00
or
2012-06-23 08:22:53 +08:00
export OMP_NUM_THREADS=4
2011-02-24 15:16:21 +08:00
2011-03-28 10:58:39 +08:00
The priorities are OPENBLAS_NUM_THREADS > GOTO_NUM_THREADS > OMP_NUM_THREADS.
2011-10-09 15:14:48 +08:00
If you compile this lib with USE_OPENMP=1, you should set OMP_NUM_THREADS environment variable. OpenBLAS ignores OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS with USE_OPENMP=1.
2011-02-24 15:16:21 +08:00
2014-06-28 03:05:18 +08:00
### Set the number of threads on runtime.
2012-06-23 08:22:53 +08:00
2013-07-01 00:36:13 +08:00
We provided the below functions to control the number of threads on runtime.
2012-06-23 08:34:40 +08:00
2012-06-23 08:22:53 +08:00
void goto_set_num_threads(int num_threads);
2012-06-23 08:34:40 +08:00
2012-06-23 08:22:53 +08:00
void openblas_set_num_threads(int num_threads);
2011-01-25 02:12:06 +08:00
2011-03-28 10:58:39 +08:00
If you compile this lib with USE_OPENMP=1, you should use the above functions, too.
2012-06-23 08:22:53 +08:00
## Report Bugs
2011-01-25 02:12:06 +08:00
Please add a issue in https://github.com/xianyi/OpenBLAS/issues
2011-01-25 00:05:00 +08:00
2012-06-23 08:22:53 +08:00
## Contact
2013-04-25 00:45:42 +08:00
* OpenBLAS users mailing list: https://groups.google.com/forum/#!forum/openblas-users
* OpenBLAS developers mailing list: https://groups.google.com/forum/#!forum/openblas-dev
2011-02-26 12:27:56 +08:00
2012-06-23 08:22:53 +08:00
## ChangeLog
2011-03-28 10:58:39 +08:00
Please see Changelog.txt to obtain the differences between GotoBLAS2 1.13 BSD version.
2012-06-23 08:22:53 +08:00
## Troubleshooting
2012-10-09 14:52:35 +08:00
* Please read [Faq ](https://github.com/xianyi/OpenBLAS/wiki/Faq ) at first.
2012-06-23 08:22:53 +08:00
* Please use gcc version 4.6 and above to compile Sandy Bridge AVX kernels on Linux/MingW/BSD.
2012-06-21 08:25:52 +08:00
* Please use Clang version 3.1 and above to compile the library on Sandy Bridge microarchitecture. The Clang 3.0 will generate the wrong AVX binary code.
2014-09-17 22:01:07 +08:00
* The number of CPUs/Cores should less than or equal to 256. On Linux x86_64(amd64), there is experimental support for up to 1024 CPUs/Cores and 128 numa nodes if you build the library with BIGNUMA=1.
* OpenBLAS does not set processor affinity by default. On Linux, you can enable processor affinity by commenting the line NO_AFFINITY=1 in Makefile.rule. But this may cause [the conflict with R parallel ](https://stat.ethz.ch/pipermail/r-sig-hpc/2012-April/001348.html ).
2014-06-28 03:05:18 +08:00
* On Loongson 3A. make test would be failed because of pthread_create error. The error code is EAGAIN. However, it will be OK when you run the same testcase on shell.
2011-05-12 19:05:20 +08:00
2013-07-20 11:35:27 +08:00
## Contributing
2014-06-28 03:05:18 +08:00
1. [Check for open issues ](https://github.com/xianyi/OpenBLAS/issues ) or open a fresh issue to start a discussion around a feature idea or a bug.
2013-07-20 11:35:27 +08:00
1. Fork the [OpenBLAS ](https://github.com/xianyi/OpenBLAS ) repository to start making your changes.
1. Write a test which shows that the bug was fixed or that the feature works as expected.
1. Send a pull request. Make sure to add yourself to `CONTRIBUTORS.md` .
2013-09-05 15:39:45 +08:00
## Donation
Please read [this wiki page ](https://github.com/xianyi/OpenBLAS/wiki/Donation ).