1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
LAPACK++ Installation Notes
================================================================================
[TOC]
Synopsis
--------------------------------------------------------------------------------
Configure and compile the LAPACK++ library and its tester,
then install the headers and library.
Option 1: Makefile
make && make install
Option 2: CMake
# LAPACK++ requires BLAS++, from
# https://github.com/icl-utk-edu/blaspp
cd /path/to/blaspp
mkdir build && cd build
cmake ..
make && make install
# After installing BLAS++ above
cd /path/to/lapackpp
mkdir build && cd build
cmake ..
make && make install
Environment variables (Makefile and CMake)
--------------------------------------------------------------------------------
Standard environment variables affect both Makefile (configure.py) and CMake.
These include:
LD Linker; defaults to CXX
CXX C++ compiler
CXXFLAGS C++ compiler flags
LDFLAGS linker flags
CPATH compiler include search path
LIBRARY_PATH compile-time library search path
LD_LIBRARY_PATH runtime library search path
DYLD_LIBRARY_PATH runtime library search path on macOS
CUDA_PATH path to CUDA, e.g., /usr/local/cuda
CUDA_HOME also recognized for path to CUDA
ROCM_PATH path to ROCm, e.g., /opt/rocm
Options (Makefile and CMake)
--------------------------------------------------------------------------------
See the BLAS++ INSTALL.md for BLAS++ specific options. Since the LAPACK library
is often bundled with the BLAS library, such as -lopenblas, it should be specified in BLAS++.
LAPACK++ specific options include (all values are case insensitive):
lapack
LAPACK libraries to search for.
LAPACK is often included in the BLAS library (e.g., -lopenblas contains both),
so there is usually no need to specify this. One or more of:
auto search for all libraries (default)
generic generic -llapack
LAPACK_LIBRARIES
Specify the exact LAPACK libraries, overriding the built-in search.
Again, there is usually no need to specify this. E.g.,
cmake -DLAPACK_LIBRARIES='-lopenblas' ..
gpu_backend
BLAS++ must be built with the same GPU backend.
auto (default) auto-detect CUDA, HIP/ROCm, or SYCL
cuda build with CUDA support
hip build with HIP/ROCm support
sycl build with SYCL and oneMKL support
none do not build with GPU backend
color
Whether to use ANSI colors in output. One of:
auto uses color if output is a TTY
(default with Makefile; not support with CMake)
yes (default with CMake)
no
With Makefile, options are specified as environment variables or on the
command line using `option=value` syntax, such as:
python3 configure.py lapack=generic
With CMake, options are specified on the command line using
`-Doption=value` syntax (not as environment variables), such as:
cmake -Dblas=mkl ..
Makefile Installation
--------------------------------------------------------------------------------
Available targets:
make - configures (if make.inc is missing),
then compiles the library and tester
make config - configures LAPACK++, creating a make.inc file
make lib - compiles the library (lib/liblapackpp.so)
make tester - compiles test/tester
make check - run basic checks using tester
make docs - generates documentation in docs/html/index.html
make install - installs the library and headers to ${prefix}
make uninstall - remove installed library and headers from ${prefix}
make clean - deletes object (*.o) and library (*.a, *.so) files
make distclean - also deletes make.inc and dependency files (*.d)
### Options
make config [options]
or
python3 configure.py [options]
Runs the `configure.py` script to detect your compiler and library properties,
then creates a make.inc configuration file. You can also manually edit the
make.inc file. Options are name=value pairs to set variables.
Besides the Environment variables and Options listed above, additional
options include:
static
Whether to build as a static or shared library.
0 shared library (default)
1 static library
prefix
Where to install, default /opt/slate.
Headers go in ${prefix}/include,
library goes in ${prefix}/lib${LIB_SUFFIX}
These can be set in your environment or on the command line, e.g.,
python3 configure.py CXX=g++ prefix=/usr/local
Configure assumes environment variables are set so your compiler can find BLAS
and LAPACK libraries. For example:
export LD_LIBRARY_PATH="/opt/my-blas/lib64" # or DYLD_LIBRARY_PATH on macOS
export LIBRARY_PATH="/opt/my-blas/lib64"
export CPATH="/opt/my-blas/include"
or
export LDFLAGS="-L/opt/my-blas/lib64 -Wl,-rpath,/opt/my-blas/lib64"
export CXXFLAGS="-I/opt/my-blas/include"
On some systems, loading the appropriate module will set these flags:
module load my-blas
### Vendor notes
Intel MKL provides scripts to set these flags, e.g.:
source /opt/intel/bin/compilervars.sh intel64
or
source /opt/intel/mkl/bin/mklvars.sh intel64
IBM ESSL provides only a subset of LAPACK functions,
so Netlib LAPACK is also required.
### Manual configuration
If you have a specific configuration that you want, set CXX, CXXFLAGS, LDFLAGS,
and LIBS, e.g.:
export CXX="g++"
export CXXFLAGS="-I${MKLROOT}/include -fopenmp"
export LDFLAGS="-L${MKLROOT}/lib/intel64 -Wl,-rpath,${MKLROOT}/lib/intel64 -fopenmp"
export LIBS="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lm"
These can also be set when running configure:
make config CXX=g++ \
CXXFLAGS="-I${MKLROOT}/include -fopenmp" \
LDFLAGS="-L${MKLROOT}/lib/intel64 -Wl,-rpath,${MKLROOT}/lib/intel64 -fopenmp" \
LIBS="-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lm"
Note that all test programs are compiled with those options, so errors may cause
configure to fail.
If you experience unexpected problems, please see config/log.txt to diagnose the
issue. The log shows the option being tested, the exact command run, the
command's standard output (stdout), error output (stderr), and exit status. All
test files are in the config directory.
CMake Installation
--------------------------------------------------------------------------------
LAPACK++ requires BLAS++ and inherits its dependencies from BLAS++, so BLAS++ must be
installed first via CMake, before running CMake for LAPACK++. Information and
installation instructions can be found at https://github.com/icl-utk-edu/blaspp.
Briefly:
# LAPACK++ requires BLAS++, from
# https://github.com/icl-utk-edu/blaspp
cd /path/to/blaspp
cmake [-DCMAKE_INSTALL_PREFIX=/path/to/install] [options] ..
make
make install
The CMake script enforces an out-of-source build. Create a build
directory under the LAPACK++ root directory:
# After installing BLAS++ above
cd /path/to/lapackpp
mkdir build && cd build
cmake [-DCMAKE_INSTALL_PREFIX=/path/to/install] [options] ..
make
make install
LAPACK++ should find BLAS++ if it is installed in a system default
location (e.g., /usr/local), or their install prefix is the same. If
LAPACK++ can't find BLAS++, you can point to its directory:
cmake -DCMAKE_PREFIX_PATH=/path/to/install [options] ..
or
cmake -Dblaspp_DIR=/path/to/install/lib/blaspp [options] ..
LAPACK++ uses the TestSweeper library (https://github.com/icl-utk-edu/testsweeper)
to run its tests. If CMake doesn't find TestSweeper, it will be
downloaded and compiled. To use a different TestSweeper build that was
not installed, you can point to its directory.
cmake -Dtestsweeper_DIR=/path/to/testsweeper/build [options] ..
### Options
Besides the Environment variables and Options listed above, additional
options include:
build_tests
Whether to build test suite (test/tester).
Requires TestSweeper, CBLAS, and LAPACKE. One of:
yes (default)
no
use_cmake_find_lapack
Whether to use CMake's FindLAPACK, instead of LAPACK++ search.
Again, as LAPACK is often included in the BLAS library,
there is usually no need to specify this. One of:
yes
no (default)
If BLA_VENDOR is set, it automatically uses CMake's FindLAPACK.
BLA_VENDOR
Use CMake's FindLAPACK, instead of LAPACK++ search. For values, see:
https://cmake.org/cmake/help/latest/module/FindLAPACK.html
Standard CMake options include:
BUILD_SHARED_LIBS
Whether to build as a static or shared library. One of:
yes shared library (default)
no static library
CMAKE_INSTALL_PREFIX (alias prefix)
Where to install, default /opt/slate.
Headers go in ${prefix}/include,
library goes in ${prefix}/lib
CMAKE_PREFIX_PATH
Where to look for CMake packages such as BLAS++ and TestSweeper.
CMAKE_BUILD_TYPE
Type of build. One of:
[empty] default compiler optimization (no flags)
Debug no optimization, with asserts (-O0 -g)
Release optimized, no asserts, no debug info (-O3 -DNDEBUG)
RelWithDebInfo optimized, no asserts, with debug info (-O2 -DNDEBUG -g)
MinSizeRel Release, but optimized for size (-Os -DNDEBUG)
CMAKE_MESSAGE_LOG_LEVEL (alias log)
Level of messages to report. In ascending order:
FATAL_ERROR, SEND_ERROR, WARNING, AUTHOR_WARNING, DEPRECATION,
NOTICE, STATUS, VERBOSE, DEBUG, TRACE.
Particularly, DEBUG or TRACE gives useful information.
With CMake, options are specified on the command line using
`-Doption=value` syntax (not as environment variables), such as:
# in build directory
cmake -Dbuild_tests=no -DCMAKE_INSTALL_PREFIX=/usr/local ..
Alternatively, use the `ccmake` text-based interface or the CMake app GUI.
# in build directory
ccmake ..
# Type 'c' to configure, then 'g' to generate Makefile
To re-configure CMake, you may need to delete CMake's cache:
# in build directory
rm CMakeCache.txt
# or
rm -rf *
cmake [options] ..
To debug the build, set `VERBOSE`:
# in build directory, after running cmake
make VERBOSE=1
|