From 5a96404cc2a7abffad113b88f6f774367f674471 Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Fri, 3 Jul 2020 10:34:45 +0200 Subject: [PATCH] compile SCIP with BLISS on bazel --- WORKSPACE | 2 +- bazel/bliss-0.73.patch | 92 +++++++++++++++++++----------------------- bazel/bliss.BUILD | 2 +- bazel/scip.BUILD | 7 ++-- bazel/scip.patch | 17 +++++++- 5 files changed, 62 insertions(+), 58 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 8d38e99af5..ba098c7fa7 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -72,7 +72,7 @@ http_archive( http_archive( name = "bliss", build_file = "//bazel:bliss.BUILD", - #patches = ["//bazel:bliss-0.73.patch"], + patches = ["//bazel:bliss-0.73.patch"], sha256 = "f57bf32804140cad58b1240b804e0dbd68f7e6bf67eba8e0c0fa3a62fd7f0f84", url = "http://www.tcs.hut.fi/Software/bliss/bliss-0.73.zip", ) diff --git a/bazel/bliss-0.73.patch b/bazel/bliss-0.73.patch index fba499c07c..bd5c29659c 100644 --- a/bazel/bliss-0.73.patch +++ b/bazel/bliss-0.73.patch @@ -1,22 +1,20 @@ -Released under the GNU Lesser General Public License version 3. - -diff -Nur bliss-0.73/graph.cc bliss-0.73p/graph.cc ---- bliss-0.73/graph.cc 2015-09-01 10:23:10.000000000 +0200 -+++ bliss-0.73p/graph.cc 2019-02-26 15:09:32.933708266 +0100 +diff -u bliss-0.73.orig/graph.cc bliss-0.73/graph.cc +--- bliss-0.73.orig/graph.cc 2015-09-01 09:23:10.000000000 +0200 ++++ bliss-0.73/graph.cc 2020-07-03 10:11:29.480649776 +0200 @@ -67,6 +67,9 @@ - + report_hook = 0; report_user_param = 0; + + limit_search_nodes = 0; + limit_generators = 0; } - - + + @@ -609,13 +612,7 @@ - - - + + + - -typedef struct { - unsigned int splitting_element; @@ -25,17 +23,17 @@ diff -Nur bliss-0.73/graph.cc bliss-0.73p/graph.cc - UintSeqHash eqref_hash; -} PathInfo; +// struct PathInfo moved to graph.hh by Thomas Rehn, 2011-07-12 - - + + void @@ -745,7 +742,7 @@ initialize_certificate(); - + std::vector search_stack; - std::vector first_path_info; + // first_path_info moved to graph.hh by Thomas Rehn, 2011-07-12 std::vector best_path_info; - + search_stack.clear(); @@ -1054,6 +1051,8 @@ const unsigned int child_level = current_level+1; @@ -45,7 +43,7 @@ diff -Nur bliss-0.73/graph.cc bliss-0.73p/graph.cc + break; if(search_stack.size() > stats.max_level) stats.max_level = search_stack.size(); - + @@ -1642,6 +1641,8 @@ best_path_automorphism); /* Update statistics */ @@ -53,16 +51,16 @@ diff -Nur bliss-0.73/graph.cc bliss-0.73p/graph.cc + if (limit_generators && stats.nof_generators >= limit_generators) + break; } - + /* @@ -1733,6 +1734,8 @@ - + /* Update statistics */ stats.nof_generators++; + if (limit_generators && stats.nof_generators >= limit_generators) + break; continue; - + } /* while(!search_stack.empty()) */ @@ -5452,7 +5455,7 @@ component.clear(); @@ -72,14 +70,15 @@ diff -Nur bliss-0.73/graph.cc bliss-0.73p/graph.cc + unsigned int sh_first = 1 << 31; unsigned int sh_size = 0; unsigned int sh_nuconn = 0; - -diff -Nur bliss-0.73/graph.hh bliss-0.73p/graph.hh ---- bliss-0.73/graph.hh 2015-09-01 10:23:10.000000000 +0200 -+++ bliss-0.73p/graph.hh 2019-02-26 15:09:32.941708641 +0100 + +Seulement dans bliss-0.73: graph.cc.orig +diff -u bliss-0.73.orig/graph.hh bliss-0.73/graph.hh +--- bliss-0.73.orig/graph.hh 2015-09-01 09:23:10.000000000 +0200 ++++ bliss-0.73/graph.hh 2020-07-03 10:11:29.484649847 +0200 @@ -20,6 +20,9 @@ along with bliss. If not, see . */ - + +/** This is a patched version of bliss by Thomas Rehn extended by method AbstractGraph::set_search_limits() */ +#define BLISS_PATCH_PRESENT + @@ -87,9 +86,9 @@ diff -Nur bliss-0.73/graph.hh bliss-0.73p/graph.hh * \namespace bliss * The namespace bliss contains all the classes and functions of the bliss @@ -111,6 +114,14 @@ - - - + + + +/** moved here from graph.cc by Thomas Rehn, 2011-07-12 */ +typedef struct { + unsigned int splitting_element; @@ -98,18 +97,17 @@ diff -Nur bliss-0.73/graph.hh bliss-0.73p/graph.hh + UintSeqHash eqref_hash; +} PathInfo; + - - - + + + @@ -284,7 +295,20 @@ opt_use_long_prune = active; } - -- + + /// information vector about first path + /** added by Thomas Rehn, 2011-07-12 */ + std::vector get_first_path_info() { return first_path_info; } -+ + + /// limits number of search nodes and generators during the backtrack search + /** added by Thomas Rehn, 2012-01-12 + * @@ -120,38 +118,30 @@ diff -Nur bliss-0.73/graph.hh bliss-0.73p/graph.hh + limit_search_nodes = searchNodeLimit; + limit_generators = generatorLimit; + } - + protected: /** \internal @@ -519,6 +543,11 @@ - - - + + + + /** added by Thomas Rehn, 2011-07-12 */ + std::vector first_path_info; + + unsigned int limit_search_nodes; + unsigned int limit_generators; }; - - -@@ -747,7 +776,6 @@ - */ - void set_splitting_heuristic(const SplittingHeuristic shs) {sh = shs; } - -- - }; - - -diff -Nur bliss-0.73/Makefile bliss-0.73p/Makefile ---- bliss-0.73/Makefile 2015-09-01 10:23:10.000000000 +0200 -+++ bliss-0.73p/Makefile 2019-02-26 15:09:59.242941722 +0100 + + +diff -u bliss-0.73.orig/Makefile bliss-0.73/Makefile +--- bliss-0.73.orig/Makefile 2015-09-01 09:23:10.000000000 +0200 ++++ bliss-0.73/Makefile 2020-07-03 10:11:29.484649847 +0200 @@ -5,7 +5,7 @@ CFLAGS += --pedantic CFLAGS += -O9 #CFLAGS += -DBLISS_DEBUG -CFLAGS += -fPIC +CFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden - + SRCS = defs.cc graph.cc partition.cc orbit.cc uintseqhash.cc heap.cc SRCS += timer.cc utils.cc bliss_C.cc diff --git a/bazel/bliss.BUILD b/bazel/bliss.BUILD index 200d3ee338..110e207d81 100644 --- a/bazel/bliss.BUILD +++ b/bazel/bliss.BUILD @@ -25,6 +25,6 @@ cc_library( "bliss-0.73/uintseqhash.hh", "bliss-0.73/utils.hh", ], - defines = ["bliss-0.73"], + includes = ["."], visibility = ["//visibility:public"], ) \ No newline at end of file diff --git a/bazel/scip.BUILD b/bazel/scip.BUILD index 62275abc47..985c8d4a03 100644 --- a/bazel/scip.BUILD +++ b/bazel/scip.BUILD @@ -20,7 +20,7 @@ cc_library( ], ) + [ - "scip-7.0.1/src/symmetry/compute_symmetry_none.cpp", + "scip-7.0.1/src/symmetry/compute_symmetry_bliss.cpp", "scip-7.0.1/src/nlpi/exprinterpret_none.c", "scip-7.0.1/src/tpi/tpi_tnycthrd.c", ], @@ -35,7 +35,7 @@ cc_library( "-Wunknown-pragmas", "-fexceptions", "$(STACK_FRAME_UNLIMITED)", # src/scip/reader_cnf.c - #"-DSCIP_WITH_ZLIB", + "-DSCIP_WITH_ZLIB", "-DWITH_SCIPDEF", "-DSCIP_ROUNDING_FE", "-DTPI_TNYC", # src/tpi/tpi_type_tny.h @@ -63,9 +63,8 @@ cc_library( ], deps = [ #"//third_party/zlib", - #"//third_party/bliss:libbliss", #"//third_party/cppad:cppad_includes", - #"@bliss//:libbliss" + "@bliss//:libbliss" ], features = ["-parse_headers"], visibility = ["//visibility:public"], diff --git a/bazel/scip.patch b/bazel/scip.patch index aa60a465c6..9cd97de606 100644 --- a/bazel/scip.patch +++ b/bazel/scip.patch @@ -1,5 +1,20 @@ --- scip-7.0.1/src/scip/buildflags.c.new 1970-01-01 01:00:00.000000000 +0100 +++ scip-7.0.1/src/scip/buildflags.c 2020-06-30 18:23:41.479773668 +0200 @@ -0,0 +1,2 @@ -+#define SCIP_BUILDFLAGS " ARCH=x86_64\n COMP=gnu\n DEBUGSOL=false\n EXPRINT=cppad\n GAMS=false\n SYM=none\n GMP=false\n IPOPT=false\n IPOPTOPT=opt\n WORHP=false\n WORHPOPT=opt\n LPS=spx2\n LPSCHECK=false\n LPSOPT=opt\n NOBLKBUFMEM=false\n NOBLKMEM=false\n NOBUFMEM=false\n OPT=opt\n OSTYPE=linux\n PARASCIP=true\n READLINE=false\n SANITIZE=\n SHARED=false\n USRARFLAGS=\n USRCFLAGS=-fPIC\n USRCXXFLAGS=-fPIC\n USRDFLAGS=\n USRFLAGS=\n USRLDFLAGS=\n USROFLAGS=\n VERSION=6.0.0\n ZIMPL=false\n ZIMPLOPT=opt\n ZLIB=true" ++#define SCIP_BUILDFLAGS " ARCH=x86_64\n COMP=gnu\n DEBUGSOL=false\n EXPRINT=none\n GAMS=false\n SYM=bliss\n GMP=false\n IPOPT=false\n IPOPTOPT=opt\n WORHP=false\n WORHPOPT=opt\n LPS=spx2\n LPSCHECK=false\n LPSOPT=opt\n NOBLKBUFMEM=false\n NOBLKMEM=false\n NOBUFMEM=false\n OPT=opt\n OSTYPE=linux\n PARASCIP=true\n READLINE=false\n SANITIZE=\n SHARED=false\n USRARFLAGS=\n USRCFLAGS=-fPIC\n USRCXXFLAGS=-fPIC\n USRDFLAGS=\n USRFLAGS=\n USRLDFLAGS=\n USROFLAGS=\n VERSION=7.0.1\n ZIMPL=false\n ZIMPLOPT=opt\n ZLIB=true" + + +--- scip-7.0.1-orig/src/symmetry/compute_symmetry_bliss.cpp 2020-06-23 10:40:57.000000000 +0200 ++++ scip-7.0.1/src/symmetry/compute_symmetry_bliss.cpp 2020-07-03 10:15:20.016687707 +0200 +@@ -24,8 +24,8 @@ + #include "compute_symmetry.h" + + /* include bliss graph */ +-#include +-#include ++#include ++#include + + #include + #include +