[random] Determining interest in Pseudo-Random Functions and Counter Based Random Number Generators

I am co-author of "Parallel Random Numbers, as Easy as 1, 2, 3". which recently won the best paper award at the IEEE/ACM SC'11 conference. I'm also co-author of the related Random123 library: http://deshawresearch.com/resources_random123.html My colleagues and I would like to contribute a similar library to Boost as well. This isn't just a "port" of the Random123 library. Boost's focus on C++ allows for both simplification and clarification of the ideas in the paper and the original library. I've done a preliminary draft of some code that fits nicely into the existing Boost Random library. It's incomplete, but I think there's enough for folks to look at and gauge further interest. A zip file with a boost-like layout is here: http://thesalmons.org/john/random123/prf_boost/prf_boost.zip The README from the zip file is appended. I look forward to your comments and suggestions. John Salmon -------------- README ------------------- This extension of the Boost Random library adds "Pseudo-Random Functions" (PRFs) as an alternative to conventional "Uniform Random Number Generators" and "Random Number Engines". It is an incomplete draft, intended to start a conversation. It is not ready-to-use library. The case for using PRFs in Monte Carlo and statistical simulation is given in the paper, "Parallel Random Numbers -- As Easy as 1, 2, 3", by Salmon, Moraes, Dror & Shaw, in the Proceedings of SC'11: http://dl.acm.org/citation.cfm?doid=2063405 also available at http://www.thesalmons.org/john/random123/papers/random123sc11.pdf PRFs have been known for many years, but either their advantages were unrecognized or they were thought to have poor performance with respect to conventional URNGs. The paper shows that PRFs exist with excellent statistical properties, and highly desirable space and time characteristics. Also, note that the terminology in the paper, is slightly different from that used here. In the paper they're called "Counter Based Random Number Generators". PRFs are well-known in cryptography, but the PRFs here (except for AES) are *not* cryptographically strong. Nevertheless, they have satisfied extensive tests of statistical quality and should satisfy the needs of Monte Carlo simulation and other fields that routinely use random numbers. PRFs are pure functions (functors in C++) with the property that they return "random" values, even when presented with highly regular inputs (see the paper for a discussion of how randomness is empirically established). The user of a PRF assembles the input, calls the function and obtains a "random" result which can then be used in the same way as a value obtained from a conventional URNG or Engine. In contrast, a conventional Random Number Engine has a much more limited API: the caller is restricted to seeding the engine, once and for all, and then repeatedly asking for the "next" random value. PRFs eliminate the sequential dependence inherent in conventional RNGs. With a PRF, one can compute the "n-th" value in O(1) time, without stepping through earlier values. In fact, with a PRF, the notion of an "n-th" value loses its significance. One simply obtains a random value. Eliminating sequential dependence can be especially useful for parallel, multi-threaded applications. For example, one can assemble a PRF's input from application-level data, e.g., object id, voxel number, user-supplied seed value, timestep, iteration number, etc. This kind of application data is unchanged when the application is parallelized, and is generally invariant as more or fewer threads become available. The resulting random value is thus invariant to the parallelization as well. This can be enormously helpful when correctness dictates that separate "parallel" threads should use the same "random" value, or when trying to reproduce results on different platforms with different levels of parallelism. Four PRFs are implemented: threfry, philox, ars and aes, each implemented in its own header file, e.g., boost/random/ars.hpp. The file boost/random/counter_based_urng.hpp implements the counter_based_urng adapter class, which creates a Uniform Random Number Generator from a PRF, allowing programmers to use the PRF APIs together with Boost or C++1x Random Number Distributions. The file boost/random/counter_based_engine.hpp implements the counter_based_engine adapter class, which creates a Uniform Random Number Engine from a PRF, allowing PRFs to be used with software that relies on the Uniform Random Engine concept. For better or worse, wrapping a PRF in a counter_based_engine adapter completely obscures the PRF's API and reintroduces sequential dependence. The zip file also contains a copy of the candidate Boost Endian library copied from boost sandbox. Endian-swapping is required by the AES engine on bigendian machines, and the library meets our needs. Concepts -------- All PRFs have a domain_type and a range_type and with d a "permissible" object of the domain type, the expression: prf(d) is of the range_type. In many cases, every possible value of domain_type will be "permissible", but we leave open the possibility that the prf may place restrictions on the values of domain_type that produce "random" results. The values returned by the prf should be "random", a concept that is difficult to make both precise and achievable. Roughly, for most sequences, including highly "regular" sequences, of distinct, permissible domain_type values, d1, d2, d3, ..., the sequence: prf(d1), prf(d2), prf(d3), ... is statistically indistinguishable from a sequence of independent, uniformly distributed random variables sampling the range_type. In most cases, the output of the prf will uniformly sample all possible values of the range_type, but we leave open the possibility that it may only sample a subset and that the output is only uniform over the subset. Keyable PRFs have a key_type, a corresponding constructor, and setkey() and getkey() member functions. Keyable PRFs constructed with different keys must also be statistically independent. I.e., even for highly regular sequences of distinct (key, domain) pairs: (k1, d1), (k2,d2), ... the sequence: Prf(k1)(d1), Prf(k2)(d2), ... is statistically indistinguishable from a sequence of independent random uniformly distributed samples of the range_type Keyable PRFs may also be Seedable in which case they also have seed() member functions and corresponding constructors similar to those of Random Number Engines. Seeding a PRF is equivalent to setting its key to some value corresponding to the output of sseq.generate(). A PRF has a Countable Domain if its domain_type has member functions begin(), end(), and back() with semantics identical to that of boost::array<Uint, N> for some unsigned integral type Uint and some N. It must also have member functions domain_array_min() and domain_array_max() that specify the permissible domain values. Any array, da, whose members, da[i], satisfy: prf.domain_array_min() <= da[i] <= prf.domain_array_max[] must be "permissible". A PRF has an Integer Array Range if its range_type has member functions begin(), end(), and size() with semantics identical to boost::array<RangeInt, N>, for some integral type, RangeInt and constant N. It must also have static constexpr member functions, range_array_min() and range_array_max() that specify the subset of range values sampled by the PRF. For any sequence of permissible domain value, d1, d2, ..., the integers: prf(d1)[i], prf(d2)[i] must be statistically indistinguishable from independent uniformly distributed RangeInts from range_array_min() up to and including range_array_max(). If a PRF has a Countable Domain and an Integer Array Range, then: counter_based_urng<Prf> satisfies the requirements of a Uniform Random Number Generator. If, in addition, the PRF is Seedable, Streamable and Equality Comparable, then: counter_based_engine<Prf> satisfies the requirements of a Random Number Engine. A PRF is a Pseudo-Random Bijection if it is one-to-one and onto. I.e., if it has an inverse. It is not necessary for the inverse to have a practical implementation. It is sufficient that the inverse exist mathematically. A PRF is a Pseudo-Random Permutation if it is a Bijection and its domain_type is the same as its range_type. The four implemented PRFs are CopyAssignable, EqualityComparable, Streamable, Keyable, Seedable, Pseudo-Random Permutations with Integer Array ranges and Countable domains. Hence, they satisfy the requirements of counter_based_engine and counter_based_urng. Differences from Random123 -------------------------- This code is inspired by the Random123 library, but there are significant differences. New terminology: threefry<2, uint64_t> is a "Pseudo-Random Function" (PRF). PRFs take a key_type as a constructor argument, and are bijections on their ctr_type. Thus, instead of: typedef r123::Threefry2x64 r123_t; r123_t::ctr_type c; r123_t::key_type k r123_t::ctr_type r = r123_t(c, k) You now say: typedef boost::random::threefry<2, uint64_t> prf_t; prf_t::key_type k; prf_t myprf(k); prf_t::domain_type c; prf_t::range_type r = myprf(c); // Or alternatively, (more reminiscent of Random123) prf_t::range_type r2 = prf_t(k)(c); AESNI ----- Use of AESNI is tricky because we want both compile-time and runtime control over whether AESNI is used. The compile-time control is determined by BOOST_HAS_AESNI, which we assume will be set by some config file based on compiler-specific symbols (__AES__, __x86_64__, __ICC, __GNUC__) and possible user-overrides. But even if AESNI support is compiled in, we have to detect it and fall back to a software implementation at runtime if it's not available. The check requires either an asm with GCC-compatible compilers or an intrinsic with MSVC-compatible compilers. Endianness is another complication. The AESNI implementation only works on x86_64 platforms, so it is not endian-sensitive. In fact, it *defines* how multi-byte quantities are to be interpreted. In contrast, the software implementation has to be endian-aware. The current implementation has not been tested with other endians, and hence is almost certainly broken. And finally, the AESNI intrinsics are *very* fast. We don't want to weigh them down with lots of runtime checks. With AESNI enabled, the runtime overhead should cost no more than a single conditional at the top of operator()(c). The choice between hardware and software AES is controlled by a member data field, useAESNI, of the prf class. If hw AES is compiled in, useAESNI is initialized by a runtime check of the CPU capabilities. It can be changed with a mutator method. If hw AES is not compiled in, useAESNI is initialized false and it is an error to try to set it to true. In detail/aes_impl.hpp, we implement two classes: detail::hw128 detail::sw128 with a common interface that minimally meets the needs of AES and ARS. The interface includes +=, ^= constructors from array<uintW, N>, aesenc, and aeskeygenassist primitives, etc. The crucial functions in AES and ARS are then written with a template parameter that is assumed to provide the interface. An idiom like: #if BOOST_HAS_AESNI if( useAESNI ) method<detail::hw128>(args); else #endif method<detail::sw128>(args); gives the desired compile-time and runtime control.

Dear John, On Tue, 3 Jan 2012 16:26:25 -0500 John Salmon <john@thesalmons.org> wrote:
I am co-author of "Parallel Random Numbers, as Easy as 1, 2, 3". which recently won the best paper award at the IEEE/ACM SC'11 conference. I'm also co-author of the related Random123 library:
http://deshawresearch.com/resources_random123.html
My colleagues and I would like to contribute a similar library to Boost as well. This isn't just a "port" of the Random123 library. Boost's focus on C++ allows for both simplification and clarification of the ideas in the paper and the original library. I've done a preliminary draft of some code that fits nicely into the existing Boost Random library. It's incomplete, but I think there's enough for folks to look at and gauge further interest.
I would like to draw your attention to TRNG a C++ pseudo-random number generator library for sequential and parallel Monte Carlo simulations. It implements an interface which is basically an extension of the random number generator facility of the new C++ standard. See http://numbercrunch.de/trng/ for documentation and source code. I have not jet read your full paper "Parallel Random Numbers, as Easy as 1, 2, 3", however, I think your counter based generators should fit nicely into the framework of TRNG and allow for fair parallel Monte Carlo. (See http://pre.aps.org/abstract/PRE/v75/i6/e066701 or http://arxiv.org/abs/cond-mat/0609584 for the notion of »playing fair« in parallel Monte Carlo.) Heiko -- -- Cluster Computing @ http://www.clustercomputing.de -- Number Crunch Blog @ http://numbercrunch.de -- Heiko Bauke @ http://www.mpi-hd.mpg.de/personalhomes/bauke

