diff --git a/CMakeLists.txt b/CMakeLists.txt index 06d593bfb..e8ccd9b79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # CMake configuration # =========================================================================== -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) # =========================================================================== # Project configuration @@ -216,7 +216,6 @@ find_package(Cgl REQUIRED) find_package(Clp REQUIRED) find_package(CoinUtils REQUIRED) find_package(Osi REQUIRED) -find_package(glog REQUIRED) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) diff --git a/cmake/json-cmake-1.1.0/JSONParser.cmake b/cmake/json-cmake-1.1.0/JSONParser.cmake index f26f73ca7..d055d521f 100644 --- a/cmake/json-cmake-1.1.0/JSONParser.cmake +++ b/cmake/json-cmake-1.1.0/JSONParser.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) if (DEFINED JSonParserGuard) return() diff --git a/src/cpp/benders/benders_by_batch/BendersByBatch.cpp b/src/cpp/benders/benders_by_batch/BendersByBatch.cpp index 8099d3b29..6189a2b85 100644 --- a/src/cpp/benders/benders_by_batch/BendersByBatch.cpp +++ b/src/cpp/benders/benders_by_batch/BendersByBatch.cpp @@ -8,7 +8,7 @@ #include "BatchCollection.h" #include "CustomVector.h" #include "RandomBatchShuffler.h" -#include "glog/logging.h" + BendersByBatch::BendersByBatch( BendersBaseOptions const &options, Logger logger, Writer writer, mpi::environment &env, mpi::communicator &world, diff --git a/src/cpp/benders/benders_by_batch/CMakeLists.txt b/src/cpp/benders/benders_by_batch/CMakeLists.txt index 096caf8f2..c62eb2a3f 100644 --- a/src/cpp/benders/benders_by_batch/CMakeLists.txt +++ b/src/cpp/benders/benders_by_batch/CMakeLists.txt @@ -36,7 +36,6 @@ target_link_libraries (benders_by_batch_core helpers output_core solvers - glog::glog ) add_library (${PROJECT_NAME}::benders_by_batch_core ALIAS benders_by_batch_core) \ No newline at end of file diff --git a/src/cpp/benders/benders_core/BendersBase.cpp b/src/cpp/benders/benders_core/BendersBase.cpp index 879f12b75..e3a3eff74 100644 --- a/src/cpp/benders/benders_core/BendersBase.cpp +++ b/src/cpp/benders/benders_core/BendersBase.cpp @@ -10,7 +10,7 @@ #include "LastIterationWriter.h" #include "LogUtils.h" #include "VariablesGroup.h" -#include "glog/logging.h" + #include "solver_utils.h" BendersBase::BendersBase(const BendersBaseOptions &options, Logger logger, @@ -68,8 +68,8 @@ void BendersBase::OpenCsvFile() { "time;basis;" << std::endl; } else { - LOG(INFO) << "Impossible to open the .csv file: " << _csv_file_path - << std::endl; + using namespace std::string_literals; + _logger->display_message("Impossible to open the .csv file: "s + _csv_file_path.string()); } } } diff --git a/src/cpp/benders/benders_core/CMakeLists.txt b/src/cpp/benders/benders_core/CMakeLists.txt index a80756ff6..0033c570a 100644 --- a/src/cpp/benders/benders_core/CMakeLists.txt +++ b/src/cpp/benders/benders_core/CMakeLists.txt @@ -44,7 +44,6 @@ target_link_libraries (benders_core helpers output_core solvers - glog::glog TBB::tbb ${JSONCPP_LIB} yaml-cpp diff --git a/src/cpp/benders/benders_core/Worker.cpp b/src/cpp/benders/benders_core/Worker.cpp index 49b0c2009..351326553 100644 --- a/src/cpp/benders/benders_core/Worker.cpp +++ b/src/cpp/benders/benders_core/Worker.cpp @@ -1,7 +1,7 @@ #include "Worker.h" #include "LogUtils.h" -#include "glog/logging.h" + #include "solver_utils.h" /*! * \brief Free the problem diff --git a/src/cpp/benders/benders_core/WorkerMaster.cpp b/src/cpp/benders/benders_core/WorkerMaster.cpp index 92dcb1bd6..9eec0b623 100644 --- a/src/cpp/benders/benders_core/WorkerMaster.cpp +++ b/src/cpp/benders/benders_core/WorkerMaster.cpp @@ -1,6 +1,6 @@ #include "WorkerMaster.h" -#include "glog/logging.h" + #include "solver_utils.h" WorkerMaster::WorkerMaster(Logger logger) : Worker(logger) { @@ -301,9 +301,7 @@ void WorkerMaster::_set_alpha_var() { solver_addrows(*_solver, rowtype, rowrhs, {}, mstart, mclind, matval); } } else { - LOG(INFO) - << "ERROR a variable named overall_subpb_cost_under_approx is in input" - << std::endl; + logger_->display_message("ERROR a variable named overall_subpb_cost_under_approx is in input", LogUtils::LOGLEVEL::ERR); } } diff --git a/src/cpp/benders/benders_mpi/BendersMPI.cpp b/src/cpp/benders/benders_mpi/BendersMPI.cpp index 83e0e71c3..a139056cf 100644 --- a/src/cpp/benders/benders_mpi/BendersMPI.cpp +++ b/src/cpp/benders/benders_mpi/BendersMPI.cpp @@ -6,7 +6,7 @@ #include "CustomVector.h" #include "Timer.h" -#include "glog/logging.h" + BendersMpi::BendersMpi(BendersBaseOptions const &options, Logger logger, Writer writer, mpi::environment &env, @@ -240,7 +240,6 @@ void BendersMpi::check_if_some_proc_had_a_failure(int success) { void BendersMpi::write_exception_message(const std::exception &ex) const { std::string error = "Exception raised : " + std::string(ex.what()); - LOG(WARNING) << error << std::endl; _logger->display_message(error); } diff --git a/src/cpp/benders/benders_mpi/CMakeLists.txt b/src/cpp/benders/benders_mpi/CMakeLists.txt index e759893f8..4db9be294 100644 --- a/src/cpp/benders/benders_mpi/CMakeLists.txt +++ b/src/cpp/benders/benders_mpi/CMakeLists.txt @@ -29,7 +29,6 @@ target_link_libraries (benders_mpi_core output_core Boost::mpi MPI::MPI_C - glog::glog ${PROJECT_NAME}::factories logger_lib Boost::serialization diff --git a/src/cpp/benders/benders_sequential/BendersSequential.cpp b/src/cpp/benders/benders_sequential/BendersSequential.cpp index 57bc50d78..45ec76e11 100644 --- a/src/cpp/benders/benders_sequential/BendersSequential.cpp +++ b/src/cpp/benders/benders_sequential/BendersSequential.cpp @@ -5,7 +5,7 @@ #include #include "Timer.h" -#include "glog/logging.h" + #include "solver_utils.h" /*! @@ -129,18 +129,16 @@ void BendersSequential::Run() { } void BendersSequential::launch() { - LOG(INFO) << "Building input" << std::endl; - - LOG(INFO) << "Constructing workers..." << std::endl; + _logger->display_message("Building input"); + _logger->display_message("Constructing workers..."); InitializeProblems(); - LOG(INFO) << "Running solver..." << std::endl; + _logger->display_message("Running solver..."); try { Run(); - LOG(INFO) << BendersName() + " solver terminated." << std::endl; + _logger->display_message(BendersName() + " solver terminated."); } catch (std::exception const &ex) { std::string error = "Exception raised : " + std::string(ex.what()); - LOG(WARNING) << error << std::endl; _logger->display_message(error); } diff --git a/src/cpp/benders/benders_sequential/CMakeLists.txt b/src/cpp/benders/benders_sequential/CMakeLists.txt index 68741f1a1..2631efc44 100644 --- a/src/cpp/benders/benders_sequential/CMakeLists.txt +++ b/src/cpp/benders/benders_sequential/CMakeLists.txt @@ -23,7 +23,6 @@ target_link_libraries (benders_sequential_core helpers output_core solvers - glog::glog ${PROJECT_NAME}::factories diff --git a/src/cpp/benders/factories/BendersFactory.cpp b/src/cpp/benders/factories/BendersFactory.cpp index 12c745306..ec49a0262 100644 --- a/src/cpp/benders/factories/BendersFactory.cpp +++ b/src/cpp/benders/factories/BendersFactory.cpp @@ -13,8 +13,6 @@ #include "Timer.h" #include "Worker.h" #include "WriterFactories.h" -#include "gflags/gflags.h" -#include "glog/logging.h" BENDERSMETHOD DeduceBendersMethod(size_t coupling_map_size, size_t batch_size, bool external_loop) { @@ -52,11 +50,6 @@ pBendersBase BendersMainFactory::PrepareForExecution( BendersBaseOptions benders_options(options.get_benders_options()); - google::InitGoogleLogging(argv_[0]); - auto path_to_log = - std::filesystem::path(options.OUTPUTROOT) / - ("bendersLog-rank" + std::to_string(pworld_->rank()) + ".txt."); - google::SetLogDestination(google::GLOG_INFO, path_to_log.string().c_str()); auto log_reports_name = std::filesystem::path(options.OUTPUTROOT) / "reportbenders.txt"; diff --git a/src/cpp/benders/merge_mps/CMakeLists.txt b/src/cpp/benders/merge_mps/CMakeLists.txt index 1a6568a96..25c0c9e7a 100644 --- a/src/cpp/benders/merge_mps/CMakeLists.txt +++ b/src/cpp/benders/merge_mps/CMakeLists.txt @@ -26,7 +26,6 @@ target_link_libraries (merge_mps_core factories output_core solvers - glog::glog ) add_library (${PROJECT_NAME}::merge_mps_core ALIAS merge_mps_core) \ No newline at end of file diff --git a/src/cpp/benders/merge_mps/MergeMPS.cpp b/src/cpp/benders/merge_mps/MergeMPS.cpp index 6da03edc1..cd30b0571 100644 --- a/src/cpp/benders/merge_mps/MergeMPS.cpp +++ b/src/cpp/benders/merge_mps/MergeMPS.cpp @@ -5,7 +5,6 @@ #include "ArchiveReader.h" #include "LogUtils.h" #include "Timer.h" -#include "glog/logging.h" MergeMPS::MergeMPS(const MergeMPSOptions &options, Logger &logger, Writer writer) @@ -26,7 +25,7 @@ void MergeMPS::launch() { CouplingMap x_mps_id; int cntProblems_l(0); - LOG(INFO) << "Merging problems..." << std::endl; + _logger->display_message("Merging problems..."); for (auto const &kvp : input) { auto problem_name(inputRootDir / (kvp.first)); SolverAbstract::Ptr solver_l = factory.create_solver(solver_to_use); @@ -87,8 +86,8 @@ void MergeMPS::launch() { neles_reserve += kvp.second.size() * (kvp.second.size() - 1); nrows_reserve += kvp.second.size() * (kvp.second.size() - 1) / 2; } - LOG(INFO) << "About to add " << nrows_reserve << " coupling constraints" - << std::endl; + _logger->display_message("About to add " + std::to_string(nrows_reserve) + + " coupling constraints"); values.reserve(neles_reserve); cindex.reserve(neles_reserve); mstart.reserve(nrows_reserve + 1); @@ -96,7 +95,7 @@ void MergeMPS::launch() { // adding coupling constraints for (auto const &kvp : x_mps_id) { std::string const var_name(kvp.first); - LOG(INFO) << var_name << std::endl; + _logger->display_message(var_name); bool is_first(true); int id1(-1); std::string first_mps; @@ -125,11 +124,11 @@ void MergeMPS::launch() { CharVector sense(nrows, 'E'); solver_addrows(*mergedSolver_l, sense, rhs, {}, mstart, cindex, values); - LOG(INFO) << "Problems merged." << std::endl; - LOG(INFO) << "Writting mps file" << std::endl; + _logger->display_message("Problems merged."); + _logger->display_message("Writing mps file"); mergedSolver_l->write_prob_mps(std::filesystem::path(_options.OUTPUTROOT) / ("log_merged" + MPS_SUFFIX)); - LOG(INFO) << "Writting lp file" << std::endl; + _logger->display_message("Writing lp file"); mergedSolver_l->write_prob_lp(std::filesystem::path(_options.OUTPUTROOT) / "log_merged.lp"); diff --git a/src/cpp/exe/merge/main.cpp b/src/cpp/exe/merge/main.cpp index 7861fbf0e..4a0572702 100644 --- a/src/cpp/exe/merge/main.cpp +++ b/src/cpp/exe/merge/main.cpp @@ -8,7 +8,7 @@ #include "SimulationOptions.h" #include "Worker.h" #include "WriterFactories.h" -#include "glog/logging.h" + #include "logger/User.h" #include "solver_utils.h" @@ -23,10 +23,7 @@ int main(int argc, char **argv) { Logger logger = std::make_shared(std::cout); - google::InitGoogleLogging(argv[0]); - auto path_to_log = std::filesystem::path(options.OUTPUTROOT) / "merge_mpsLog"; - google::SetLogDestination(google::GLOG_INFO, path_to_log.string().c_str()); - LOG(INFO) << "starting merge_mps" << std::endl; + logger->display_message("starting merge_mps"); Writer writer = build_json_writer(std::filesystem::path(options.JSON_FILE), false); @@ -36,7 +33,6 @@ int main(int argc, char **argv) { } catch (std::exception &ex) { std::string error = "Exception raised and program stopped : " + std::string(ex.what()); - LOG(WARNING) << error << std::endl; logger->display_message(error); exit(1); } diff --git a/src/cpp/helpers/CMakeLists.txt b/src/cpp/helpers/CMakeLists.txt index 77cd46589..325a463f8 100644 --- a/src/cpp/helpers/CMakeLists.txt +++ b/src/cpp/helpers/CMakeLists.txt @@ -36,7 +36,7 @@ add_library (helpers STATIC ${CMAKE_CURRENT_SOURCE_DIR}/AntaresArchiveUpdaterExeOptions.h ${CMAKE_CURRENT_SOURCE_DIR}/AntaresArchiveUpdaterExeOptions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/LoggerUtils.h - ) +) get_target_property(xpansion_interfaces_path xpansion_interfaces INTERFACE_INCLUDE_DIRECTORIES) @@ -46,11 +46,10 @@ target_include_directories (helpers ${xpansion_interfaces_path} ) -target_link_libraries (helpers +target_link_libraries (helpers PUBLIC ${JSONCPP_LIB} solvers - glog::glog gflags::gflags Boost::boost Boost::program_options MINIZIP::minizip-ng