Skip to content

Commit

Permalink
Merge pull request bertiniteam#32 from ofloveandhate/develop
Browse files Browse the repository at this point in the history
bug fixes and compile improvements
  • Loading branch information
BertiniTeam committed Jun 2, 2016
2 parents a6cc3f2 + 61934a8 commit a08ab6f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 38 deletions.
16 changes: 6 additions & 10 deletions core/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,16 @@ AC_ARG_ENABLE([thread_local],

AS_IF([test "x$enable_thread_local" != "xno"],[
AC_DEFINE([USE_THREAD_LOCAL], [1],[Define if thread_local keyword should be used. ])
]

)
])


AC_ARG_ENABLE([expression_templates],
AS_HELP_STRING([--disable-expression_templates], [Disable the use of expression templates for Boost.Multiprecision. Versions of Boost.Multiprecision prior to 1.61 are missing min/max for expressions of real numbers, and some operations in Eigen prior to 3.3 (3.2.92) fail to compile. If you are using Boost prior to 1.61, either patch according to https://github.com/boostorg/multiprecision/commit/f57bd6b31a64787425ec891bd2ceb536c9036f72 or turn expression templates off using this argument.]))

#this calls a file in the m4/ directory, which sets up the MPI wrapper stuffs
LX_FIND_MPI
AS_IF([test "x$enable_expression_templates" != "xno"],[
AC_DEFINE([BMP_EXPRESSION_TEMPLATES], [1],[Use expression templates from Boost.Multiprecision.])
])

# print a notice about the presence of MPI on the machine.
AS_IF([test "$have_CXX_mpi" = "yes"],
AC_MSG_NOTICE([mpi c++ appears to work correctly]),
AC_MSG_NOTICE([it appears you do not have mpi installed])
)



Expand Down
2 changes: 1 addition & 1 deletion core/include/bertini2/function_tree/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define BERTINI_NODE_BASE_HPP



#include "bertini2/config.h"

#include <iostream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion core/include/bertini2/mpfr_complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace bertini {
mpfr_float real_, imag_;

#ifdef USE_THREAD_LOCAL
static thread_local mpfr_float temp_[8];
static thread_local mpfr_float temp_[8]; //OSX clang does NOT implement this. Use ./configure --disable-thread_local. Also, send Apple a letter telling them to implement this keyword.
#else
static mpfr_float temp_[8];
#endif
Expand Down
28 changes: 19 additions & 9 deletions core/include/bertini2/mpfr_extensions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Particularly includes Boost.Serialize code for the mpfr_float, gmp_rational, and
#ifndef BERTINI_MPFR_EXTENSIONS_HPP
#define BERTINI_MPFR_EXTENSIONS_HPP

#include "bertini2/config.h"

#include <boost/multiprecision/mpfr.hpp>
#include <boost/multiprecision/random.hpp>
Expand All @@ -49,14 +50,15 @@ Particularly includes Boost.Serialize code for the mpfr_float, gmp_rational, and

namespace bertini{

using mpfr_float = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_on>;

#ifdef BMP_EXPRESSION_TEMPLATES
using mpfr_float = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_on>;
using mpz_int = boost::multiprecision::number<boost::multiprecision::backends::gmp_int, boost::multiprecision::et_on>;

using mpq_rational = boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_on>;

// using mpz_int = boost::multiprecision::mpz_int;
// using mpq_rational = boost::multiprecision::mpq_rational;
#else
using mpfr_float = boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<0>, boost::multiprecision::et_off>;
using mpz_int = boost::multiprecision::number<boost::multiprecision::backends::gmp_int, boost::multiprecision::et_off>;
using mpq_rational = boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, boost::multiprecision::et_off>;
#endif
}

// the following code block extends serialization to the mpfr_float class from boost::multiprecision
Expand Down Expand Up @@ -144,9 +146,17 @@ BOOST_SERIALIZATION_SPLIT_FREE(::boost::multiprecision::backends::gmp_int)
// if you wish to use et_on with Boost.Multiprecision with Eigen 3.2.x or earlier, you must apply a patch to Boost.MP related to bug 11149, and use the following non-standard lines.
// https://svn.boost.org/trac/boost/ticket/11149

// namespace std{ using boost::multiprecision::min; using
// boost::multiprecision::max;
// }
#define EIGEN_DEVICE_FUNC // to make Eigen 3.3 happy... ugh, this is likely to break CUDA usage with Bertini2, if that ever happens.
#include <Eigen/src/Core/util/Macros.h>

#ifdef BMP_EXPRESSION_TEMPLATES
#if (!EIGEN_VERSION_AT_LEAST(3,2,92)) // version of 3.3-beta1 is 3,2,92.
namespace std{
using boost::multiprecision::min; //error receiver: please see https://svn.boost.org/trac/boost/ticket/11149 for information about these using statements in std namespace.
using boost::multiprecision::max; //3 options: ./configure --disable-expression_templates, use Boost 1.61, or patch earlier Boost versions to resolve this.
}
#endif
#endif

namespace bertini
{
Expand Down
10 changes: 5 additions & 5 deletions core/include/bertini2/tracking/powerseries_endgame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class PowerSeriesEndgame : public EndgameBase<TrackerType>
s_derivatives[ii] = derivatives[ii+offset] * (candidate * pow(times[ii+offset], static_cast<RT>(candidate-1)/candidate));
}

auto curr_diff = (HermiteInterpolateAndSolve(
RT curr_diff = (HermiteInterpolateAndSolve(
pow(most_recent_time,static_cast<RT>(1)/candidate), // the target time
num_used_points,s_times,samples,s_derivatives) // the input data
-
Expand Down Expand Up @@ -497,11 +497,11 @@ class PowerSeriesEndgame : public EndgameBase<TrackerType>
SuccessCode AdvanceTime()
{
auto& samples = std::get<SampCont<CT> >(samples_);
auto& times = std::get<TimeCont<CT> >(times_);
auto& derivatives = std::get<SampCont<CT> >(derivatives_);
auto& times = std::get<TimeCont<CT> >(times_);
auto& derivatives = std::get<SampCont<CT> >(derivatives_);

Vec<CT> next_sample;
auto next_time = times.back() * this->EndgameSettings().sample_factor; //setting up next time value.
Vec<CT> next_sample;
CT next_time = times.back() * this->EndgameSettings().sample_factor; //setting up next time value.

if (abs(next_time) < this->EndgameSettings().min_track_time)
{
Expand Down
12 changes: 5 additions & 7 deletions python/configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@





#we're building pybertini, version 1.0.alpha2, and the corresponding email is dan brake's
#we're building pybertini, version 1.0.alpha2, and the corresponding email is daniel brake's
AC_INIT([pybertini], [1.0.alpha2], [[email protected]],[pybertini], [http://github.com/bertiniteam/b2])


Expand All @@ -14,6 +9,9 @@ AC_PREREQ([2.68])
#
AC_CONFIG_AUX_DIR([config])

#ensure that minieigen got cloned... i wish git recursed by default, but it doesn't.
AC_CHECK_FILE([./minieigen/src/common.hpp],[],[AC_MSG_ERROR([it appears you didn't recurse when cloning b2, so you don't have minieigen in this directory. to get it, simply run `git submodule update --init'.])])

# turn on the keeping of produced objects in their folders. this is for non-recursive make
# and autotools
# see Recursive Make Considered Harmful, and any number of demos.
Expand Down Expand Up @@ -78,7 +76,7 @@ AC_SEARCH_LIBS([mpfr_get_version],[mpfr], [],[
AX_EIGEN


AX_BOOST_BASE([1.55],, [AC_MSG_ERROR([bertini2 needs Boost at least 1.55, but it was not found in your system])])
AX_BOOST_BASE([1.56],, [AC_MSG_ERROR([bertini2 needs Boost at least 1.56, but it was not found in your system])])
AX_BOOST_SYSTEM
AX_BOOST_FILESYSTEM
AX_BOOST_CHRONO
Expand Down
1 change: 0 additions & 1 deletion python/include/node_export.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ namespace bertini{

using namespace bertini::node;

using Node = Node;
using Nodeptr = std::shared_ptr<Node>;

void ExportNode();
Expand Down
6 changes: 2 additions & 4 deletions python/src/node_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
// West Texas A&M University
// Spring 2016
//
// Daniel Brake
// University of Notre Dame
//
// python/node_export.cpp: Source file for exposing Node class to python.

Expand All @@ -33,8 +35,6 @@

#include "node_export.hpp"

//#include <bertini2/function_tree/node.hpp>


namespace bertini{
namespace python{
Expand Down Expand Up @@ -168,8 +168,6 @@ namespace bertini{
class_<NodeWrap, boost::noncopyable, Nodeptr >("AbstractNode", no_init)
.def(NodeVisitor<Node>())
;

register_ptr_to_python<std::shared_ptr<Node> >();
};


Expand Down

0 comments on commit a08ab6f

Please sign in to comment.