Dear John,
On Tue, 3 Jan 2012 16:26:25 -0500 John Salmon <john@thesalmons.org> wrote:
I am co-author of "Parallel Random Numbers, as Easy as 1, 2, 3". which recently won the best paper award at the IEEE/ACM SC'11 conference. I'm also co-author of the related Random123 library:
http://deshawresearch.com/resources_random123.html
My colleagues and I would like to contribute a similar library to Boost as well. This isn't just a "port" of the Random123 library. Boost's focus on C++ allows for both simplification and clarification of the ideas in the paper and the original library. I've done a preliminary draft of some code that fits nicely into the existing Boost Random library. It's incomplete, but I think there's enough for folks to look at and gauge further interest.
I would like to draw your attention to TRNG a C++ pseudo-random number generator library for sequential and parallel Monte Carlo simulations. It implements an interface which is basically an extension of the random number generator facility of the new C++ standard. See http://numbercrunch.de/trng/ for documentation and source code.
I have not jet read your full paper "Parallel Random Numbers, as Easy as 1, 2, 3", however, I think your counter based generators should fit nicely into the framework of TRNG and allow for fair parallel Monte Carlo. (See http://pre.aps.org/abstract/PRE/v75/i6/e066701 or http://arxiv.org/abs/cond-mat/0609584 for the notion of »playing fair« in parallel Monte Carlo.)
Heiko
John, I'll look into your paper! We have an interest in parallel rng for a Monte Carlo project, and after asking about boost efforts in this area here, and then after reading about TRNG, we decided to give TRNG a try because it looks very well designed. Our code will have a plugable prng design, so from that point of view I have no real preference of you idea being part of boost, TRNG or self-hosted. Being part of boost would be a slight benefit because it reduces the number of external dependencies to just boost in our project. At the moment It might be most logical to contribute to TRNG because that is mature and well designed, but that's my very subjective guess, and I'm fine wherever it lands. But first I should read your paper! Thijs

On Wed, Jan 25, 2012 at 7:05 PM, thijs@sitmo.com <thijs@sitmo.com> wrote:
Dear John,
On Tue, 3 Jan 2012 16:26:25 -0500 John Salmon <john@thesalmons.org> wrote:
I am co-author of "Parallel Random Numbers, as Easy as 1, 2, 3". which recently won the best paper award at the IEEE/ACM SC'11 conference. I'm also co-author of the related Random123 library:
http://deshawresearch.com/resources_random123.html
My colleagues and I would like to contribute a similar library to Boost as well. This isn't just a "port" of the Random123 library. Boost's focus on C++ allows for both simplification and clarification of the ideas in the paper and the original library. I've done a preliminary draft of some code that fits nicely into the existing Boost Random library. It's incomplete, but I think there's enough for folks to look at and gauge further interest.
I would like to draw your attention to TRNG a C++ pseudo-random number generator library for sequential and parallel Monte Carlo simulations. It implements an interface which is basically an extension of the random number generator facility of the new C++ standard. See http://numbercrunch.de/trng/ for documentation and source code.
I have not jet read your full paper "Parallel Random Numbers, as Easy as 1, 2, 3", however, I think your counter based generators should fit nicely into the framework of TRNG and allow for fair parallel Monte Carlo. (See http://pre.aps.org/abstract/PRE/v75/i6/e066701 or http://arxiv.org/abs/cond-mat/0609584 for the notion of »playing fair« in parallel Monte Carlo.)
Heiko
John,
I'll look into your paper! We have an interest in parallel rng for a Monte Carlo project, and after asking about boost efforts in this area here, and then after reading about TRNG, we decided to give TRNG a try because it looks very well designed. Our code will have a plugable prng design, so from that point of view I have no real preference of you idea being part of boost, TRNG or self-hosted. Being part of boost would be a slight benefit because it reduces the number of external dependencies to just boost in our project.
At the moment It might be most logical to contribute to TRNG because that is mature and well designed, but that's my very subjective guess, and I'm fine wherever it lands.
But first I should read your paper!
Thijs
Our work is definitely complementary to TRNG. We go beyond TRNG by arguing that if you use pseudo-random functions (which we call counter-based PRNGs in the paper), in lieu of conventional PRNGs, then things like 'skip' and 'jump' and 'jump2' become moot. You simply don't need them. On the other hand, if you have pseudo-random functions, then it's easy to implement skip() and jump() and jump2() for the benefit of applications that are already coded to a TRNG-like APIl. In fact, I'll probably do that in a future release of the Random123 library. Still, I would be pleased if our work became part of boost, and that boost wouuld be enhanced by its inclusion, so I'm still interested in finding a way to fit Random123 into boost. John _______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

I'll look into your paper! We have an interest in parallel rng for a Monte Carlo project, and after asking about boost efforts in this area here, and then after reading about TRNG, we decided to give TRNG a try because it looks very well designed. Our code will have a plugable prng design, so from that point of view I have no real preference of you idea being part of boost, TRNG or self-hosted. Being part of boost would be a slight benefit because it reduces the number of external dependencies to just boost in our project.
At the moment It might be most logical to contribute to TRNG because that is mature and well designed, but that's my very subjective guess, and I'm fine wherever it lands.
But first I should read your paper!
Thijs
Our work is definitely complementary to TRNG. We go beyond TRNG by arguing that if you use pseudo-random functions (which we call counter-based PRNGs in the paper), in lieu of conventional PRNGs, then things like 'skip' and 'jump' and 'jump2' become moot. You simply don't need them. On the other hand, if you have pseudo-random functions, then it's easy to implement skip() and jump() and jump2() for the benefit of applications that are already coded to a TRNG-like APIl. In fact, I'll probably do that in a future release of the Random123 library.
Still, I would be pleased if our work became part of boost, and that boost wouuld be enhanced by its inclusion, so I'm still interested in finding a way to fit Random123 into boost.
I'm looking into the lib now, and I must say that the counter based concept is very interesting. I like it a lot, and I hope that you would also preserve this state-less approach if you align it with boost. At first look it would be nice if this would indeed become part of boost. As a boost user I would vote for inclusion if there was a vote. Cheers, Thijs

AMDG On 01/26/2012 09:29 AM, thijs@sitmo.com wrote:
Our work is definitely complementary to TRNG. We go beyond TRNG by arguing that if you use pseudo-random functions (which we call counter-based PRNGs in the paper), in lieu of conventional PRNGs, then things like 'skip' and 'jump' and 'jump2' become moot. You simply don't need them. On the other hand, if you have pseudo-random functions, then it's easy to implement skip() and jump() and jump2() for the benefit of applications that are already coded to a TRNG-like APIl. In fact, I'll probably do that in a future release of the Random123 library.
FWIW, the C++ standard library uses void discard(long long);
Still, I would be pleased if our work became part of boost, and that boost wouuld be enhanced by its inclusion, so I'm still interested in finding a way to fit Random123 into boost.
I'm looking into the lib now, and I must say that the counter based concept is very interesting. I like it a lot, and I hope that you would also preserve this state-less approach if you align it with boost.
The issue that I see is that the stateless interface doesn't interact well with the distribution concepts and I see no easy way to make it work, since the distributions don't necessarily use a 1-to-1 transformation on the output of the engine.
At first look it would be nice if this would indeed become part of boost. As a boost user I would vote for inclusion if there was a vote.
From my point of view, I definitely support the addition of new engines that model the existing concepts. For
the stateless interface, the interaction with distributions /must/ be resolved first. In Christ, Steven Watanabe

On Thu, Jan 26, 2012 at 6:21 PM, Steven Watanabe <watanabesj@gmail.com>wrote:
AMDG
On 01/26/2012 09:29 AM, thijs@sitmo.com wrote:
Our work is definitely complementary to TRNG. We go beyond TRNG by
arguing
that if you use pseudo-random functions (which we call counter-based PRNGs in the paper), in lieu of conventional PRNGs, then things like 'skip' and 'jump' and 'jump2' become moot. You simply don't need them. On the other hand, if you have pseudo-random functions, then it's easy to implement skip() and jump() and jump2() for the benefit of applications that are already coded to a TRNG-like APIl. In fact, I'll probably do that in a future release of the Random123 library.
FWIW, the C++ standard library uses void discard(long long);
Yes. There's already a discard() method in counter_based_engine in my library. I was addressing the issue raised by TRNG that discard() by itself doesn't seem to meet the needs of parallel Monte Carlo. The point is debatable, but worthy of consideration. The TRNG library proposes to add split(), jump() and jump2() to the "Parallel Random Number Engine" model to meet the needs of parallel Monte Carlo. I was pointing out that pseudo-random functions could be adapted to provide those methods as well.
Still, I would be pleased if our work became part of boost, and that boost wouuld be enhanced by its inclusion, so I'm still interested in finding a way to fit Random123 into boost.
The issue that I see is that the stateless interface doesn't interact well with the distribution concepts and I see no easy way to make it work, since the distributions don't necessarily use a 1-to-1 transformation on the output of the engine.
Please see the counter_based_urng<> and counter_based_engine<> adapter classes in the library. They allow one to use existing distributions. For example, #include <boost/random/counter_based_urng.hpp> #include <boost/random/philox.hpp> #include <boost/random/uniform_int_distribution.hpp> #include <iostream> int main(int argc, char **argv){ typedef boost::random::philox<4, uint32_t> Prf; Prf::key_type k={{}}; Prf::domain_type c={{}}; // initialize k and c with application-specific, job-specific // or thread-specific values, e.g., // k[0] = thread_id; // k[1] = seed; // ctr[0] = timestamp; // ctr[1] = stocksymbol_id; boost::random::counter_based_urng<Prf> rng(Prf(k), c); boost::random::uniform_int_distribution<int> six(1,6); for(int i=0; i<10; ++i){ std::cout << six(rng) << "\n"; } return 0; }
At first look it would be nice if this would indeed become part of boost. As a boost user I would vote for inclusion if there was a vote.
From my point of view, I definitely support the addition of new engines that model the existing concepts. For the stateless interface, the interaction with distributions /must/ be resolved first.
To the best of my knowledge, counter_based_engine<philox<4, uint32_t>> is a new engine that exactly models existing concepts. We could stop there, but I think it's much more interesting and valuable to go beyond the existing concepts. John Salmon
In Christ, Steven Watanabe
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of John Salmon Sent: Tuesday, January 03, 2012 1:26 PM To: boost@lists.boost.org Subject: [boost] [random] Determining interest in Pseudo-Random Functions and Counter Based Random Number Generators I am co-author of "Parallel Random Numbers, as Easy as 1, 2, 3". which recently won the best paper award at the IEEE/ACM SC'11 conference. I'm also co-author of the related Random123 library: http://deshawresearch.com/resources_random123.html My colleagues and I would like to contribute a similar library to Boost as well. This isn't just a "port" of the Random123 library. Boost's focus on C++ allows for both simplification and clarification of the ideas in the paper and the original library. I've done a preliminary draft of some code that fits nicely into the existing Boost Random library. It's incomplete, but I think there's enough for folks to look at and gauge further interest. A zip file with a boost-like layout is here: ------------------------------------- I am very interested in this library. Of course, I spend most of my development time in a parallel Monte Carlo application.

I tried to report this issue to the user list, but I think it's still under moderation, ..and it's kind of strange error I'm getting solely by including a header like this: #<boost/thread/thread.hpp> int main() { return 0; } This occurs with boost version 1.48 and gcc 4.4.5 on linux The error occurs at lines 53, 69, 88 and 94 in boost/thread/pthread/condition_variable.hpp, and the error is that 'internal_mutex' is not declared. Here below is an inline function containing the line 53. inline void condition_variable::wait(unique_lock<mutex>& m) { int res=0; { thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); // HERE IS THE ERROR guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); } this_thread::interruption_point(); if(res) { boost::throw_exception(condition_error()); } } .I can agree with the compiler, I don't see any declaration of internal_mutex, ..is this a spelling error, and if so, why am I the only one seeing this?? I can't find anyone else reporting something like this via google. Very strange… Any idea? my gcc -v gives: Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.5 (Debian 4.4.5-8)

Le 03/02/12 15:13, Thijs (M.A.) van den Berg a écrit :
I tried to report this issue to the user list, but I think it's still under moderation, ..and it's kind of strange error I'm getting solely by including a header like this:
#<boost/thread/thread.hpp> int main() { return 0; }
This occurs with boost version 1.48 and gcc 4.4.5 on linux
The error occurs at lines 53, 69, 88 and 94 in boost/thread/pthread/condition_variable.hpp, and the error is that 'internal_mutex' is not declared. Here below is an inline function containing the line 53.
inline void condition_variable::wait(unique_lock<mutex>& m) { int res=0; { thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; detail::interruption_checker check_for_interruption(&internal_mutex,&cond); // HERE IS THE ERROR guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); } this_thread::interruption_point(); if(res) { boost::throw_exception(condition_error()); } }
.I can agree with the compiler, I don't see any declaration of internal_mutex, ..is this a spelling error, and if so, why am I the only one seeing this?? I can't find anyone else reporting something like this via google. Very strange… Any idea?
my gcc -v gives: Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.5 (Debian 4.4.5-8)
Hi, I don't know under which conditions you are getting this error :( The declaration is on the file boost/thread/pthread/condition_variable_fwd.hpp class condition_variable { private: pthread_mutex_t internal_mutex; // ************* Could you add #error before this declaration? Best, Vicente

On Feb 3, 2012, at 6:35 PM, "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr> wrote:
Le 03/02/12 15:13, Thijs (M.A.) van den Berg a écrit :
of strange error I'm getting solely by including a header like this:
#<boost/thread/thread.hpp> int main() { return 0; }
This occurs with boost version 1.48 and gcc 4.4.5 on linux
The error occurs at lines 53, 69, 88 and 94 in boost/thread/pthread/condition_variable.hpp, and the error is that 'internal_mutex' is not declared.
Hi, I don't know under which conditions you are getting this error :(
The declaration is on the file
boost/thread/pthread/condition_variable_fwd.hpp
class condition_variable { private: pthread_mutex_t internal_mutex; // *************
Could you add #error before this declaration?
Thanks Vincente, that was helpful and got me going! It turns out that that file was indeed missing the declaration, and in general quite different than the same file on another machine with boost 1.48 Maybe something went wrong during the install, and I ended up with a blended version of boost? The file date was Nov 11, and I downloaded the boost 1.48 archive yesterday. I'll do a clean install, and I now know what to look for. Thanks, Thijs
participants (7)
-
Heiko Bauke
-
John Salmon
-
Keith Jeffery
-
Steven Watanabe
-
Thijs (M.A.) van den Berg
-
thijs@sitmo.com
-
Vicente J. Botet Escriba