Skip to content

Commit

Permalink
Merge branch 'develop' into integrate_crmhc_simd
Browse files Browse the repository at this point in the history
  • Loading branch information
Apostolos Chalkis committed Oct 16, 2023
2 parents 03a08c5 + ac68063 commit 3f815ad
Show file tree
Hide file tree
Showing 33 changed files with 234 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake-clang.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##############################################################################
# GitHub Actions Workflow for volesti to build tests with GCC
# GitHub Actions Workflow for volesti to build tests with Clang
#
# Copyright (c) 2020-2022 Vissarion Fisikopoulos
#
Expand Down Expand Up @@ -36,4 +36,4 @@ jobs:
cd build;
cmake -D CMAKE_CXX_COMPILER=${{ matrix.config.compiler }} -D CMAKE_CXX_FLAGS=-fsanitize=memory -D CMAKE_CXX_FLAGS=-fsanitize=undefined -D CMAKE_CXX_FLAGS=-g -D DISABLE_NLP_ORACLES=ON -D USE_MKL=OFF ../test;
make;
ctest --verbose;
ctest --verbose;
40 changes: 40 additions & 0 deletions .github/workflows/cmake-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##############################################################################
# GitHub Actions Workflow for volesti to build tests with GCC
#
# Copyright (c) 2020-2022 Vissarion Fisikopoulos
#
# Licensed under GNU LGPL.3, see LICENCE file
##############################################################################
name: cmake-examples

on: [push, pull_request]

