> On Thu, Jul 16, 2009 at 08:26:21AM +0200, Benjamin Kehlet wrote: >> >> On Thu, Jul 09, 2009 at 08:20:54AM +0100, Garth N. Wells wrote: >> >>> >> >>> >> >>> Anders Logg wrote: >> >>> > On Thu, Jul 09, 2009 at 08:05:42AM +0100, Garth N. Wells wrote: >> >>> >> >> >>> >> Anders Logg wrote: >> >>> >>> On Thu, Jul 09, 2009 at 12:14:14AM +0200, DOLFIN wrote: >> >>> >>>> One or more new changesets pushed to the primary dolfin >> >>> repository. >> >>> >>>> A short summary of the last three changesets is included below. >> >>> >>>> >> >>> >>>> changeset: 6458:8dacb335c9825380a2e614f5de2ae89f79131995 >> >>> >>>> tag: tip >> >>> >>>> user: "Garth N. Wells <gn...@cam.ac.uk>" >> >>> >>>> date: Wed Jul 08 23:13:53 2009 +0100 >> >>> >>>> files: demo/ode/reaction/cpp/main.cpp >> >>> >>>> description: >> >>> >>>> Comment out reaction ODE demo. Gives error when run. >> >>> >>> What happens when you run it? Same as for the buildbot? >> >>> >>> >> >>> >>> terminate called after throwing an instance of >> >>> 'std::runtime_error' >> >>> >>> what(): *** Assertion (e1 != -1) [at >> >>> >>> dolfin/ode/MultiAdaptiveTimeSlab.cpp:926 in cg_feval()] >> >>> >>> >> >>> >>> This does not happen for me. It works fine and it's not because >> I >> >>> >>> don't trigger assertions, I checked. >> >>> >>> >> >>> >>> Any special configuration you are using? I'm running without >> GMP. >> >>> >>> >> >>> >> It fails with GMP and works with GMP. >> >>> > >> >>> >> >>> I was a bit hasty - fails with GMP and works without GMP. >> >>> >> >>> Garth >> >> >> >> ok, most likely some floating-point comparison that fails. >> >> >> >> I'll ask Benjamin Kehlet to look at it or fix it myself later >> >> otherwise. >> > >> The problem is that in the reaction demo a number of real variables are >> declared in main before the ode object is created.The precision of these >> variables are incorrect since GMP hasn't been initialized at that time. >> We need to initialize precision in GMP by calling mpf_set_default_prec() >> before the first real is declared. We now do this in the constructor of >> class GMPObject which ODE inherits. >> The only way (I can think of) ensure absolutely, is to wrap class real >> and >> check in the constructor, but I guess the overhead by checking this >> every >> time a real is declared is unacceptable. >> Another suggestion is to do the initalization in a function >> dolfin::set_precision(uint prec) and force the user to call this >> function. >> We can check that this has been done when an ode object is created and >> otherwise give an error message. The documentation and error message >> must >> state clearly that this must be done _before_ creating any real >> variables. The bad thing with such a solution is that the same user code >> will not run both with and without GMP enabled, since we force the user >> to >> call set_precision, which doesn't make sense when running with the >> normal >> (double) precision. >> Anders has suggested making this a parameter "floating-point precision" >> in >> Dolfin, but I can't see what should then trigger the call to >> mpf_set_default_prec() before any reals are declared. > > Having a function named set_precision() sounds like the best solution. > > We can let this function return a warning instead of an error if GMP > is not available. Then the demo would run both with and without GMP. > I imaging that set_precision() will only be used in one or two ODE > demos so it should be ok. > > Would that work? > That will work. I don't think the demos should give warnings when run without GMP, but maybe we should write a demo demonstrating this functionality (ie. solving some equation with a known exact solution to see that the precision actually exceeds hardware precision).
Anders: I can have this ready in no time, but maybe we should wait to after you're back from vacation. Or is there a release coming up? Benjamin _______________________________________________ DOLFIN-dev mailing list DOLFIN-dev@fenics.org http://www.fenics.org/mailman/listinfo/dolfin-dev