-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider dropping device_t::create_event and device_t::create_stream #277
Comments
Providing a CUDA host API without an implicit default device is one of the significant features of the Issue #142 is related to that discussion. |
@codecircuit : What I'm suggestiong will in no way remove this aspect of the API wrappers. It's just that right now we have two ways of saying the same thing:
(I'm glossing over some extra options here.) None of these involve an implicit default device or current device. And while some of the wrapper classes are RAII, So, either I misunderstood your comments or you've misunderstood my question... |
@eyalroz thank you for the clarification. A similar redundancy is currently also part of the STL with My opinion is not strong on this, but I would keep both functions |
@codecircuit So, that's an interesting analogy. In standard C++, many features remain as they were originally implemented, while a new approach is taken by the language standard committee - because they have to maintain backwards compatibility (even ABI compatibility). So with functions like |
@codecircuit : Actually, this would go further. By the same logic, I would also kill |
We should think about the pros and cons of keeping or remove the corresponding member functions:
By keeping them, users which are used to call member functions have their desired interface as well as users which are used to free function calls have their desired interface. Moreover, when the free functions are called, more code must be written (usually the namespaces are written explicitly). That might be seen as weak code bloating.
Chaining member function calls is more readable than nesting many free function calls, but our API does not induce the user to write such code. The reduced code redundancy would make user code more consistent, as there is only one way to, e.g., create an event. I prefer to keep the member functions due to usability. What member functions would also be removed? |
@codecircuit : I wonder if ADL wouldn't allow writing just
You don't really get nesting with what I'm thinking of removing. If you create a stream, act on it, and immediately forget about it, e.g. Anyway, I think that generally I'll have to give up the idea of slimming down the API this way, because it's too many changes and might be too drastic. |
Well, we wouldn't end up with C-style code, since we still have our RAII classes; and namespaces; and overloading etc. But ok, I guess I'm buying that. Then, perhaps you believe we should go another way? For example, allow for:
where some of the methods return |
Anyway, not removing these methods. In fact, I'm adding a few more on the driver-wrappers branch, e.g. |
I should consider dropping
device_t::create_event()
anddevice_t::create_stream()
, becausedevice.create_event()
anddevice.create_stream()
are not necessary to have: Library users should useevent::create()
andstream::create()
- to getevent_t
's andstream_t
's respectively.Opinions?
The text was updated successfully, but these errors were encountered: