wrench::ComputeService

class ComputeService : public wrench::Service

The compute service base class.

Subclassed by wrench::BareMetalComputeService, wrench::BatchComputeService, wrench::CloudComputeService, wrench::HTCondorCentralManagerService, 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

ComputeService(const std::string &hostname, const std::string &service_name, const std::string &scratch_space_mount_point)

Constructor.

Parameters:
  • hostname – the name of the host on which the compute service runs

  • service_name – the name of the compute service

  • scratch_space_mount_point – the service’s scratch space’s mount point (”” if none)

std::map<std::string, double> getCoreFlopRate(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

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(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

a vector of hostnames

std::map<std::string, double> getMemoryCapacity(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

a map of RAM capacities, indexed by hostname

unsigned long getNumHosts(bool simulate_it = false)

Get the number of hosts that the compute service manages.

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

the host count

std::map<std::string, double> getPerHostAvailableMemoryCapacity(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

the ram availability map (could be empty)

std::map<std::string, unsigned long> getPerHostNumCores(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

a map of core counts, indexed by hostnames

std::map<std::string, unsigned long> getPerHostNumIdleCores(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

the idle core counts (could be empty). Note that this doesn’t mean that asking for these cores right now 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).

std::shared_ptr<StorageService> getScratch()

Get the compute service’s scratch storage space.

Returns:

a pointer to the shared scratch space

unsigned long getTotalNumCores(bool simulate_it = false)

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

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

Returns:

total core counts

virtual unsigned long getTotalNumIdleCores(bool simulate_it = false)

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).

Parameters:

simulate_it – if true, simulate a message sent to the service to retrieve the information, otherwise perform this operation in zero simulated time.

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, sg_size_t 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 void submitCompoundJob(std::shared_ptr<CompoundJob> job, const std::map<std::string, std::string> &service_specific_arguments) = 0

Method to submit a compound job to the service.

Parameters:
  • job – The job being submitted

  • service_specific_arguments – the set of service-specific arguments

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

virtual void terminateCompoundJob(std::shared_ptr<CompoundJob> job) = 0

Method to terminate a compound job.

Parameters:

job – the standard job

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

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 sg_size_t ALL_RAM = LONG_LONG_MAX

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