Hello,
We are experiencing a problem with boost::random using icc on Windows
under optimization. If we compile with the -O1 option, we get correct
behavior. Compiling with -O2 or no -O option gives us a string of zeros.
We have compiled a small test case which shows this problem:
#include "boost/function.hpp"
#include "boost/random.hpp"
#include <iostream>
#include <iomanip>
using namespace std;
typedef boost::lagged_fibonacci607 RGType;
typedef boost::uniform_smallint<> DistType;
typedef boost::variate_generator
Geoff Wedig: ...
typedef boost::lagged_fibonacci607 RGType; typedef boost::uniform_smallint<> DistType; typedef boost::variate_generator
GeneratorType;
Does it make sense to use uniform_smallint with a generator that produces
doubles? I see lagged_fibonacii607 defined as
typedef random::lagged_fibonacci_01
Geoff Wedig wrote:
Hello,
We are experiencing a problem with boost::random using icc on Windows under optimization. If we compile with the -O1 option, we get correct behavior. Compiling with -O2 or no -O option gives us a string of zeros.
We have compiled a small test case which shows this problem:
To date, I've done a lot of hunting trying different compiler options to attack this problem. The compiler option which seems to have the most consistent effect, in that adding it makes the program work, whereas removing it makes it not is -Qunroll0.
I am guessing something in the optimization is causing the generator not to initialize properly, but I do not, at present, know how to solve it.
Has anyone else seen this, or have any ideas what might be going wrong?
Sorry, no. What I normally do in cases like this is a bit of "comparitive debugging": start up two instances of Visual Studio, and debug both, one with optimisation on, one with it off, and see what the difference is. It's always possible that there's an un-initialised variable bug lurking somewhere of course, but I would have expected that to have shown up by now if that was the case. BTW, I tried your code with reasonably up to date versions of Intel 9.1 and 10.0 using -Ox and everything worked as expected. Which Intel compiler version are you using? HTH, John.
John Maddock wrote:
Geoff Wedig wrote:
Hello,
We are experiencing a problem with boost::random using icc on Windows under optimization. If we compile with the -O1 option, we get correct behavior. Compiling with -O2 or no -O option gives us a string of zeros.
We have compiled a small test case which shows this problem:
To date, I've done a lot of hunting trying different compiler options to attack this problem. The compiler option which seems to have the most consistent effect, in that adding it makes the program work, whereas removing it makes it not is -Qunroll0.
I am guessing something in the optimization is causing the generator not to initialize properly, but I do not, at present, know how to solve it.
Has anyone else seen this, or have any ideas what might be going wrong?
Sorry, no. What I normally do in cases like this is a bit of "comparitive debugging": start up two instances of Visual Studio, and debug both, one with optimisation on, one with it off, and see what the difference is.
It's always possible that there's an un-initialised variable bug lurking somewhere of course, but I would have expected that to have shown up by now if that was the case.
BTW, I tried your code with reasonably up to date versions of Intel 9.1 and 10.0 using -Ox and everything worked as expected. Which Intel compiler version are you using?
HTH, John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks for the idea. I'll look into it. I checked the compiler, and it seems to be 8.1. I had thought it was 9.1, which is what we use on Linux. Maybe I should check in with the systems guys.... Thanks! Geoff -- Geoff Wedig Software Engineer Digital Domain
Geoff Wedig wrote:
I checked the compiler, and it seems to be 8.1. I had thought it was 9.1, which is what we use on Linux. Maybe I should check in with the systems guys....
I checked with Intel 8.1 and got all zeros, so this appears to be a compiler bug fixed in the 9.x releases. HTH, John.
participants (3)
-
Geoff Wedig
-
John Maddock
-
Peter Dimov