-
Notifications
You must be signed in to change notification settings - Fork 761
remove the need to derive from thrust::unary_function/thrust::binary_function when c++11 is enabled #671
Conversation
…function when c++11 is enabled
|
You need to Also, since we're using C++11, we should probably implement |
Do we need a unit test? |
…r reports a too low _cplusplus version but supports std::result_of
|
regarding the unit tests: how can I enable |
|
I don't think the unit tests know about c++11. You would need to introduce a command line option to pass something like There are dictionaries which map build options to compiler flags here: https://github.com/thrust/thrust/blob/master/SConstruct#L28 I suggest introducing a new SCons |
|
I couldn't find any unit tests for Regarding |
|
regarding Do you think any compiler which defines If we added a unit test for this, how would it be activated? Through that yet to be defined SCons |
|
Regarding documentation: Where should that hint go?
? |
|
It's difficult to predict the behavior of (buggy) compilers, so Thrust typically needs to be programmed as defensively as possible. Since it is a one-line change to change it back to a C++03-style Unit tests are run on a cross product of supported OSes and hardwares. Each particular OS version has a compiler version which is supported: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#system-requirements If we added a unit test for this feature, I would simply guard it with For documentation, I think it would be sufficient to add a new note entry to |
|
Would you still like the possibility to enable c++11 for the existing unit tests through the scons variable? |
|
Finally, please add a new entry in the Once we have some confidence that this change works, I'll merge it. Because the change is small, simply building and running the example programs on your system should be sufficient. I will do the same on my system (Ubuntu 14.04). |
|
Yes, in order to test the example programs with this feature, it seems necessary to enable C++11 in the build. In case it's not obvious, you can build & run the example programs automatically with |
|
You might add this command to the newly created wiki page. |
|
I've added a section for building & running the example programs. |
* modified documentation of thrust::unary_function and thrust::binary_function: added note that they are optional when using c++11 * added new SCons variable "std" to select the c++ standard when building tests and examples; this currently produces warnings: "cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C [enabled by default]"
|
Could you please have a look at "cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C [enabled by default]" ? |
|
when not appending |
|
No, I don't believe the change is sufficient. With your current changes, the C++11 build won't work unless I think the warnings were probably due to Perhaps there's a way to remove |
|
I thought
|
|
Unit tests passed on my computer (Ubuntu 14.04) with std=c++11: Examples compiled and run after I fixed cuda/async_reduce.cu. |
|
I edited that part of the wiki page to indicate that that comment only applies to the CUDA backend. Some of the source files used in the build have the extension |
|
warnings do not occur anymore because |
thrust/functional.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C+11 -> C++11
I think I would change the note to say something like:
"Because C++11 language support makes the functionality of \c unary_function obsolete, it's use is optional if C++11 language features are enabled."
Note that the \c makes Doxygen print the word in typewriter font.
|
Thanks Manuel, your changes look good to me. I found a couple of typos in If you make those last tweaks, I will test your changes with MSVC and merge them if the tests pass on my system. |
|
Looks good, thanks for the hard work, Manuel! |
remove the need to derive from thrust::unary_function/thrust::binary_function when c++11 is enabled
see #624