Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
lm::main::ReplicateRunner Class Reference

A thread that launches all the various replicates requested. More...

#include <ReplicateRunner.h>

Inheritance diagram for lm::main::ReplicateRunner:
[legend]
Collaboration diagram for lm::main::ReplicateRunner:
[legend]

Public Member Functions

 ReplicateRunner (int replicate, MESolverFactory solverFactory, map< string, string > *parameters, lm::io::ReactionModel *reactionModel, lm::io::DiffusionModel *diffusionModel, uint8_t *lattice, size_t latticeSize, uint8_t *latticeSites, size_t latticeSitesSize, ResourceAllocator::ComputeResources resources)
 Create a new replicate runner.
virtual ~ReplicateRunner ()
virtual void wake ()
 Wake the thread from sleep.
virtual int run ()
 Run the thread.
virtual int getReplicate ()
 Get the current replicate number.
virtual bool hasReplicateFinished ()
 Tell whether the previously running replicate has finished running.
virtual int getReplicateExitCode ()
 Get the exit code for the last replicate to finish.
Public Member Functions inherited from lm::thread::Worker
 Worker ()
 Creates thread and attaches it to the manager.
virtual ~Worker ()
 Removes thread from manager and deletes thread.
virtual void abort ()
 Set the aborted status for a thread and wakes thread.
virtual void checkpoint ()
 Checkpoint (currently unimplemented)
Public Member Functions inherited from lm::thread::Thread
 Thread ()
 Creates a pthread locking mechanism and initializes "Thread".
virtual ~Thread ()
 Destory the Thread.
virtual void start ()
 If no thread exists, creates a new thread and begins execution.
virtual void stop ()
 Joins the thread with the parent waiting if necessary.
virtual pthread_t getId ()
 Returns the pthread based id for the Thread.
virtual void setAffinity (int cpuNumber)
 Binds the thread to a CPU core.

Protected Attributes

int replicate
MESolverFactory solverFactory
map< string, string > * parameters
lm::io::ReactionModel * reactionModel
lm::io::DiffusionModel * diffusionModel
uint8_t * lattice
size_t latticeSize
uint8_t * latticeSites
size_t latticeSitesSize
ResourceAllocator::ComputeResources resources
volatile bool replicateFinished
volatile int replicateExitCode
Protected Attributes inherited from lm::thread::Worker
volatile bool aborted
Protected Attributes inherited from lm::thread::Thread
pthread_mutex_t controlMutex
pthread_t threadId
volatile bool running
int cpuNumber

Detailed Description

A thread that launches all the various replicates requested.

Constructor & Destructor Documentation

◆ ReplicateRunner()

lm::main::ReplicateRunner::ReplicateRunner ( int replicate,
MESolverFactory solverFactory,
map< string, string > * parameters,
lm::io::ReactionModel * reactionModel,
lm::io::DiffusionModel * diffusionModel,
uint8_t * lattice,
size_t latticeSize,
uint8_t * latticeSites,
size_t latticeSitesSize,
ResourceAllocator::ComputeResources resources )

Create a new replicate runner.

Parameters
replicateThe number of the first replicate
solverFactoryThe factory used to create a solver object for each replicate
parametersA map of parameters for the simulation
reactionModelAn object to take care of reactions
diffusionModelAn object to take care of diffusion
latticeThe actual data representing the lattice
latticeSizeThe size of the lattice in bytes
latticeSitesSizeThe size of the lattice sites in bytes
resourcesA manager for the resources that handles GPUs and CPUs

◆ ~ReplicateRunner()

lm::main::ReplicateRunner::~ReplicateRunner ( )
virtual

Member Function Documentation

◆ getReplicate()

virtual int lm::main::ReplicateRunner::getReplicate ( )
inlinevirtual

Get the current replicate number.

Here is the caller graph for this function:

◆ getReplicateExitCode()

int lm::main::ReplicateRunner::getReplicateExitCode ( )
virtual

Get the exit code for the last replicate to finish.

Here is the caller graph for this function:

◆ hasReplicateFinished()

bool lm::main::ReplicateRunner::hasReplicateFinished ( )
virtual

Tell whether the previously running replicate has finished running.

Here is the caller graph for this function:

◆ run()

int lm::main::ReplicateRunner::run ( )
virtual

Run the thread.

Returns
0 on success, -1 on failure

Implements lm::thread::Thread.

Here is the call graph for this function:

◆ wake()

void lm::main::ReplicateRunner::wake ( )
virtual

Wake the thread from sleep.

Implements lm::thread::Thread.

Member Data Documentation

◆ diffusionModel

lm::io::DiffusionModel* lm::main::ReplicateRunner::diffusionModel
protected

◆ lattice

uint8_t* lm::main::ReplicateRunner::lattice
protected

◆ latticeSites

uint8_t* lm::main::ReplicateRunner::latticeSites
protected

◆ latticeSitesSize

size_t lm::main::ReplicateRunner::latticeSitesSize
protected

◆ latticeSize

size_t lm::main::ReplicateRunner::latticeSize
protected

◆ parameters

map<string,string>* lm::main::ReplicateRunner::parameters
protected

◆ reactionModel

lm::io::ReactionModel* lm::main::ReplicateRunner::reactionModel
protected

◆ replicate

int lm::main::ReplicateRunner::replicate
protected

◆ replicateExitCode

volatile int lm::main::ReplicateRunner::replicateExitCode
protected

◆ replicateFinished

volatile bool lm::main::ReplicateRunner::replicateFinished
protected

◆ resources

ResourceAllocator::ComputeResources lm::main::ReplicateRunner::resources
protected

◆ solverFactory

MESolverFactory lm::main::ReplicateRunner::solverFactory
protected

The documentation for this class was generated from the following files: