Commit a9b85b67 authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Merge branch 'master' of gitlab.mpcdf.mpg.de:tpurcell/cpp_sisso into joss

parents 819db148 76797c03
......@@ -368,12 +368,16 @@ endif()
# Coin-Clp for linear programing
get_filename_component(COIN_CLP_CXX ${CMAKE_CXX_COMPILER} NAME)
set(COIN_UTILS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/CoinUtils/build/")
set(COIN_UTILS_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/CoinUtils/bin/")
set(COIN_UTILS_INCLUDE_DIRS "${COIN_UTILS_INSTALL_DIR}/include/coin")
set(COIN_UTILS_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib/coin-or/")
set(COIN_CLP_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/coin-Clp/build/")
set(COIN_CLP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/coin-Clp/bin/")
set(COIN_CLP_INCLUDE_DIRS "${COIN_CLP_INSTALL_DIR}/include/;${COIN_CLP_INSTALL_DIR}/include/coin")
set(COIN_CLP_INCLUDE_DIRS "${COIN_CLP_INSTALL_DIR}/include/")
set(COIN_CLP_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib/coin-or/")
set(COIN_CLP_BLAS_LAPACK_LIBS "-L${LAPACK_DIR}")
set(COIN_CLP_URL "https://www.coin-or.org/download/source/Clp/Clp-1.17.6.tgz")
foreach(LAPACK_LIB_FILE IN LISTS LAPACK_LIBRARIES)
get_filename_component(LAPACK_LIB ${LAPACK_LIB_FILE} NAME_WE)
......@@ -382,21 +386,41 @@ foreach(LAPACK_LIB_FILE IN LISTS LAPACK_LIBRARIES)
endforeach()
set(COIN_CLP_BLAS_LAPACK_LIBS "${COIN_CLP_BLAS_LAPACK_LIBS}")
message(STATUS "COIN_CLP_BLAS_LAPACK_LIBS = ${COIN_CLP_BLAS_LAPACK_LIBS}")
set(COIN_CLP_CONFIGURE_COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/cmake/coin-Clp/clp_configure.sh ${COIN_CLP_INSTALL_DIR} ${COIN_CLP_BLAS_LAPACK_LIBS} ${COIN_CLP_CXX} ${COIN_CLP_LIBRARY_DIRS})
set(COIN_CLP_CONFIGURE_COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/cmake/coin-Clp/clp_configure.sh ${COIN_CLP_INSTALL_DIR} ${COIN_CLP_BLAS_LAPACK_LIBS} ${COIN_CLP_CXX} ${COIN_CLP_LIBRARY_DIRS} "${COIN_UTILS_LIBRARY_DIRS}/libCoinUtils.so" ${COIN_UTILS_INCLUDE_DIRS})
set(COIN_UTILS_CONFIGURE_COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/cmake/CoinUtils/coin_utils_configure.sh ${COIN_UTILS_INSTALL_DIR} ${COIN_CLP_BLAS_LAPACK_LIBS} ${COIN_CLP_CXX} ${COIN_CLP_LIBRARY_DIRS})
set(COIN_UTILS_MAKE_INSTALL_COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/cmake/CoinUtils/coin_utils_make_install.sh ${COIN_UTILS_LIBRARY_DIRS}/libCoinUtils.so)
set(COIN_CLP_MAKE_INSTALL_COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/cmake/coin-Clp/clp_make_install.sh ${COIN_CLP_LIBRARY_DIRS}/libClp.so)
ExternalProject_Add(
external_CoinUtils
PREFIX "external/CoinUtils"
GIT_REPOSITORY "https://github.com/coin-or/CoinUtils.git"
GIT_TAG "releases/2.11.4"
CONFIGURE_COMMAND "${COIN_UTILS_CONFIGURE_COMMAND}"
BUILD_COMMAND make -j ${BOOST_BUILD_N_PROCS}
INSTALL_COMMAND "${COIN_UTILS_MAKE_INSTALL_COMMAND}"
BINARY_DIR "${COIN_UTILS_BUILD_DIR}"
INSTALL_DIR "${COIN_UTILS_INSTALL_DIR}"
)
ExternalProject_Add(
external_Clp
PREFIX "external/coin-Clp"
URL ${COIN_CLP_URL}
GIT_REPOSITORY "https://github.com/coin-or/Clp.git"
GIT_TAG "releases/1.17.6"
CONFIGURE_COMMAND "${COIN_CLP_CONFIGURE_COMMAND}"
BUILD_COMMAND make -j ${BOOST_BUILD_N_PROCS}
INSTALL_COMMAND make install
INSTALL_COMMAND ${COIN_UTILS_MAKE_INSTALL_COMMAND}
BINARY_DIR "${COIN_CLP_BUILD_DIR}"
INSTALL_DIR "${COIN_CLP_INSTALL_DIR}"
)
add_dependencies(external_Clp external_CoinUtils)
set(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY_DIRS}/libClp.so;${COIN_CLP_LIBRARY_DIRS}/libCoinUtils.so")
include_directories(${COIN_CLP_INCLUDE_DIRS})
include_directories(${COIN_UTILS_INCLUDE_DIRS})
if(BUILD_TESTS)
find_package(GTest)
......
#! /usr/bin/bash
../src/external_CoinUtils/configure -C CXX=$3 --prefix=$1 --with-lapack-lflags="$2"
../src/external_CoinUtils/configure -C CXX=$3 --prefix=$1 --with-lapack-lflags="$2" --libdir=$4 ADD_CXXFLAGS="-std=c++14 -fPIC --shared"
#! /usr/bin/bash
if [ ! -f $1 ]; then make install; fi
#! /usr/bin/bash
../src/external_Clp/configure -C CXX=$3 --prefix=$1 --with-lapack-lib="$2" --with-blas-lib="$2" --libdir=$4 ADD_CXXFLAGS="-std=c++14 -fPIC --shared"
../src/external_Clp/configure -C CXX=$3 --prefix=$1 --with-lapack-lib="$2" --with-blas-lib="$2" --libdir=$4 --with-coinutils-lib="$5" --with-coinutils-incdir="$6" ADD_CXXFLAGS="-std=c++14 -fPIC --shared"
#! /usr/bin/bash
if [ ! -f $1 ]; then make install; fi
......@@ -16,6 +16,7 @@ RUN apt-get update &&\
apt-get install -y openmpi-bin openmpi-common libopenmpi-dev &&\
apt-get install -y doxygen &&\
apt-get install -y gcovr &&\
apt-get install -y pkgconf &&\
apt-get clean
RUN apt-get install -y gpg-agent wget software-properties-common &&\
......
......@@ -12,22 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "gtest/gtest.h"
#include <utils/compare_features.hpp>
#include <feature_creation/node/ModelNode.hpp>
#include "feature_creation/node/ModelNode.hpp"
#include "mpi_interface/MPI_Ops.hpp"
#include "utils/compare_features.hpp"
namespace {
//test mean calculations
TEST(CompFeats, CompFeatTest)
{
std::vector<double> val_1 = {1.0, 2.0, 3.0, 4.0};
std::vector<double> val_2 = {2.0, 2.0, 3.0, 4.0};
std::vector<double> val_2 = {2.0, 1.0, 3.0, 4.0};
std::vector<double> val_3 = {2.0, 4.0, 6.0, 8.0};
std::vector<double> target = {1.0, 3.0, 5.0, 6.0};
std::vector<double> scores = {0.9897782665572893};
std::vector<node_ptr> selected(1);
std::vector<node_sc_pair> mpi_op_sel(1);
node_value_arrs::initialize_values_arr({4}, {0}, 1, 0, false);
selected[0] = std::make_shared<FeatureNode>(0, "A", val_3, std::vector<double>(), Unit());
mpi_op_sel[0] = mpi_reduce_op::make_node_sc_pair(selected[0], scores[0]);
node_value_arrs::initialize_d_matrix_arr();
node_value_arrs::resize_d_matrix_arr(1);
......@@ -36,13 +40,36 @@ namespace {
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson_max_corr_1(val_1.data(), 4, 1.0, scores, 0.9897782665572893, 1, 0));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson_max_corr_1_feat_list(val_1.data(), 4, 1.0, selected, scores, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson_max_corr_1_mpi_op(val_1.data(), 4, 1.0, mpi_op_sel, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson(val_1.data(), 4, 1.0, scores, 0.9897782665572893, 1, 0));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson_feat_list(val_1.data(), 4, 1.0, selected, scores, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_pearson_mpi_op(val_1.data(), 4, 1.0, mpi_op_sel, 0.9897782665572893));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson_max_corr_1(val_2.data(), 4, 1.0, scores, 0.9028289727756884, 1, 0));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson_max_corr_1_feat_list(val_2.data(), 4, 1.0, selected, scores, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson_max_corr_1_mpi_op(val_2.data(), 4, 1.0, mpi_op_sel, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson(val_2.data(), 4, 1.0, scores, 0.9028289727756884, 1, 0));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson_feat_list(val_2.data(), 4, 1.0, selected, scores, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_pearson_mpi_op(val_2.data(), 4, 1.0, mpi_op_sel, 0.9028289727756884));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman_max_corr_1(val_1.data(), 4, 1.0, scores, 0.9897782665572893, 1, 0));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman_max_corr_1_feat_list(val_1.data(), 4, 1.0, selected, scores, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman_max_corr_1_mpi_op(val_1.data(), 4, 1.0, mpi_op_sel, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman(val_1.data(), 4, 1.0, scores, 0.9897782665572893, 1, 0));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman_feat_list(val_1.data(), 4, 1.0, selected, scores, 0.9897782665572893));
EXPECT_FALSE(comp_feats::valid_feature_against_selected_spearman_mpi_op(val_1.data(), 4, 1.0, mpi_op_sel, 0.9897782665572893));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman_max_corr_1(val_2.data(), 4, 1.0, scores, 0.9028289727756884, 1, 0));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman_max_corr_1_feat_list(val_2.data(), 4, 1.0, selected, scores, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman_max_corr_1_mpi_op(val_2.data(), 4, 1.0, mpi_op_sel, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman(val_2.data(), 4, 1.0, scores, 0.9028289727756884, 1, 0));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman_feat_list(val_2.data(), 4, 1.0, selected, scores, 0.9028289727756884));
EXPECT_TRUE(comp_feats::valid_feature_against_selected_spearman_mpi_op(val_2.data(), 4, 1.0, mpi_op_sel, 0.9028289727756884));
node_value_arrs::finalize_values_arr();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment