From da3d2532f8d670d4fb57afef94d410ee49bbd8be Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 15 Feb 2024 20:21:33 -0700 Subject: [PATCH] Initial RPM --- .gitignore | 1 + papilo-shared.patch | 28 +++ papilo-test.patch | 78 +++++++ papilo-unbundle.patch | 464 +++++++++++++++++++++++++++++++++++++ papilo-vector-bounds.patch | 83 +++++++ papilo.spec | 135 +++++++++++ sources | 1 + 7 files changed, 790 insertions(+) create mode 100644 .gitignore create mode 100644 papilo-shared.patch create mode 100644 papilo-test.patch create mode 100644 papilo-unbundle.patch create mode 100644 papilo-vector-bounds.patch create mode 100644 papilo.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84f671e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/papilo-*.tar.gz diff --git a/papilo-shared.patch b/papilo-shared.patch new file mode 100644 index 0000000..cdc6d4d --- /dev/null +++ b/papilo-shared.patch @@ -0,0 +1,28 @@ +--- papilo-2.1.4/CMakeLists.txt.orig 2023-12-06 11:38:08.348390205 -0700 ++++ papilo-2.1.4/CMakeLists.txt 2023-12-06 11:38:51.994792168 -0700 +@@ -24,8 +24,6 @@ include(GNUInstallDirs) + + # path to e.g. findGMP module + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules/) +-set(CMAKE_CXX_VISIBILITY_PRESET hidden) +-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + option(GMP "should gmp be linked" ON) +@@ -197,7 +195,7 @@ if(NOT MSVC) + endif() + set(PAPILO_USE_STANDARD_HASHMAP 1) + +-add_library(papilo-core STATIC ++add_library(papilo-core SHARED + src/papilo/core/VariableDomains.cpp + src/papilo/core/SparseStorage.cpp + src/papilo/core/ConstraintMatrix.cpp +@@ -231,6 +229,7 @@ add_library(papilo-core STATIC + function(setLibProperties targetname outputname) + set_target_properties(${targetname} PROPERTIES + OUTPUT_NAME ${outputname} ++ POSITION_INDEPENDENT_CODE ON VERSION 0.0.0 SOVERSION 0 + MACOSX_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endfunction(setLibProperties) + if(MSVC) diff --git a/papilo-test.patch b/papilo-test.patch new file mode 100644 index 0000000..c749e4c --- /dev/null +++ b/papilo-test.patch @@ -0,0 +1,78 @@ +--- papilo-2.1.4/test/CMakeLists.txt.orig 2023-12-06 11:38:08.350390178 -0700 ++++ papilo-2.1.4/test/CMakeLists.txt 2023-12-06 11:39:41.114119155 -0700 +@@ -65,8 +65,6 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Androi + endif() + + set(unit_tests +- "accurate-numerical-statistics" +- + "matrix-buffer" + "vector-comparisons" + "matrix-comparisons" +@@ -95,7 +93,7 @@ set(unit_tests + "domcol-happy-path" + "domcol-parallel-columns" + "domcol-multiple-parallel-cols-generate_redundant-reductions" +- "domcol-multiple-column" ++ "domcol-multiple-columns" + + #DualFix + "dual-fix-happy-path" +@@ -131,13 +129,13 @@ set(unit_tests + "parallel-row-two-inequalities-tighten-upper-bound-first-row-dominant" + "parallel-row-two-inequalities-infeasible-first-row-dominant" + "parallel-row-two-inequalities-infeasible-second-row-dominant" +- "parallel-row-two-inequalities-tighten-upper-bound-first-row-neg" ++ "parallel-row-two-inequalities-tighten-upper-bound-first-row-negfactor-dominant" + "parallel-row-overwrite-inf-first-row-rhs-inf" + "parallel-row-overwrite-inf-first-row-lhs-inf" + "parallel-row-overwrite-inf-first-row-lhs-inf-neg-factor" + "parallel-row-mixed-infeasible-first-row-equation" + "parallel-row-best-bound-is-used-for-rhs-coeff-not-1" +- "parallel-row-best-bound-is-used-for-rhs-coeff" ++ "parallel-row-best-bound-is-used-for-rhs" + "parallel-row-mixed-second-row-equation" + "parallel-row-mixed-infeasible-second-row-equation" + "parallel-row-multiple-parallel-rows" +@@ -165,6 +163,7 @@ set(unit_tests + "happy-path-singleton-column-implied-bounds-negative-coeff-neg-bounds" + "happy-path-singleton-column-implied-bounds-positive-coeff-pos-bounds" + "happy-path-singleton-column-implied-bounds-positive-coeff-neg-bounds" ++ "happy-path-singleton-column-infinity-bounds-equation" + + #Singleton Stuffing + "singleton-stuffing-make-sure-to-first-set-bounds-to-infinity" +@@ -180,24 +179,27 @@ set(unit_tests + "simple-substitution-happy-path-for-2-continuous" + "simple-substitution-happy-path-for-continuous-and-integer" + "simple-substitution-happy-path-for-int-continuous-coeff" +- "simple-substitution-should_return_infeasible_if_gcd_of_coeff_is_in_rhs" +- "simple-substitution-should_return_feasible_if_gcd_of_coeff_is_in_rhs" +- "simple-substitution-failed-path-for-2-int" ++ "simple-substitution-simple-substitution-for-2-int" ++ "example_10_1_in_constraint_integer_programming" ++ "should_return_infeasible_if_gcd_of_coeff_is_in_rhs" ++ "should_return_feasible_if_gcd_of_coeff_is_in_rhs" + "simple-substitution-2-negative-integer" + "simple-substitution-feasible-gcd" + "simple-substitution-violated-gcd" + + #Simplify Inequality +- "happy-path-simplify-inequalities-only-greatest-divisor" ++ "happy-path-simplify-inequalities" + "simplify_inequ_doesnt_lock_more_rows" + "simplify_inequ_doesnt_apply_lb_and_ub_on_one_row" + + #Sparsify + "happy-path-sparsify" + "happy-path-sparsify-two-equalities" +- "failed-path-sparsify" ++ "failed-path-sparsify-if-misses-one-for-integer" ++ "happy-path-sparsify-if-misses-one-for-continuous" ++ "happy-path-sparsify-if-misses-one-for-continuous_2" ++ "failed-path-sparsify-if-misses-two-for-continuous" + +- "integration-test-for-flugpl" + ${PAPILOLIB_TESTS} + ${BOOST_REQUIRED_TESTS} + ) diff --git a/papilo-unbundle.patch b/papilo-unbundle.patch new file mode 100644 index 0000000..a1b140b --- /dev/null +++ b/papilo-unbundle.patch @@ -0,0 +1,464 @@ +--- papilo-2.1.4/CMakeLists.txt.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/CMakeLists.txt 2023-12-06 11:38:08.348390205 -0700 +@@ -172,27 +172,9 @@ else() + endif() + + if(LUSOL) +- include(CheckLanguage) +- check_language(Fortran) +- find_package(BLAS) +-endif() +-if(CMAKE_Fortran_COMPILER AND BLAS_FOUND) +- enable_language(Fortran) +- +- add_library(clusol STATIC +- src/papilo/external/lusol/src/lusol6b.f +- src/papilo/external/lusol/src/lusol7b.f +- src/papilo/external/lusol/src/lusol8b.f +- src/papilo/external/lusol/src/lusol_util.f +- src/papilo/external/lusol/src/lusol.f90 +- src/papilo/external/lusol/src/clusol.c +- src/papilo/external/lusol/src/lusol_precision.f90) +- set_property(TARGET clusol PROPERTY POSITION_INDEPENDENT_CODE ON) +- target_include_directories(clusol PRIVATE src/papilo/external/lusol) +- target_link_libraries(clusol ${BLAS_LIBRARIES}) + target_link_libraries(papilo INTERFACE clusol) + set(PAPILO_HAVE_LUSOL 1) +- set(CLUSOL_TARGET clusol) ++ set(CLUSOL_TARGET "") + else() + set(PAPILO_HAVE_LUSOL 0) + set(CLUSOL_TARGET "") +@@ -213,17 +195,7 @@ if(NOT MSVC) + endif() + endif() + endif() +-set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/src/papilo/external) +-check_cxx_source_compiles( +- "#include \"ska/bytell_hash_map.hpp\" +- int main() { ska::bytell_hash_map hashmap; (void)hashmap; return 0; }" +- PAPILO_BYTELL_HASHMAP_WORKS ) +- +-if( PAPILO_BYTELL_HASHMAP_WORKS ) +- set(PAPILO_USE_STANDARD_HASHMAP 0) +-else() +- set(PAPILO_USE_STANDARD_HASHMAP 1) +-endif() ++set(PAPILO_USE_STANDARD_HASHMAP 1) + + add_library(papilo-core STATIC + src/papilo/core/VariableDomains.cpp +@@ -411,20 +383,6 @@ install(FILES + ${PROJECT_SOURCE_DIR}/src/papilo/external/fmt/posix.cc + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/papilo/external/fmt) + +-install(FILES +- ${PROJECT_SOURCE_DIR}/src/papilo/external/pdqsort/pdqsort.h +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/papilo/external/pdqsort) +- +-install(FILES +- ${PROJECT_SOURCE_DIR}/src/papilo/external/ska/bytell_hash_map.hpp +- ${PROJECT_SOURCE_DIR}/src/papilo/external/ska/flat_hash_map.hpp +- ${PROJECT_SOURCE_DIR}/src/papilo/external/ska/unordered_map.hpp +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/papilo/external/ska) +- +-install(FILES +- ${PROJECT_SOURCE_DIR}/src/papilo/external/lusol/clusol.h +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/papilo/external/lusol) +- + # configure the config file for the build tree + set(QUADMATH_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) + set(TBB_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) +--- papilo-2.1.4/src/convMPS.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/convMPS.cpp 2023-12-06 11:38:08.348390205 -0700 +@@ -37,7 +37,7 @@ + #ifdef PAPILO_TBB + #include "papilo/misc/tbb.hpp" + #endif +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include "tbb/concurrent_unordered_set.h" + #include + +--- papilo-2.1.4/src/duplicates.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/duplicates.cpp 2023-12-06 11:38:08.348390205 -0700 +@@ -31,7 +31,7 @@ + #ifdef PAPILO_TBB + #include "papilo/misc/tbb.hpp" + #endif +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + #include + +--- papilo-2.1.4/src/papilo/core/Components.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/core/Components.hpp 2023-12-06 11:38:08.348390205 -0700 +@@ -27,7 +27,7 @@ + #include "papilo/core/Problem.hpp" + #include "papilo/misc/Hash.hpp" + #include "papilo/misc/Vec.hpp" +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + + namespace papilo +--- papilo-2.1.4/src/papilo/core/SparseStorage.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/core/SparseStorage.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -26,7 +26,7 @@ + + #include "papilo/misc/MultiPrecision.hpp" + #include "papilo/misc/Vec.hpp" +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + #include + #include +--- papilo-2.1.4/src/papilo/io/MpsParser.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/io/MpsParser.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -32,7 +32,7 @@ + #include "papilo/misc/Flags.hpp" + #include "papilo/misc/Hash.hpp" + #include "papilo/misc/Num.hpp" +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + #include + #include +--- papilo-2.1.4/src/papilo/misc/DependentRows.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/misc/DependentRows.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -29,7 +29,7 @@ + #ifdef PAPILO_HAVE_LUSOL + extern "C" + { +-#include "papilo/external/lusol/clusol.h" ++#include + } + #endif + +--- papilo-2.1.4/src/papilo/presolvers/FreeVarSubstitution.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/presolvers/FreeVarSubstitution.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -29,7 +29,7 @@ + #include "papilo/core/ProblemUpdate.hpp" + #include "papilo/misc/Num.hpp" + #include "papilo/misc/fmt.hpp" +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + + namespace papilo +--- papilo-2.1.4/src/papilo/presolvers/ParallelColDetection.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/presolvers/ParallelColDetection.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -31,7 +31,7 @@ + #ifdef PAPILO_TBB + #include "papilo/misc/tbb.hpp" + #endif +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + + namespace papilo + { +--- papilo-2.1.4/src/papilo/presolvers/ParallelRowDetection.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/presolvers/ParallelRowDetection.hpp 2023-12-06 11:38:08.349390191 -0700 +@@ -31,7 +31,7 @@ + #ifdef PAPILO_TBB + #include "papilo/misc/tbb.hpp" + #endif +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + + namespace papilo + { +--- papilo-2.1.4/src/papilo/presolvers/SimplifyInequalities.hpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/src/papilo/presolvers/SimplifyInequalities.hpp 2023-12-06 11:38:08.350390178 -0700 +@@ -27,7 +27,7 @@ + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemUpdate.hpp" +-#include "papilo/external/pdqsort/pdqsort.h" ++#include + #include + + namespace papilo +--- papilo-2.1.4/test/CMakeLists.txt.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/CMakeLists.txt 2023-12-06 11:38:08.350390178 -0700 +@@ -59,7 +59,7 @@ add_executable(unit_test TestMain.cpp + ${BOOST_REQUIRED_TEST_FILES} + ${PAPILOLIB_TEST_FILE}) + +-target_link_libraries(unit_test papilo ${PAPILOLIB_TARGET} ${Boost_LIBRARIES}) ++target_link_libraries(unit_test papilo ${PAPILOLIB_TARGET} ${Boost_LIBRARIES} Catch2 Catch2Main) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_link_libraries(unit_test log) + endif() +--- papilo-2.1.4/test/papilo/core/MatrixBufferTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/core/MatrixBufferTest.cpp 2023-12-06 11:38:08.350390178 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/core/MatrixBuffer.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/misc/fmt.hpp" + + using namespace papilo; +--- papilo-2.1.4/test/papilo/core/PostsolveTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/core/PostsolveTest.cpp 2023-12-06 11:38:08.350390178 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/core/postsolve/Postsolve.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/postsolve/PostsolveStatus.hpp" + #include + +--- papilo-2.1.4/test/papilo/core/PresolveTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/core/PresolveTest.cpp 2023-12-06 11:38:08.350390178 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/core/Presolve.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" + #include "papilo/core/Reductions.hpp" +--- papilo-2.1.4/test/papilo/core/ProblemUpdateTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/core/ProblemUpdateTest.cpp 2023-12-06 11:38:08.350390178 -0700 +@@ -21,7 +21,7 @@ + /* */ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" + #include "papilo/core/Reductions.hpp" +--- papilo-2.1.4/test/papilo/core/SparseStorageTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/core/SparseStorageTest.cpp 2023-12-06 11:38:08.351390164 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/core/SparseStorage.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/misc/compress_vector.hpp" + + papilo::SparseStorage +--- papilo-2.1.4/test/papilo/io/MpsParserTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/io/MpsParserTest.cpp 2023-12-06 11:38:08.351390164 -0700 +@@ -23,7 +23,7 @@ + + #include + #include "papilo/io/MpsParser.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + +--- papilo-2.1.4/test/PapiloLib.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/PapiloLib.cpp 2023-12-06 11:38:08.351390164 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilolib.h" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/misc/fmt.hpp" + + TEST_CASE( "papilolib", "[C-API]" ) +--- papilo-2.1.4/test/papilo/misc/VectorUtilsTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/misc/VectorUtilsTest.cpp 2023-12-06 11:38:08.351390164 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/misc/VectorUtils.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + + using namespace papilo; + +--- papilo-2.1.4/test/papilo/presolve/CoefficientStrengtheningTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/CoefficientStrengtheningTest.cpp 2023-12-06 11:38:08.351390164 -0700 +@@ -21,7 +21,7 @@ + /* */ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/ConstraintPropagationTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/ConstraintPropagationTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/ConstraintPropagation.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/DominatedColsTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/DominatedColsTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/DominatedCols.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/DualFixTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/DualFixTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/DualFix.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/FixContinuousTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/FixContinuousTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -21,7 +21,7 @@ + /* */ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/FreeVarSubstitutionTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/FreeVarSubstitutionTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/FreeVarSubstitution.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/ImplIntDetectionTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/ImplIntDetectionTest.cpp 2023-12-06 11:38:08.352390150 -0700 +@@ -21,7 +21,7 @@ + /* */ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/ParallelColDetectionTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/ParallelColDetectionTest.cpp 2023-12-06 11:38:08.353390136 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/ParallelColDetection.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/ParallelRowDetectionTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/ParallelRowDetectionTest.cpp 2023-12-06 11:38:08.353390136 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/ParallelRowDetection.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/ProbingTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/ProbingTest.cpp 2023-12-06 11:38:08.353390136 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/Probing.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SimpleProbingTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SimpleProbingTest.cpp 2023-12-06 11:38:08.353390136 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/SimpleProbing.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SimpleSubstitutionTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SimpleSubstitutionTest.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/SimpleSubstitution.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SimplifyInequalitiesTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SimplifyInequalitiesTest.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/SimplifyInequalities.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SingletonColsTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SingletonColsTest.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/SingletonCols.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SingletonStuffingTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SingletonStuffingTest.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/SingletonStuffing.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/papilo/presolve/SparsifyTest.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/papilo/presolve/SparsifyTest.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -22,7 +22,7 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + #include "papilo/presolvers/Sparsify.hpp" +-#include "papilo/external/catch/catch.hpp" ++#include + #include "papilo/core/PresolveMethod.hpp" + #include "papilo/core/Problem.hpp" + #include "papilo/core/ProblemBuilder.hpp" +--- papilo-2.1.4/test/TestMain.cpp.orig 2023-10-26 15:29:37.000000000 -0600 ++++ papilo-2.1.4/test/TestMain.cpp 2023-12-06 11:38:08.354390123 -0700 +@@ -23,4 +23,4 @@ + + #define CATCH_CONFIG_MAIN + +-#include "papilo/external/catch/catch.hpp" ++#include diff --git a/papilo-vector-bounds.patch b/papilo-vector-bounds.patch new file mode 100644 index 0000000..bc3650d --- /dev/null +++ b/papilo-vector-bounds.patch @@ -0,0 +1,83 @@ +--- papilo-2.1.4/src/papilo/core/SparseStorage.hpp.orig 2023-12-06 11:38:08.349390191 -0700 ++++ papilo-2.1.4/src/papilo/core/SparseStorage.hpp 2024-01-15 13:44:59.369457807 -0700 +@@ -311,9 +311,9 @@ class SparseStorage + if( i != rowranges[row].end ) + { + indbuffer.insert( indbuffer.end(), &columns[i], +- &columns[rowranges[row].end] ); ++ &columns.data()[rowranges[row].end] ); + valbuffer.insert( valbuffer.end(), &values[i], +- &values[rowranges[row].end] ); ++ &values.data()[rowranges[row].end] ); + } + else + { +@@ -858,15 +858,15 @@ SparseStorage::shiftRows( const in + // space + } while( rowranges[l].start == rowranges[l - 1].end ); + +- REAL* valsout = &values[rowranges[l].start - lastshiftleft]; +- int* colsout = &columns[rowranges[l].start - lastshiftleft]; ++ REAL* valsout = &values.data()[rowranges[l].start - lastshiftleft]; ++ int* colsout = &columns.data()[rowranges[l].start - lastshiftleft]; + + assert( rowranges[l - 1].end <= + rowranges[l].start - lastshiftleft ); + + while( l <= row ) + { +- int shift = &values[rowranges[l].start] - valsout; ++ int shift = &values.data()[rowranges[l].start] - valsout; + + #ifndef NDEBUG + Vec tmpvals; +@@ -878,10 +878,10 @@ SparseStorage::shiftRows( const in + #endif + if( rowranges[l].start != rowranges[l].end ) + { +- valsout = std::move( &values[rowranges[l].start], +- &values[rowranges[l].end], valsout ); +- colsout = std::move( &columns[rowranges[l].start], +- &columns[rowranges[l].end], colsout ); ++ valsout = std::move( &values.data()[rowranges[l].start], ++ &values.data()[rowranges[l].end], valsout ); ++ colsout = std::move( &columns.data()[rowranges[l].start], ++ &columns.data()[rowranges[l].end], colsout ); + } + + rowranges[l].start -= shift; +@@ -908,15 +908,15 @@ SparseStorage::shiftRows( const in + // space + } while( rowranges[r].end == rowranges[r + 1].start ); + +- REAL* valsout = &values[rowranges[r].end + lastshiftright]; +- int* colsout = &columns[rowranges[r].end + lastshiftright]; ++ REAL* valsout = &values.data()[rowranges[r].end + lastshiftright]; ++ int* colsout = &columns.data()[rowranges[r].end + lastshiftright]; + + assert( rowranges[r + 1].start >= + rowranges[r].end + lastshiftright ); + + while( r > row ) + { +- int shift = valsout - &values[rowranges[r].end]; ++ int shift = valsout - &values.data()[rowranges[r].end]; + + #ifndef NDEBUG + Vec tmpvals; +@@ -929,11 +929,11 @@ SparseStorage::shiftRows( const in + if( rowranges[r].start != rowranges[r].end ) + { + valsout = +- std::move_backward( &values[rowranges[r].start], +- &values[rowranges[r].end], valsout ); ++ std::move_backward( &values.data()[rowranges[r].start], ++ &values.data()[rowranges[r].end], valsout ); + colsout = +- std::move_backward( &columns[rowranges[r].start], +- &columns[rowranges[r].end], colsout ); ++ std::move_backward( &columns.data()[rowranges[r].start], ++ &columns.data()[rowranges[r].end], colsout ); + } + + rowranges[r].start += shift; diff --git a/papilo.spec b/papilo.spec new file mode 100644 index 0000000..0e2ff65 --- /dev/null +++ b/papilo.spec @@ -0,0 +1,135 @@ +# Architectures that have libquadmath +%ifarch x86_64 ppc64le +%global quadmath 1 +%else +%global quadmath 0 +%endif + +Name: papilo +Version: 2.1.4 +Release: %autorelease +Summary: Parallel presolve for integer and linear optimization + +# LGPL-3.0-or-later: the project as a whole +# BSL-1.0: src/papilo/misc/extended_euclidean.hpp +# Zlib: the header-only pdqsort project +# MIT: the bundled fmt project +License: LGPL-3.0-or-later AND BSL-1.0 AND Zlib AND MIT +URL: https://github.com/scipopt/papilo/ +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# Unbundle catch, LUSOL, pdqsort, and ska +Patch0: %{name}-unbundle.patch +# Build a shared library instead of a static library +Patch1: %{name}-shared.patch +# The list of tests in CMakeLists.txt doesn't match the actual tests +Patch2: %{name}-test.patch +# Avoid out-of-bounds vector access +# https://github.com/scipopt/papilo/pull/42 +Patch3: %{name}-vector-bounds.patch + +# See https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval +ExcludeArch: %{ix86} + +BuildRequires: boost-devel +BuildRequires: cmake +BuildRequires: cmake(catch2) +BuildRequires: cmake(tbb) +BuildRequires: gcc-c++ +BuildRequires: help2man +%if %{quadmath} +BuildRequires: libquadmath-devel +%endif +BuildRequires: lusol-devel +BuildRequires: pdqsort-static +BuildRequires: pkgconfig(gmp) + +Requires: libpapilo%{?_isa} = %{version}-%{release} + +# The bundled version of fmt is incompatible with version 10 in Rawhide. +Provides: bundled(fmt) = 6.1.2 + +%global _desc %{expand: +PaPILO provides parallel presolve routines for (mixed integer) linear +programming problems. The routines are implemented using templates +which allows switching to higher precision or rational arithmetic using +the boost multiprecision package.} + +%description %_desc + +%package -n libpapilo +Summary: Library interface to PaPILO + +%description -n libpapilo %_desc + +This package provides a library interface to the PaPILO functionality. + +%package -n libpapilo-devel +Summary: Headers and library links for libpapilo +Requires: libpapilo%{?_isa} = %{version}-%{release} +Requires: boost-devel%{?_isa} +Requires: lusol-devel%{?_isa} +Requires: pdqsort-static +Requires: tbb-devel%{?_isa} + +%description -n libpapilo-devel %_desc + +This package contains headers and library links to develop applications +that use libpapilo. + +%prep +%autosetup -p1 + +# Ensure none of the bundled code but fmt can be used +rm -fr src/papilo/external/{catch,lusol,pdqsort,ska} + +# Fix installation directories +if [ '%{_lib}' != 'lib' ]; then + sed -i 's,\(DESTINATION \)lib,\1%{_lib},g' CMakeLists.txt +fi + +%build +%cmake -DQUADMATH:BOOL=%{?quadmath:ON}%{!?quadmath:OFF} +%cmake_build + +%install +%cmake_install + +# Generate man pages +mkdir -p %{buildroot}%{_mandir}/man1 +export LD_LIBRARY_PATH=$PWD/%{_vpath_builddir} +cd %{_vpath_builddir}/bin +help2man -N -h '' --version-string %{version} \ + -n 'check for duplicate optimization problem instances' ./duplicates > \ + %{buildroot}%{_mandir}/man1/duplicates.1 +help2man -N -h '' --version-string %{version} \ + -n 'parallel presolve for integer and linear optimization' ./papilo > \ + %{buildroot}%{_mandir}/man1/papilo.1 +cd - + +# Fix up the man pages a little +sed -e 's,\./check_\(duplicates\),\1,' \ + -e '/^\\&/i.TP' \ + -i %{buildroot}%{_mandir}/man1/duplicates.1 +sed -i 's,\./\(papilo\),\1,' %{buildroot}%{_mandir}/man1/papilo.1 + +%check +%ctest + +%files +%doc CHANGELOG README.md parameters.txt +%{_bindir}/duplicates +%{_bindir}/papilo +%{_mandir}/man1/duplicates.1* +%{_mandir}/man1/papilo.1* + +%files -n libpapilo +%license COPYING COPYING.LESSER +%{_libdir}/libpapilo-core.so.0* + +%files -n libpapilo-devel +%{_includedir}/papilo/ +%{_libdir}/cmake/papilo/ +%{_libdir}/libpapilo-core.so + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..4a59eb5 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (papilo-2.1.4.tar.gz) = 2db397b498e2ce682c1667640da6c3f64fd17dd03d8375a9cd1f57877142f87e96028148b619df3db87f649b5cd6c6abbdc1a1820dfa49850be5c14b43cfa330