mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Fixes for non-mpi code...
This commit is contained in:
parent
4bd340156b
commit
dd96f1144b
@ -32,8 +32,12 @@ namespace internal
|
||||
class AdvectAlgorithmTerminator
|
||||
{
|
||||
public:
|
||||
#ifdef VTKM_ENABLE_MPI
|
||||
AdvectAlgorithmTerminator(vtkmdiy::mpi::communicator& comm)
|
||||
: MPIComm(vtkmdiy::mpi::mpi_cast(comm.handle()))
|
||||
#else
|
||||
AdvectAlgorithmTerminator(vtkmdiy::mpi::communicator& vtkmNotUsed(comm))
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
bool useAsyncComm)
|
||||
: AdvectAlgorithm<DSIType>(bm, blocks, useAsyncComm)
|
||||
, Done(false)
|
||||
, WorkerActivate(false)
|
||||
{
|
||||
//For threaded algorithm, the particles go out of scope in the Work method.
|
||||
//When this happens, they are destructed by the time the Manage thread gets them.
|
||||
@ -61,10 +60,11 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool HaveActiveParticles()
|
||||
bool HaveAnyWork()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->Mutex);
|
||||
return !this->Active.empty();
|
||||
//We have work if there particles in any queues or a worker is busy.
|
||||
return !this->Active.empty() || !this->Inactive.empty() || this->WorkerActivate;
|
||||
}
|
||||
|
||||
bool GetActiveParticles(std::vector<ParticleType>& particles, vtkm::Id& blockId) override
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
this->UpdateResult(r);
|
||||
|
||||
this->Communicate(messenger);
|
||||
this->Terminator.Control(this->HaveActiveParticles());
|
||||
this->Terminator.Control(this->HaveAnyWork());
|
||||
}
|
||||
|
||||
//Let the workers know that we are done.
|
||||
@ -190,7 +190,7 @@ protected:
|
||||
|
||||
std::atomic<bool> Done;
|
||||
std::mutex Mutex;
|
||||
bool WorkerActivate;
|
||||
bool WorkerActivate = false;
|
||||
std::condition_variable WorkerActivateCondition;
|
||||
std::unordered_map<vtkm::Id, std::vector<DSIHelperInfo<ParticleType>>> WorkerResults;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user