mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Merge branch 'sleep_when_no_job_for_some_time' into 'master'
TaskManager - sleep when no jobs for some time See merge request ngsolve/netgen!571
This commit is contained in:
commit
c899273397
@ -485,6 +485,7 @@ namespace ngcore
|
||||
#endif
|
||||
|
||||
|
||||
size_t no_job_counter = 0;
|
||||
while (!done)
|
||||
{
|
||||
if (complete[mynode] > jobdone)
|
||||
@ -492,11 +493,12 @@ namespace ngcore
|
||||
|
||||
if (jobnr == jobdone)
|
||||
{
|
||||
no_job_counter++;
|
||||
// RegionTracer t(ti.thread_nr, tCASyield, ti.task_nr);
|
||||
while (ProcessTask()); // do the nested tasks
|
||||
while (ProcessTask()) no_job_counter = 0; // do the nested tasks
|
||||
|
||||
if(sleep)
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(sleep_usecs));
|
||||
if(sleep || no_job_counter > 10000)
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(10));
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
@ -537,6 +539,7 @@ namespace ngcore
|
||||
|
||||
ti.task_nr = mytasks.First()+mytask;
|
||||
ti.ntasks = ntasks;
|
||||
no_job_counter = 0;
|
||||
|
||||
{
|
||||
RegionTracer t(ti.thread_nr, jobnr, RegionTracer::ID_JOB, ti.task_nr);
|
||||
|
Loading…
Reference in New Issue
Block a user