jobs:
build:
name: ${{ matrix.config.os }} - ${{ matrix.config.compiler }}
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-22.04, compiler_pkg: clang-11, compiler: clang++-11}
- {os: ubuntu-22.04, compiler_pkg: g++-11, compiler: g++-11}
runs-on: ${{ matrix.config.os }}
steps:
- uses: actions/checkout@v1
- run: sudo apt-get update || true;
sudo apt-get install ${{ matrix.config.compiler_pkg }} lp-solve libomp-dev libopenblas-dev libarpack2-dev;
- name: Build examples
run: |
cd examples
for dir in */; do
if [ "$dir" != "EnvelopeProblemSOS/" ] && [ "$dir" != "python_utilities/" ]; then
echo
echo "Building examples in $dir ....................."
cd "$dir"
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=${{ matrix.config.compiler }} -DUSE_MKL=OFF ..
make
cd ../..
fi
done
103 changes: 53 additions & 50 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to volesti,
which are hosted in the [GeomScale Organization](https://github.com/GeomScale) on GitHub.
These are mostly guidelines, not rules.
The following is a set of guidelines for contributing to volesti,
which are hosted in the [GeomScale Organization](https://github.com/GeomScale) on GitHub.
These are mostly guidelines, not rules.
Use your best judgment, and feel free to propose changes to this document in a pull request.

## Table of Contents

* [Prerequisites (how to start)](#prerequisites--how-to-start-)
* [Testing the development branch of volesti (get the tools ready)](#testing-the-development-branch-of-volesti--get-the-tools-ready-)
* [Fork volesti repository (this is your repo now!)](#fork--volesti-repository--this-is-your-repo-now--)
+ [Verify if your fork works (optional)](#verify-if-your-fork-works--optional-)
* [Working with volesti (get ready to contribute)](#working-with-volesti--get-ready-to-contribute-)
+ [GitFlow workflow](#gitflow-workflow)
+ [Create new branch for your work](#create-new-branch-for-your-work)
+ [Verify your new branch (optional)](#verify-your-new-branch--optional-)
* [Modify the branch (implement, implement, implement)](#modify-the-branch--implement--implement--implement-)
+ [Tests](#tests)
+ [Push](#push)
* [Pull request (the joy of sharing)](#pull-request--the-joy-of-sharing-)
* [Review (ok this is not an exam)](#review--ok-this-is-not-an-exam-)
- [Prerequisites (how to start)](#prerequisites--how-to-start-)
- [Testing the development branch of volesti (get the tools ready)](#testing-the-development-branch-of-volesti--get-the-tools-ready-)
- [Fork volesti repository (this is your repo now!)](#fork--volesti-repository--this-is-your-repo-now--)
- [Verify if your fork works (optional)](#verify-if-your-fork-works--optional-)
- [Working with volesti (get ready to contribute)](#working-with-volesti--get-ready-to-contribute-)
- [GitFlow workflow](#gitflow-workflow)
- [Create new branch for your work](#create-new-branch-for-your-work)
- [Verify your new branch (optional)](#verify-your-new-branch--optional-)
- [Modify the branch (implement, implement, implement)](#modify-the-branch--implement--implement--implement-)
- [Tests](#tests)
- [Push](#push)
- [Pull request (the joy of sharing)](#pull-request--the-joy-of-sharing-)
- [Review (ok this is not an exam)](#review--ok-this-is-not-an-exam-)

## Prerequisites (how to start)

* git (see [Getting Started with Git](https://help.github.com/en/github/using-git/getting-started-with-git-and-github))
* a compiler to run tests - gcc, clang, etc.
* configured GitHub account
- git (see [Getting Started with Git](https://help.github.com/en/github/using-git/getting-started-with-git-and-github))
- a compiler to run tests - gcc, clang, etc.
- configured GitHub account

Other helpful links:

* http://git-scm.com/documentation
* https://help.github.com/articles/set-up-git
* https://opensource.com/article/18/1/step-step-guide-git
- http://git-scm.com/documentation
- https://help.github.com/articles/set-up-git
- https://opensource.com/article/18/1/step-step-guide-git

## Testing the development branch of volesti (get the tools ready)

Clone the repository,
Clone the repository,

git clone [email protected]:GeomScale/volume_approximation.git volesti
cd volesti
Expand All @@ -52,21 +52,23 @@ To compile the `C++` code you have to specify the path to external library `libl
# e.g. on linux: cmake -DLP_SOLVE=/usr/lib/lp_solve/liblpsolve55.so ..
make

Run the tests,
You can check [here](/docs/getting_started/install.md) to see more installation guide.

ctest -jK
Run the tests,

where `K` is the number of CPU threads. By adding the option `--verbose` to `ctest` you get more information about the tests,
*e.g.* time per test, volume computed and the name of the polytope or convex body.
ctest -jK

where `K` is the number of CPU threads. By adding the option `--verbose` to `ctest` you get more information about the tests,
_e.g._ time per test, volume computed and the name of the polytope or convex body.

![test_cube](https://user-images.githubusercontent.com/3660366/72348403-0524df00-36e3-11ea-9b6d-288a2bddc22c.png)

If everything works for you, you may move forward.

## Fork volesti repository (this is your repo now!)

You can't work directly in the original volesti repository, therefore you should create your fork of this library.
This way you can modify the code and when the job is done send a pull request to merge your changes with the original
You can't work directly in the original volesti repository, therefore you should create your fork of this library.
This way you can modify the code and when the job is done send a pull request to merge your changes with the original
repository.

![fork](https://user-images.githubusercontent.com/3660366/72348562-57fe9680-36e3-11ea-9746-385ff61c752a.png)
Expand All @@ -90,9 +92,10 @@ clone your repository and checkout develop branch

git clone [email protected]:vissarion/volume_approximation.git volesti_fork
cd volesti_fork
git checkout develop
git remote add upstream [email protected]:GeomScale/volesti.git
git fetch upstream
git checkout upstream/develop
git branch -vv
git pull

see commits

Expand All @@ -105,17 +108,17 @@ For now you should see exactly the same commits as in `volesti` repository.

### GitFlow workflow

Volesit is using the [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) workflow.
It's because it is very well suited to collaboration and scaling the development team.
Volesit is using the [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) workflow.
It's because it is very well suited to collaboration and scaling the development team.
Each repository using this model should contain two main branches:

* master - release-ready version of the library
* develop - development version of the library
and could contain various supporting branches for new features and hotfixes.
- master - release-ready version of the library
- develop - development version of the library

and could contain various supporting branches for new features and hotfixes.

As a contributor you'll most likely be adding new features or fixing bugs in the development version of the library.
This means that for each contribution you should create a new branch originating from the develop branch,
As a contributor you'll most likely be adding new features or fixing bugs in the development version of the library.
This means that for each contribution you should create a new branch originating from the develop branch,
modify it and send a pull request in order to merge it, again with the develop branch.

### Create new branch for your work
Expand All @@ -128,15 +131,15 @@ you should see

![branch -vv](https://user-images.githubusercontent.com/3660366/72348696-a1e77c80-36e3-11ea-93ec-70f5622c0675.png)

Now you should pick a name for your new branch that doesn't already exist.
Now you should pick a name for your new branch that doesn't already exist.
The following checks for existing remote branches

git branch -a

![List of branches](https://user-images.githubusercontent.com/3660366/72348763-c5aac280-36e3-11ea-8f2c-c66e2c107929.png)
Alternatively, you can check them on `GitHub`.

Assume you want to add some new functionality (i.e. a new feature) for example a new sampling algorithm. Then you have
Assume you want to add some new functionality (i.e. a new feature) for example a new sampling algorithm. Then you have
to create a new branch e.g. `feature/the_fastest_sampling_algo_ever`

Create new local branch
Expand Down Expand Up @@ -168,12 +171,12 @@ Alternatively, your newly created remote branch is also available on GitHub

## Modify the branch (implement, implement, implement)

Before contributiong to a library by adding a new feature, or a bugfix, or improving documentation,
Before contributiong to a library by adding a new feature, or a bugfix, or improving documentation,
it is always wise to interact with the community of developers, for example by opening an issue.

### Tests

Tests are placed in the `test` directory and use the [doctest](https://github.com/onqtam/doctest) library.
Tests are placed in the `test` directory and use the [doctest](https://github.com/onqtam/doctest) library.

It is recommended to add new test whenever you contribute a new functionality/feature.
Also if your contribution is a bugfix then consider adding this case to the test-suite.
Expand Down Expand Up @@ -202,16 +205,16 @@ and click the "Create pull request" button.

## Review (ok this is not an exam)

After creating a pull request your code will be reviewed. You can propose one or more reviewers
After creating a pull request your code will be reviewed. You can propose one or more reviewers
by clicking on the "Reviewers" button

![reviewer](https://user-images.githubusercontent.com/3660366/72349476-44ecc600-36e5-11ea-81cd-d0938d923529.png)

If there are no objections your changes will be merged.
If there are no objections your changes will be merged.
Otherwise you'll see some comments under the pull request and/or under specific lines of your code.
Then you have to make the required changes, commit them and push to your branch.
Those changes will automatically be a part of the same pull request. This procedure will be repeated until the code
Then you have to make the required changes, commit them and push to your branch.
Those changes will automatically be a part of the same pull request. This procedure will be repeated until the code
is ready for merging.

If you're curious how it looks like you may see one of the open or closed
If you're curious how it looks like you may see one of the open or closed
[pull requests](https://github.com/GeomScale/volume_approximation/pulls).
15 changes: 15 additions & 0 deletions docs/getting_started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ make
```
For example: `-DLP_SOLVE=/usr/lib/lpsolve/liblpsolve55.so`

In WSL (Windows Subsystem Linux), you can run the following command to install libc6-dev-i386. This will be required for `ieeefp.h` which is used by `qd` library,

sudo apt-get install libc6-dev-i386

Also to install `mkl` related dependencies, run the following,

wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
sudo apt-get update
sudo apt-get install intel-mkl-2020.4-912
sudo sh -c "echo /opt/intel/mkl/lib/intel64 > /etc/ld.so.conf.d/intel-mkl.conf"
sudo ldconfig
export CPLUS_INCLUDE_PATH="/opt/intel/mkl/include:$CPLUS_INCLUDE_PATH"

You can run the tests by `cmake test` or `ctest -jK` where `K` the number of `CPU` threads. By adding the option `--verbose` to `ctest` you get more information about the tests, *e.g.* time per test, volume computed and the name of the polytope or convex body.

### Development environment from Docker container
Expand Down
2 changes: 1 addition & 1 deletion examples/hpolytope-volume/hpolytopeVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef typename Kernel::Point Point;
typedef BoostRandomNumberGenerator<boost::mt19937, NT, 3> RNGType;
typedef HPolytope <Point> HPOLYTOPE;

void calculateVolumes(const HPOLYTOPE &HP) {
void calculateVolumes(HPOLYTOPE &HP) {
// Setup parameters for calculating volume
int walk_len = 10 + HP.dimension()/10;
NT e=0.1;
Expand Down
2 changes: 1 addition & 1 deletion examples/mmcs_method/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ else ()
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-DBOOST_NO_AUTO_PTR")
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgslcblas")
#add_definitions( "-O3 -lgsl -lm -ldl -lgslcblas" )

find_package(OpenMP REQUIRED)

add_executable (skinny_cube_10_dim skinny_cube_10_dim.cpp)
Expand Down
6 changes: 3 additions & 3 deletions examples/multithread_sampling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ else ()
endif ()


add_definitions(${CMAKE_CXX_FLAGS} "-std=c++11") # enable C++11 standard
#add_definitions(${CMAKE_CXX_FLAGS} "-std=c++11") # enable C++11 standard
add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-ldl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-DBOOST_NO_AUTO_PTR")
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgslcblas")
#add_definitions( "-O3 -lgsl -lm -ldl -lgslcblas" )

find_package(OpenMP REQUIRED)

add_executable (sampling_multithread_walks sampling_multithread_walks.cpp)

TARGET_LINK_LIBRARIES(sampling_multithread_walks ${LP_SOLVE} OpenMP::OpenMP_CXX)


Expand Down
11 changes: 5 additions & 6 deletions examples/multithread_sampling/sampling_multithread_walks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ MT get_uniform_samples(Polytope &P,
std::list<Point> randPoints;

typedef RandomPointGeneratorMultiThread <walk> _RandomPointGeneratorMultiThread;

_RandomPointGeneratorMultiThread::apply(P, p, N, walk_len, num_threads, randPoints,
push_back_policy, rng);

unsigned int d = P.dimension();

MT samples(d, N);
unsigned int jj = 0;

Expand Down Expand Up @@ -92,7 +92,7 @@ MT get_gaussian_samples(Polytope &P,
std::list<Point> randPoints;

typedef GaussianPointGeneratorMultiThread <walk> _GaussianPointGeneratorMultiThread;

_GaussianPointGeneratorMultiThread::apply(P, p, a_i, N, walk_len, num_threads, randPoints,
push_back_policy, rng);

Expand All @@ -118,11 +118,10 @@ void test_uniform_random_walk(std::string random_walk, unsigned int const& num_t
typedef Eigen::Matrix<NT,Eigen::Dynamic,Eigen::Dynamic> MT;
typedef Eigen::Matrix<NT,Eigen::Dynamic,1> VT;
typedef BoostRandomNumberGenerator<boost::mt19937, NT, 3> RNGType;
Hpolytope P;
unsigned int d = 10, walk_len = 5, N = 5000;

std::cout << "--- Sampling with " + random_walk + " walk from H-cube10" << std::endl;
P = generate_cube<Hpolytope>(d, false);
Hpolytope P = generate_cube<Hpolytope>(d, false);
RNGType rng(P.dimension());

MT samples = get_uniform_samples<MT, WalkType, Point>(P, rng, walk_len, N, num_threads);
Expand Down Expand Up @@ -155,7 +154,7 @@ void test_gaussian_random_walk(std::string random_walk, unsigned int const& num_


int main() {

unsigned int num_threads = 2;

test_uniform_random_walk<double, BRDHRWalk_multithread>("BRDHR", num_threads);
Expand Down
9 changes: 5 additions & 4 deletions examples/optimization_spectrahedra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ IF (OPENBLAS_LIB)
IF (GFORTRAN_LIB)
message( STATUS "GFORTRAN_LIB found: ${GFORTRAN_LIB}" )

add_executable (boltzmann_hmc_walk boltzmann_hmc_walk.cpp)
TARGET_LINK_LIBRARIES(boltzmann_hmc_walk ${ARPACK_LIB} ${LAPACK_LIBRARIES} ${GFORTRAN_LIB})
# These are not compiling, see issue https://github.com/GeomScale/volesti/issues/264
#add_executable (boltzmann_hmc_walk boltzmann_hmc_walk.cpp)
#TARGET_LINK_LIBRARIES(boltzmann_hmc_walk ${ARPACK_LIB} ${LAPACK_LIBRARIES} ${GFORTRAN_LIB})

add_executable (solve_sdp solve_sdp.cpp)
TARGET_LINK_LIBRARIES(solve_sdp ${GFORTRAN_LIB} ${LAPACK_LIBRARIES} ${ARPACK_LIB})
#add_executable (solve_sdp solve_sdp.cpp)
#TARGET_LINK_LIBRARIES(solve_sdp ${GFORTRAN_LIB} ${LAPACK_LIBRARIES} ${ARPACK_LIB})

ELSE()
MESSAGE(STATUS "gfortran is required but it could not be found")
Expand Down
6 changes: 3 additions & 3 deletions examples/sampling-hpolytope-with-billiard-walks/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void write_to_file(std::string filename, std::vector<Point> const& randPoints) {
}


void sample_using_uniform_billiard_walk(HPOLYTOPE const& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
void sample_using_uniform_billiard_walk(HPOLYTOPE& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
std::string filename = "uniform_billiard_walk.txt";
typedef RandomPointGenerator<BilliardWalkType> Generator;

Expand All @@ -49,7 +49,7 @@ void sample_using_uniform_billiard_walk(HPOLYTOPE const& HP, RNGType& rng, unsig
}


void sample_using_uniform_accelerated_billiard_walk(HPOLYTOPE const& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
void sample_using_uniform_accelerated_billiard_walk(HPOLYTOPE& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
std::string filename = "uniform_accelerated_billiard_walk.txt";
typedef RandomPointGenerator<AcceleratedBilliardWalkType> Generator;

Expand All @@ -61,7 +61,7 @@ void sample_using_uniform_accelerated_billiard_walk(HPOLYTOPE const& HP, RNGType
}


void sample_using_gaussian_billiard_walk(HPOLYTOPE const& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
void sample_using_gaussian_billiard_walk(HPOLYTOPE& HP, RNGType& rng, unsigned int walk_len, unsigned int num_points) {
std::string filename = "gaussian_billiard_walk.txt";
typedef MultivariateGaussianRandomPointGenerator<GaussianAcceleratedWalkType> Generator;

Expand Down
Loading

0 comments on commit 3f815ad

Please sign in to comment.