Comments (2)
TaskScheduler::WaitForTask
will only run one task if 0/NULL/nullptr
passed instead of an ICompletable
, I will update the documentation on that shortly (I'm AFK a lot at the moment so responses and updates will be a little slow for a few days). So this seems like it would match your requirements.
Note that I am thinking of adding a more explicit user callable TryRunTasks
function with some more control over what to run as there are a few circumstances where this would help, but it needs more thought.
One option for you might be to do the following:
- GPU work is issued by a task which has a pinned task on thread 0 (main thread/thread which initialized enkiTS) as a dependent task (or issues it after doing work).
- Thread 0 uses
WaitForNewPinnedTasks
to wait for any pinned tasks, then callsRunPinnedTasks
which run the tasks and update any data structures needed by thread 0. Note thatWaitForNewPinnedTasks
can complete with no tasks available, but this should be handled by next step. - Thread 0 Checks for data if needed, if it manages to get all data from operations back it goes to 2.
- With data not ready thread 0 performs a
WaitForTask
withnullptr
and probablyTASK_PRIORITY_HIGH
or similar where all lengthy tasks are run on lower priorities. - If
WaitForTask
did not take long then sleep (this is where enkiTS could help). - Go back to 3.
The main thing enkiTS could add here is that the wait at 5 could be replaced by a WaitForTask
with a timeout or similar, which instead of completing immediately would wait with an enkiTS spin then OS sleep but also wake if there were any new tasks/tasks completed using enkiTS internal signals.
It might be worth you first trying the above version (or similar) and then I can create an experimental branch with the above feature to test.
from enkits.
That's perfect, thanks. Indeed knowing that it only runs one task is the key. It would be nice to have a more flexible way of doing this with a timeout, but it's not critical and at least enables the organisation I want to have.
from enkits.
Related Issues (20)
- Macro redefinition for WIN32_LEAN_AND_MEAN HOT 1
- Conversion warnings HOT 1
- Wrong asserts used HOT 1
- Warning regarding padding with VS 2019 16.11.7 HOT 3
- Using TaskScheduler across DLLs HOT 3
- Compile warnings related to std::is_pod HOT 2
- parallel_for label:question HOT 4
- adding enkiTS as a static library to another project HOT 2
- Scheduling tasks with high priority after-the-fact HOT 5
- Crash when executing a small dependency graph in tight loop HOT 4
- Linking with C HOT 1
- Q: Manual partitioning HOT 6
- Add Github Actions HOT 1
- Feature Request: Shutdown HOT 7
- Make gtl_threadNum invalid by default. HOT 9
- Run all tasks of given priority (or higher) HOT 3
- Deadlock in SemaphoreWait (macOS) HOT 16
- More platforms supported in enki::GetNumHardwareThreads HOT 5
- Stuttering on Intel hybrid CPUs HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enkits.