-
Notifications
You must be signed in to change notification settings - Fork 151
Installation
Boost.uBlas is a header only library. You only need to include the right headers and take care of the dependencies.
Make sure you have a C++ compiler that supports C++17 (master) and C++20 (develop)
g++ --version
# g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
or
clang++ --version
# Ubuntu clang version 11.0.0-2~ubuntu20.04.1
uBlas can be compiled without the boost
super project
Clone the uBlas project
git clone [email protected]:boostorg/ublas.git
cd ublas
Switch to the master branch
git checkout master # develop or any other feature branch
Try out an example:
cd examples/tensor
g++ -std=c++20 simple_expressions.cpp -I../../include -o simple_expressions
g++ -std=c++20 instantiate_tensor.cpp -I../../include -o instantiate_tensor
Clone the Boost super-project
git clone --recursive --jobs 8 https://github.com/boostorg/boost.git
Switch the Boost super-project to desired branch, master
or develop
cd boost
git checkout master
TIP: Modular Boost Library Maintenance
guide, for more realistic test environment, recommends to develop and test
individual Boost library against other Boost libraries as defined by
the Boost super-project master
branch:
cd boost
git checkout master
git pull
git submodule update --init --recursive --jobs 8
Build the b2
driver program for Boost.Build engine.
./bootstrap.sh
./b2 --version
TIP: For more convenient path-less invocation, you can copy the b2
program to a location in your PATH
.
Optionally, create full content of /boost
virtual directory with
all Boost headers linked from the individual modular Boost libraries.
If you skip this step, executing b2
to run tests will automatically
create the directory with all headers required by Boost.uBLAS and tests.
./b2 -j8 headers
Regardless if you decide to develop again master
(recommended) or develop
branch of the Boost super-project, you should always base your contributions (i.e. topic branches) on Boost.uBLAS develop
branch. Go to the Boost.uBLAS library submodule.
cd libs/numeric/ublas
Checkout the develop
branch and bring it up to date
git checkout develop
git branch -vv
git pull origin develop
The b2 invocation explains available options like toolset
, variant
and others. Execute b2
to run all tests built using default variant=debug
and default toolset
determined for your development environment.
Build examples of Boost.uBLAS assuming that you are in the boost
folder.
cd libs/numeric/ublas
../../../b2 -j8 release toolset=clang cxxflags="-O3" examples/tensor
Build tests of Boost.uBLAS assuming that you are in the boost
folder.
cd libs/numeric/ublas
../../../b2 -j8 release toolset=clang cxxflags="-O3" test/tensor
TIP: If something goes wrong, you end up with incomplete or accidentally modified files in your clone of the super-project repository, or you simply wish to start fresh, then you can clean and reset the whole repository and its modules:
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive --jobs 8