Skip to content
Snippets Groups Projects
Commit 693a3e89 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Timstat: changed to Task::doAsync()

parent 239790e4
No related branches found
No related tags found
1 merge request!222M214003/develop
......@@ -409,36 +409,6 @@ public:
}
}
struct FuncArgs
{
FieldVector3D &fields3D;
std::vector<RecordInfo> &recordList;
VarList &varList1;
cdo::StepStat2D &stepStat;
int t{ 0 };
int numSets{ 0 };
FuncArgs(FieldVector3D &_fields3D, std::vector<RecordInfo> &_recordList, VarList &_varList1, cdo::StepStat2D &_stepStat)
: fields3D(_fields3D), recordList(_recordList), varList1(_varList1), stepStat(_stepStat)
{
}
void
set(int _t, int _numSets)
{
t = _t;
numSets = _numSets;
}
};
static void *
records_add_fields2D_func(void *_args)
{
FuncArgs *args = (FuncArgs *) _args;
records_add_fields2D(args->fields3D[args->t], args->recordList, args->varList1, args->stepStat, args->numSets);
return nullptr;
}
void
run_async()
{
......@@ -454,7 +424,6 @@ public:
auto useTask = true;
cdo::Task task;
FuncArgs funcArgs(fields3D, recordList, varList1, stepStat);
int tsID = 0;
int otsID = 0;
......@@ -487,18 +456,13 @@ public:
cdo_read_record(streamID1, fields3D[numSets % 2][varID][levelID]);
}
if (useTask)
{
if (numSets > 0) task.wait();
funcArgs.set(numSets % 2, numSets);
task.start(records_add_fields2D_func, &funcArgs);
}
else
{
funcArgs.set(numSets % 2, numSets);
records_add_fields2D_func(&funcArgs);
// records_add_fields2D(fields3D[numSets % 2], recordList, varList1, stepStat, numSets);
}
if (useTask && numSets > 0) task.wait();
std::function<void()> records_add_fields2D_func
= std::bind(records_add_fields2D, std::cref(fields3D[numSets % 2]), std::cref(recordList), std::cref(varList1),
std::ref(stepStat), numSets);
useTask ? task.doAsync(records_add_fields2D_func) : records_add_fields2D_func();
vDateTimeN = vDateTime;
numSets++;
......@@ -538,8 +502,8 @@ public:
void
run() override
{
auto doRunAsync = (Options::CDO_Parallel_Read > 0);
if (doRunAsync)
auto runAsync = (Options::CDO_Parallel_Read > 0);
if (runAsync)
run_async();
else
run_sync();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment