wrench::ComputeService

class ComputeService : public wrench::Service

The compute service base class.

Subclassed by wrench::BareMetalComputeService, wrench::BatchComputeService, wrench::CloudComputeService, wrench::HTCondorComputeService

Public Types

enum TerminationCause

Job termination cause enum.

Values:

enumerator TERMINATION_NONE
enumerator TERMINATION_COMPUTE_SERVICE_TERMINATED
enumerator TERMINATION_JOB_KILLED
enumerator TERMINATION_JOB_TIMEOUT

Public Functions

std::map<std::string, double> getCoreFlopRate()

Get the per-core flop rate of the compute service’s hosts.

Throws:

ExecutionException

Returns:

a list of flop rates in flop/sec

double getFreeScratchSpaceSize()

Get the free space on the compute service’s scratch storage space.

Returns:

a size (in bytes)

std::vector<std::string> getHosts()

Get the list of the compute service’s compute host.

Throws:
Returns:

a vector of hostnames

std::map<std::string, double> getMemoryCapacity()

Get the RAM capacities for each of the compute service’s hosts.

Throws:

ExecutionException

Returns:

a map of RAM capacities, indexed by hostname

unsigned long getNumHosts()

Get the number of hosts that the compute service manages.

Throws:
Returns:

the host count

std::map<std::string, double> getPerHostAvailableMemoryCapacity()

Get ram availability for each of the compute service’s host.

Throws:
Returns:

the ram availability map (could be empty)

std::map<std::string, unsigned long> getPerHostNumCores()

Get core counts for each of the compute service’s host.

Throws:
Returns:

a map of core counts, indexed by hostnames

std::map<std::string, unsigned long> getPerHostNumIdleCores()

Get idle core counts for each of the compute service’s host.

Throws:
Returns:

the idle core counts (could be empty). Note that this doesn’t mean that asking for these cores right will mean immediate execution (since jobs may be pending and “ahead” in the queue, e.g., because they depend on current actions that are not using all available resources).

unsigned long getTotalNumCores()

Get the total core counts for all hosts of the compute service.

Throws:
Returns:

total core counts

virtual unsigned long getTotalNumIdleCores()

Get the total idle core count for all hosts of the compute service. Note that this doesn’t mean that asking for these cores right will mean immediate execution (since jobs may be pending and “ahead” in the queue, e.g., because they depend on current actions that are not using all available resources).

Throws:
Returns:

total idle core count.

double getTotalScratchSpaceSize()

Get the total capacity of the compute service’s scratch storage space.

Returns:

a size (in bytes)

virtual bool hasScratch() const

Checks if the compute service has a scratch space.

Returns:

true if the compute service has some scratch storage space, false otherwise

virtual bool isThereAtLeastOneHostWithIdleResources(unsigned long num_cores, double ram)

Method to find out if, right now, the compute service has at least one host with some idle number of cores and some available RAM. Note that this doesn’t mean that asking for these resources right will mean immediate execution (since jobs may be pending and “ahead” in the queue, e.g., because they depend on current actions that are not using all available resources).

Parameters:
  • num_cores – the desired number of cores

  • ram – the desired RAM

Returns:

true if idle resources are available, false otherwise

virtual void stop() override

Stop the compute service.

virtual void stop(bool send_failure_notifications, ComputeService::TerminationCause termination_cause)

Stop the compute service.

Parameters:
  • send_failure_notifications – whether to send job failure notifications or not

  • termination_cause – the cause (reason) of the service’s termination

virtual bool supportsCompoundJobs() = 0

Returns true if the service supports pilot jobs.

Returns:

true or false

virtual bool supportsPilotJobs() = 0

Returns true if the service supports compound jobs.

Returns:

true or false

virtual bool supportsStandardJobs() = 0

Returns true if the service supports standard jobs.

Returns:

true or false

void terminateJob(const std::shared_ptr<CompoundJob> &job)

Terminate a previously-submitted job (which may or may not be running yet)

Parameters:

job – the job to terminate

Throws:

Public Static Attributes

static constexpr unsigned long ALL_CORES = ULONG_MAX

A convenient constant to mean “use all cores of a physical host” whenever a number of cores is needed when instantiating compute services.

static constexpr double ALL_RAM = DBL_MAX

A convenient constant to mean “use all ram of a physical host” whenever a ram capacity is needed when instantiating compute services.