Skip to content
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

Execution policy support for all containers #351

Closed
7 of 9 tasks
stotko opened this issue Mar 15, 2023 · 1 comment
Closed
7 of 9 tasks

Execution policy support for all containers #351

stotko opened this issue Mar 15, 2023 · 1 comment
Milestone

Comments

@stotko
Copy link
Owner

stotko commented Mar 15, 2023

As the containers should mimic their C++ counterparts as close as possible in terms of functionality, both per-element and iterator-based member functions are considered and provided. While the former allow for easy usage in the native context, that is e.g. in CUDA kernels for the CUDA backend, the latter iterator-based versions can be considered following algorithm semantics. However, they lack support for execution_policys prohibiting greater flexibility such as using asynchronous CUDA streams. The affected functionality is listed below:

  • All containers:
    • createDeviceObject and destroyDeviceObject
  • bitset:
    • set, reset, flip, count, all, any, none
  • deque:
    • clear, device_range, valid
  • memory:
    • createDeviceArray, destroyDeviceArray, and for symmetry reasons also the respective host versions
  • mutex:
    • valid
  • queue:
    • valid
  • stack:
    • valid
  • unordered_map, unordered_set:
    • device_range, insert, erase, clear, valid
  • vector:
    • insert, erase, clear, valid

Option 1:
Add a respective execution_policy parameter to all of these functions. This could either follow algorithm and make this the first parameter such that each functions must be duplicated. Alternatively, it could be passed as the last parameter with a default value, at the cost of an inconsistent interface to algorithm.

Option 2:
Add a scoped_execution_policy class which acts as a customizable default policy for all calls within its scope. While this minimizes the required changes for the containers, proper global management may be hard to implement as the class types of the policies could theoretically be arbitrary.

@stotko
Copy link
Owner Author

stotko commented Jun 27, 2023

Although queue and stack would also profit from the execution policy support, their primary intention is to serve as special cases for the more general deque and only provide a simplified interface. Extended the support to these containers can be reiterated in the future.

Thus, the task is complete and can be closed.

@stotko stotko closed this as completed Jun 27, 2023
stdgpu 2.0.0 automation moved this from To do to Done Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
stdgpu 2.0.0
  
Done
Development

No branches or pull requests

1 participant