Skip to content

Commit

Permalink
Make cblas default (#82)
Browse files Browse the repository at this point in the history
Use HAVE_CBLAS by default to cling.
  • Loading branch information
wolfv authored and SylvainCorlay committed Aug 13, 2018
1 parent ab1354d commit b8c955a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ set(XTENSOR_BLAS_HEADERS
)

OPTION(CXXBLAS_DEBUG "print cxxblas debug information" OFF)
OPTION(HAVE_CBLAS "use cblas" ON)
OPTION(XTENSOR_USE_FLENS_BLAS "use FLENS generic implementation instead of cblas" OFF)

if(HAVE_CBLAS)
add_definitions(-DHAVE_CBLAS=1)
if(XTENSOR_USE_FLENS_BLAS)
add_definitions(-DXTENSOR_USE_FLENS_BLAS=1)
endif()

if (CXXBLAS_DEBUG)
Expand Down
4 changes: 3 additions & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ A package for xtensor-blas is available on the conda package manager.
From source with cmake
----------------------

You can install ``xtensor-blas`` from source with cmake. On Unix platforms, from the source directory:
You can install ``xtensor-blas`` from source with cmake.
Note that you need to have a BLAS installation available (e.g. OpenBLAS, MKL ...).
On Unix platforms, from the source directory:

.. code::
Expand Down
4 changes: 2 additions & 2 deletions docs/source/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ with conda is ``OpenBLAS``, but other options, such as ``MKL`` are available
on conda, too. If xtensor-blas was not installed from conda, the user has
to manually verify that a BLAS and `LAPACK <https://en.wikipedia.org/wiki/LAPACK>`_
implementation is available.
Additionally, the compile time define ``-DHAVE_CBLAS`` should be enabled,
otherwise FLENS will use the slower internal implementation.
If you want to fallback to a slower, more generic BLAS implementation, you can use
the compile time define ``-DXTENSOR_USE_FLENS_BLAS``.

In order to link against ``OpenBLAS`` from CMake, the following lines have
to be added to the ``CMakeLists.txt`` file.
Expand Down
4 changes: 4 additions & 0 deletions include/xtensor-blas/xblas_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#define XTENSOR_BLAS_VERSION_MINOR 12
#define XTENSOR_BLAS_VERSION_PATCH 0

#ifndef XTENSOR_USE_FLENS_BLAS
#define HAVE_CBLAS 1
#endif

#ifndef USE_CXXLAPACK
#define USE_CXXLAPACK
#endif
Expand Down
6 changes: 6 additions & 0 deletions include/xtensor-blas/xblas_config_cling.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
#pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR_32@)
#pragma cling add_library_path(@XTENSOR_BLAS_CLING_LIBRARY_DIR@)

#ifndef XTENSOR_USE_FLENS_BLAS

#define HAVE_CBLAS 1

#pragma cling load("libblas")
#pragma cling load("liblapack")

#endif

#endif

0 comments on commit b8c955a

Please sign in to comment.