-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRHMC Integration within Volume Cooling Gaussians #314
Merged
TolisChal
merged 3 commits into
GeomScale:develop
from
vgnecula:crhmc_cooling_gaussians
Jul 19, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# VolEsti (volume computation and sampling library) | ||
|
||
# Copyright (c) 2012-2024 Vissarion Fisikopoulos | ||
# Copyright (c) 2018-2024 Apostolos Chalkis | ||
# Copyright (c) 2024 Vladimir Necula | ||
|
||
# Contributed and/or modified by Vladimir Necula, as part of Google Summer of | ||
# Code 2024 program. | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
project( VolEsti ) | ||
|
||
|
||
CMAKE_MINIMUM_REQUIRED(VERSION 3.11) | ||
|
||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) | ||
|
||
# Locate Intel MKL root (in case it is enabled) | ||
if (APPLE) | ||
set(MKLROOT /opt/intel/oneapi/mkl/latest) | ||
elseif(UNIX) | ||
#set(MKLROOT /opt/intel/oneapi/mkl/latest) | ||
set(MKLROOT $ENV{HOME}/intel/mkl) | ||
endif() | ||
|
||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
|
||
|
||
option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON) | ||
option(BUILTIN_EIGEN "Use eigen from ../../external" OFF) | ||
option(USE_MKL "Use MKL library to build eigen" OFF) | ||
|
||
|
||
if(DISABLE_NLP_ORACLES) | ||
add_definitions(-DDISABLE_NLP_ORACLES) | ||
else() | ||
find_library(IFOPT NAMES libifopt_core.so PATHS /usr/local/lib) | ||
find_library(IFOPT_IPOPT NAMES libifopt_ipopt.so PATHS /usr/local/lib) | ||
find_library(GMP NAMES libgmp.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(MPSOLVE NAMES libmps.so PATHS /usr/local/lib) | ||
find_library(PTHREAD NAMES libpthread.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(FFTW3 NAMES libfftw3.so.3 PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
|
||
if (NOT IFOPT) | ||
|
||
message(FATAL_ERROR "This program requires the ifopt library, and will not be compiled.") | ||
|
||
elseif (NOT GMP) | ||
|
||
message(FATAL_ERROR "This program requires the gmp library, and will not be compiled.") | ||
|
||
elseif (NOT MPSOLVE) | ||
|
||
message(FATAL_ERROR "This program requires the mpsolve library, and will not be compiled.") | ||
|
||
elseif (NOT FFTW3) | ||
|
||
message(FATAL_ERROR "This program requires the fftw3 library, and will not be compiled.") | ||
|
||
else() | ||
message(STATUS "Library ifopt found: ${IFOPT}") | ||
message(STATUS "Library gmp found: ${GMP}") | ||
message(STATUS "Library mpsolve found: ${MPSOLVE}") | ||
message(STATUS "Library fftw3 found:" ${FFTW3}) | ||
|
||
endif(NOT IFOPT) | ||
|
||
endif(DISABLE_NLP_ORACLES) | ||
|
||
include("../../external/cmake-files/Eigen.cmake") | ||
GetEigen() | ||
|
||
include("../../external/cmake-files/Boost.cmake") | ||
GetBoost() | ||
|
||
include("../../external/cmake-files/LPSolve.cmake") | ||
GetLPSolve() | ||
|
||
include("../../external/cmake-files/QD.cmake") | ||
GetQD() | ||
|
||
# Find lpsolve library | ||
find_library(LP_SOLVE NAMES liblpsolve55.so PATHS /usr/lib/lp_solve) | ||
|
||
if (NOT LP_SOLVE) | ||
message(FATAL_ERROR "This program requires the lp_solve library, and will not be compiled.") | ||
else () | ||
message(STATUS "Library lp_solve found: ${LP_SOLVE}") | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON") | ||
|
||
if (USE_MKL) | ||
find_library(BLAS NAMES libblas.so libblas.dylib PATHS /usr/local/Cellar/lapack/3.9.1_1/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu /usr/local/Cellar/openblas/0.3.15_1/lib /usr/lib) | ||
find_library(GFORTRAN NAME libgfortran.dylib PATHS /usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10) | ||
find_library(LAPACK NAME liblapack.dylib PATHS /usr/lib) | ||
find_library(OPENMP NAME libiomp5.dylib PATHS /opt/intel/oneapi/compiler/2021.1.1/mac/compiler/lib) | ||
|
||
include_directories (BEFORE ${MKLROOT}/include) | ||
set(PROJECT_LIBS ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GFORTRAN_LIBRARIES}) | ||
set(MKL_LINK "-L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl") | ||
add_definitions(-DEIGEN_USE_MKL_ALL) | ||
else() | ||
set(MKL_LINK "") | ||
endif(USE_MKL) | ||
|
||
include_directories (BEFORE ../../external) | ||
include_directories (BEFORE ../../external/minimum_ellipsoid) | ||
include_directories (BEFORE ../../include/) | ||
|
||
# for Eigen | ||
if (${CMAKE_VERSION} VERSION_LESS "3.12.0") | ||
add_compile_options(-D "EIGEN_NO_DEBUG") | ||
else () | ||
add_compile_definitions("EIGEN_NO_DEBUG") | ||
endif () | ||
|
||
|
||
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++17") # enable C++17 standard | ||
set(ADDITIONAL_FLAGS "-march=native -DSIMD_LEN=0 -DTIME_KEEPING") | ||
add_definitions(${CMAKE_CXX_FLAGS} "-O3 -DTIME_KEEPING" ${ADDITIONAL_FLAGS}) # 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_executable(volume_example volume_example.cpp) | ||
target_link_libraries(volume_example QD_LIB ${MKL_LINK} ${LP_SOLVE}) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// VolEsti (volume computation and sampling library) | ||
|
||
// Copyright (c) 2012-2024 Vissarion Fisikopoulos | ||
// Copyright (c) 2018-2024 Apostolos Chalkis | ||
// Copyright (c) 2024 Vladimir Necula | ||
|
||
// Contributed and/or modified by Vladimir Necula, as part of Google Summer of | ||
// Code 2024 program. | ||
|
||
// Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
#include "generators/known_polytope_generators.h" | ||
#include "random_walks/random_walks.hpp" | ||
#include "volume/volume_cooling_gaussians_crhmc.hpp" | ||
|
||
#include <iostream> | ||
#include <fstream> | ||
#include "misc/misc.h" | ||
|
||
typedef double NT; | ||
typedef Cartesian<NT> Kernel; | ||
typedef typename Kernel::Point Point; | ||
typedef BoostRandomNumberGenerator<boost::mt11213b, double> RandomNumberGenerator; | ||
typedef HPolytope<Point> HPOLYTOPE; | ||
|
||
void calculateAndVerifyVolume(HPOLYTOPE& polytope) { | ||
int walk_len = 10; | ||
NT e = 0.1; | ||
|
||
RandomNumberGenerator rng(polytope.dimension()); | ||
|
||
NT volume = volume_cooling_gaussians<HPOLYTOPE, RandomNumberGenerator>(polytope, rng, e, walk_len); | ||
|
||
std::cout << "Volume " << volume << std::endl; | ||
} | ||
|
||
int main() { | ||
|
||
HPOLYTOPE simplex = generate_simplex<HPOLYTOPE>(2, false); | ||
std::cout << std::endl << "Simplex: " << std::endl; | ||
simplex.print(); | ||
calculateAndVerifyVolume(simplex); | ||
|
||
HPOLYTOPE cube = generate_cube<HPOLYTOPE>(3, false); | ||
std::cout << std::endl << "Cube: " << std::endl; | ||
cube.print(); | ||
calculateAndVerifyVolume(cube); | ||
|
||
HPOLYTOPE cross = generate_cross<HPOLYTOPE>(3, false); | ||
std::cout << std::endl << "Cross: " << std::endl; | ||
cross.print(); | ||
calculateAndVerifyVolume(cross); | ||
|
||
HPOLYTOPE birkhoff = generate_birkhoff<HPOLYTOPE>(3); | ||
std::cout << std::endl << "Birkhoff: " << std::endl; | ||
birkhoff.print(); | ||
calculateAndVerifyVolume(birkhoff); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add copyright headers here please