Closed slayoo closed 10 years ago
Hi Sylwester,
thanks for the report. I'm not yet sure if this is really an odeint issue. The clash happens between boost.bind and thrust placeholder names. odeint does include boost.bind which pulls the placeholders into global namespace, hence a using namespace thrust::placeholders
leads to the clash between boost and thrust. My suggestion would be exactly what has been done in the commit referenced above: use namespace arg = thrust::placeholders
instead.
We could try to add some workaround in odeint but I think the core problem here is boost.bind that doesnt allow you to pull your own placeholders into the global namespace.
Does the solution above work for you or would you prefer to being able to use global placeholders for some reason?
Hi Sylvester,
goot to hear from you and that you are still using odeint.
Does this error also occurs in C++11 mode?
Best regards,
Karsten
On 04.07.2014 15:43, Mario Mulansky wrote:
Hi Sylwester,
thanks for the report. I'm not yet sure if this is really an odeint issue. The clash happens between boost.bind and thrust placeholder names. odeint does include boost.bind which pulls the placeholders into global namespace, hence a |using namespace thrust::placeholders| leads to the clash between boost and thrust. My suggestion would be exactly what has been done in the commit referenced above: use |namespace arg = thrust::placeholders| instead. We could try to add some workaround in odeint but I think the core problem here is boost.bind that doesnt allow you to pull your own placeholders into the global namespace.
— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/134#issuecomment-48045273.
Cuda in general and Thrust in particular do not support compilation in c++11 mode. On Jul 4, 2014 5:54 PM, "headmyshoulder" notifications@github.com wrote:
Hi Sylvester,
goot to hear from you and that you are still using odeint.
Does this error also occurs in C++11 mode?
Best regards,
Karsten
On 04.07.2014 15:43, Mario Mulansky wrote:
Hi Sylwester,
thanks for the report. I'm not yet sure if this is really an odeint issue. The clash happens between boost.bind and thrust placeholder names. odeint does include boost.bind which pulls the placeholders into global namespace, hence a |using namespace thrust::placeholders| leads to the clash between boost and thrust. My suggestion would be exactly what has been done in the commit referenced above: use |namespace arg = thrust::placeholders| instead. We could try to add some workaround in odeint but I think the core problem here is boost.bind that doesnt allow you to pull your own placeholders into the global namespace.
— Reply to this email directly or view it on GitHub < https://github.com/headmyshoulder/odeint-v2/issues/134#issuecomment-48045273 .
— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/134#issuecomment-48046504 .
Hi,
Thanks for quick replies.
When compiling with g++, the same error appears regardless if -std=c++11 was set or not. As ddemidov mentioned, nvcc does not support c++11 at all.
Re Thrust/C++11, I have not seen a single issue with it, and moreover, employing C++11 constructs makes use of Thrust much more efficient!
Sylwester
Indeed, I forgot that it is possible to use thrust without cuda. On Jul 4, 2014 6:33 PM, "Sylwester Arabas" notifications@github.com wrote:
Hi,
Thanks for quick replies.
When compiling with g++, the same error appears regardless if -std=c++11 was set or not. As ddemidov mentioned, nvcc does not support c++11 at all.
Re Thrust/C++11, I have not seen a single issue with it, and moreover, employing C++11 constructs makes use of Thrust much more efficient!
Sylwester
— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/134#issuecomment-48050664 .
Re Thrust/C++11, I have not seen a single issue with it, and moreover, employing C++11 constructs makes use of Thrust much more efficient!
Yes, this is right.
I thought that odeint uses std::bind and its placeholders if is is compiled in C++11 mode. Seems like bug, that this does not work.
Nevertheless, Mario is right. The issue here in C++03 mode occurs due to the placeholders of boost bind which are in the global namespace. We can not do so much here.
For the record, answering Mario's question: yes, the "namespace arg = ..." workaround of course fixes the issue.
Should it be then reported to boost::bind developers? (if anyone here anyhow receiving boost developers' mailing list would volunteer, I would ask him to report it there - this list is much too high traffic for me :))
Thanks, Sylwester
Well I'm quite sure that this issue is known to the boost bind people. But I think they wouldnt change that due to backwards compatibility - this would mean a huge breaking change.
On 07/04/2014 10:30 PM, Sylwester Arabas wrote:
For the record, answering Mario's question: yes, the "namespace arg = ..." workaround of course fixes the issue.
Should it be then reported to boost::bind developers? (if anyone here anyhow receiving boost developers' mailing list would volunteer, I would ask him to report it there - this list is much too high traffic for me :))
Yes, this issue is already known, see for example:
http://stackoverflow.com/questions/13596697/c11-placeholders-with-boost
But this post also offers a solution. We could use
and then define our own placeholders, for example:
boost::arg<1> _odeint_1;
I commited a fix into the master branch. Can you check if your code now compiles?
Thanks,
Karsten
On 07/04/2014 10:30 PM, Sylwester Arabas wrote:
For the record, answering Mario's question: yes, the "namespace arg = ..." workaround of course fixes the issue.
Should it be then reported to boost::bind developers? (if anyone here anyhow receiving boost developers' mailing list would volunteer, I would ask him to report it there - this list is much too high traffic for me :))
Thanks, Sylwester
— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/134#issuecomment-48068919.
Yes, it compiles fine now (checked with clang++ and g++). Thanks! Sylwester
Hi,
The following code:
fails to compile with:
HTH, Sylwester