Disable fixed-sized specializations for schur solver
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jun 2012 13:33:37 +0000 (13:33 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jun 2012 13:33:37 +0000 (13:33 +0000)
As far as i remember Keir, this should be safe for our usages of ceres
and it should save noticeable amount of time and used memory when
compiling blender with libmv support.

Quick tests with tracking went smooth after this.

extern/libmv/third_party/ceres/CMakeLists.txt
extern/libmv/third_party/ceres/SConscript
extern/libmv/third_party/ceres/bundle.sh

index 5207bddec12558f3e0d4e368661365556db86186..e6a9e430c47420035d5419fc5d2bd6509840fd2a 100644 (file)
@@ -58,21 +58,6 @@ set(SRC
        internal/ceres/detect_structure.cc
        internal/ceres/evaluator.cc
        internal/ceres/file.cc
-       internal/ceres/generated/schur_eliminator_2_2_2.cc
-       internal/ceres/generated/schur_eliminator_2_2_3.cc
-       internal/ceres/generated/schur_eliminator_2_2_4.cc
-       internal/ceres/generated/schur_eliminator_2_2_d.cc
-       internal/ceres/generated/schur_eliminator_2_3_3.cc
-       internal/ceres/generated/schur_eliminator_2_3_4.cc
-       internal/ceres/generated/schur_eliminator_2_3_9.cc
-       internal/ceres/generated/schur_eliminator_2_3_d.cc
-       internal/ceres/generated/schur_eliminator_2_4_3.cc
-       internal/ceres/generated/schur_eliminator_2_4_4.cc
-       internal/ceres/generated/schur_eliminator_2_4_d.cc
-       internal/ceres/generated/schur_eliminator_4_4_2.cc
-       internal/ceres/generated/schur_eliminator_4_4_3.cc
-       internal/ceres/generated/schur_eliminator_4_4_4.cc
-       internal/ceres/generated/schur_eliminator_4_4_d.cc
        internal/ceres/generated/schur_eliminator_d_d_d.cc
        internal/ceres/gradient_checking_cost_function.cc
        internal/ceres/implicit_schur_complement.cc
@@ -191,6 +176,26 @@ set(SRC
        internal/ceres/visibility.h
 )
 
+#if(FALSE)
+#      list(APPEND SRC
+#              internal/ceres/generated/schur_eliminator_2_2_2.cc
+#              internal/ceres/generated/schur_eliminator_2_2_3.cc
+#              internal/ceres/generated/schur_eliminator_2_2_4.cc
+#              internal/ceres/generated/schur_eliminator_2_2_d.cc
+#              internal/ceres/generated/schur_eliminator_2_3_3.cc
+#              internal/ceres/generated/schur_eliminator_2_3_4.cc
+#              internal/ceres/generated/schur_eliminator_2_3_9.cc
+#              internal/ceres/generated/schur_eliminator_2_3_d.cc
+#              internal/ceres/generated/schur_eliminator_2_4_3.cc
+#              internal/ceres/generated/schur_eliminator_2_4_4.cc
+#              internal/ceres/generated/schur_eliminator_2_4_d.cc
+#              internal/ceres/generated/schur_eliminator_4_4_2.cc
+#              internal/ceres/generated/schur_eliminator_4_4_3.cc
+#              internal/ceres/generated/schur_eliminator_4_4_4.cc
+#              internal/ceres/generated/schur_eliminator_4_4_d.cc
+#      )
+#endif()
+
 if(WIN32)
        list(APPEND INC
                ../glog/src/windows
@@ -213,6 +218,7 @@ add_definitions(
        -D"CERES_HASH_NAMESPACE_END=}}"
        -DCERES_NO_SUITESPARSE
        -DCERES_DONT_HAVE_PROTOCOL_BUFFERS
+       -DCERES_RESTRICT_SCHUR_SPECIALIZATION
 )
 
 blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}")
index d8b2b8520d75665757240f867443f655352566ec..6b5f1b8d64d8ae4a47ee7aefdb0019188c492e35 100644 (file)
@@ -13,13 +13,15 @@ src = []
 defs = []
 
 src += env.Glob('internal/ceres/*.cc')
-src += env.Glob('internal/ceres/generated/*.cc')
+src += env.Glob('internal/ceres/generated/schur_eliminator_d_d_d.cc')
+#src += env.Glob('internal/ceres/generated/*.cc')
 
 defs.append('CERES_HAVE_PTHREAD')
 defs.append('CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {')
 defs.append('CERES_HASH_NAMESPACE_END=}}')
 defs.append('CERES_NO_SUITESPARSE')
 defs.append('CERES_DONT_HAVE_PROTOCOL_BUFFERS')
+defs.append('CERES_RESTRICT_SCHUR_SPECIALIZATION')
 
 incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'
 
index f54342180dbd0887ccd34f52cf22d1c912342238..99aaadd8d874bb617e731c33327c3cfdbd4c1dd2 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+if false; then
 if [ "x$1" = "x--i-really-know-what-im-doing" ] ; then
   echo Proceeding as requested by command line ...
 else
@@ -36,7 +37,10 @@ done
 
 rm -rf $tmp
 
-sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
+fi
+
+sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | grep -v -E 'schur_eliminator_[0-9]_[0-9]_[0-9d].cc' | sort -d`
+generated_sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//#\t\t/' | grep -E 'schur_eliminator_[0-9]_[0-9]_[0-9d].cc' | sort -d`
 headers=`find ./include ./internal -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
 
 src_dir=`find ./internal -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
@@ -48,6 +52,10 @@ for x in $src_dir $src_third_dir; do
     continue;
   fi
 
+  if test  `echo "$x" | grep -c generated` -eq 1; then
+    continue;
+  fi
+
   if stat $x/*.cpp > /dev/null 2>&1; then
     t="src += env.Glob('`echo $x'/*.cpp'`')"
   fi
@@ -121,6 +129,12 @@ ${sources}
 ${headers}
 )
 
+#if(FALSE)
+#      list(APPEND SRC
+${generated_sources}
+#      )
+#endif()
+
 if(WIN32)
        list(APPEND INC
                ../glog/src/windows
@@ -143,6 +157,7 @@ add_definitions(
        -D"CERES_HASH_NAMESPACE_END=}}"
        -DCERES_NO_SUITESPARSE
        -DCERES_DONT_HAVE_PROTOCOL_BUFFERS
+       -DCERES_RESTRICT_SCHUR_SPECIALIZATION
 )
 
 blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
@@ -164,12 +179,15 @@ src = []
 defs = []
 
 $src
+src += env.Glob('internal/ceres/generated/schur_eliminator_d_d_d.cc')
+#src += env.Glob('internal/ceres/generated/*.cc')
 
 defs.append('CERES_HAVE_PTHREAD')
 defs.append('CERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {')
 defs.append('CERES_HASH_NAMESPACE_END=}}')
 defs.append('CERES_NO_SUITESPARSE')
 defs.append('CERES_DONT_HAVE_PROTOCOL_BUFFERS')
+defs.append('CERES_RESTRICT_SCHUR_SPECIALIZATION')
 
 incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'