Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
ResourceAllocator Class Reference

An object that tracks the available resources for the main simulation runner. More...

#include <ResourceAllocator.h>

Classes

class  ComputeResources
 A representation for the resources for a given node. More...

Public Member Functions

 ResourceAllocator (int processNumber, int numberCpuCores, float cpuCoresPerReplicate)
 Create a ResourceAllocator.
 ResourceAllocator (int processNumber, int numberCpuCores, float cpuCoresPerReplicate, vector< int > cudaDevices, float cudaDevicesPerReplicate)
 Create a ResourceAllocator.
virtual ~ResourceAllocator ()
virtual int getMaxSimultaneousReplicates ()
 Get maximum number of replicates that can run at a time on the available resources based on cudaDevices and numberCpuCores.
virtual ComputeResources assignReplicate (int replicate)
 Assign a replicate to free resources.
virtual void removeReplicate (int replicate)
 Remove a replicate from those that are running.
virtual int reserveCpuCore ()
 Reserve a particular core.

Static Public Member Functions

static vector< int > getAvailableCpuCores ()
 Parse CPU affinity list from /proc/self/status.

Protected Attributes

pthread_mutex_t mutex
int processNumber
int numberCpuCores
int reservedCpuCores
vector< int > availableCpuCores
vector< int > cudaDevices
int cpuSlotsPerCore
int cpuSlotsPerReplicate
int cudaSlotsPerDevice
int cudaSlotsPerReplicate
int ** cpuSlots
int ** cudaSlots

Detailed Description

An object that tracks the available resources for the main simulation runner.

Constructor & Destructor Documentation

◆ ResourceAllocator() [1/2]

lm::main::ResourceAllocator::ResourceAllocator ( int processNumber,
int numberCpuCores,
float cpuCoresPerReplicate )

Create a ResourceAllocator.

Parameters
processNumberThe process identifier
numberCpuCoresThe number of cores on teh resource
cpuCoresPerPrelicateThe number of cores to be used by each simulation replicate

◆ ResourceAllocator() [2/2]

lm::main::ResourceAllocator::ResourceAllocator ( int processNumber,
int numberCpuCores,
float cpuCoresPerReplicate,
vector< int > cudaDevices,
float cudaDevicesPerReplicate )

Create a ResourceAllocator.

Parameters
processNumberThe process identifier
numberCpuCoresThe number of cores on teh resource
cpuCoresPerPrelicateThe number of cores to be used by each simulation replicate
cudaDevicesA set of the identifiers for the available CUDA devices
cudaDevicesPerReplicateThe number of GPUs to be used by each simulation replicate

◆ ~ResourceAllocator()

lm::main::ResourceAllocator::~ResourceAllocator ( )
virtual

Member Function Documentation

◆ assignReplicate()

ResourceAllocator::ComputeResources lm::main::ResourceAllocator::assignReplicate ( int replicate)
virtual

Assign a replicate to free resources.

Parameters
replicateThe replicate identifier
Returns
A class representing the compute resources given to the replicate

◆ getAvailableCpuCores()

vector< int > lm::main::ResourceAllocator::getAvailableCpuCores ( )
static

Parse CPU affinity list from /proc/self/status.

Returns
Vector of available CPU core indices

◆ getMaxSimultaneousReplicates()

int lm::main::ResourceAllocator::getMaxSimultaneousReplicates ( )
virtual

Get maximum number of replicates that can run at a time on the available resources based on cudaDevices and numberCpuCores.

◆ removeReplicate()

void lm::main::ResourceAllocator::removeReplicate ( int replicate)
virtual

Remove a replicate from those that are running.

Parameters
replicateThe replicate identifier

◆ reserveCpuCore()

int lm::main::ResourceAllocator::reserveCpuCore ( )
virtual

Reserve a particular core.

Returns
The identifer fo the core that has been reserved

Member Data Documentation

◆ availableCpuCores

vector<int> lm::main::ResourceAllocator::availableCpuCores
protected

◆ cpuSlots

int** lm::main::ResourceAllocator::cpuSlots
protected

◆ cpuSlotsPerCore

int lm::main::ResourceAllocator::cpuSlotsPerCore
protected

◆ cpuSlotsPerReplicate

int lm::main::ResourceAllocator::cpuSlotsPerReplicate
protected

◆ cudaDevices

vector<int> lm::main::ResourceAllocator::cudaDevices
protected

◆ cudaSlots

int** lm::main::ResourceAllocator::cudaSlots
protected

◆ cudaSlotsPerDevice

int lm::main::ResourceAllocator::cudaSlotsPerDevice
protected

◆ cudaSlotsPerReplicate

int lm::main::ResourceAllocator::cudaSlotsPerReplicate
protected

◆ mutex

pthread_mutex_t lm::main::ResourceAllocator::mutex
protected

◆ numberCpuCores

int lm::main::ResourceAllocator::numberCpuCores
protected

◆ processNumber

int lm::main::ResourceAllocator::processNumber
protected

◆ reservedCpuCores

int lm::main::ResourceAllocator::reservedCpuCores
protected

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