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
-
enumerator TERMINATION_NONE
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()
Get the per-core flop rate of the compute service’s hosts.
- Throws:
- 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:
std::runtime_error –
- Returns:
a vector of hostnames
-
std::map<std::string, double> getMemoryCapacity()
Get the RAM capacities for each of the compute service’s hosts.
- Throws:
- Returns:
a map of RAM capacities, indexed by hostname
-
unsigned long getNumHosts()
Get the number of hosts that the compute service manages.
- Throws:
std::runtime_error –
- Returns:
the host count
-
std::map<std::string, double> getPerHostAvailableMemoryCapacity()
Get ram availability for each of the compute service’s host.
- Throws:
std::runtime_error –
- 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:
std::runtime_error –
- 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:
std::runtime_error –
- 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).
-
std::shared_ptr<StorageService> getScratch()
Get the compute service’s scratch storage space.
- Returns:
a pointer to the shared scratch space
-
unsigned long getTotalNumCores()
Get the total core counts for all hosts of the compute service.
- Throws:
std::runtime_error –
- 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:
std::runtime_error –
- 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
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
Method to terminate a compound job.
- Parameters:
job – the standard job
Terminate a previously-submitted job (which may or may not be running yet)
- Parameters:
job – the job to terminate
- Throws:
std::invalid_argument –
std::runtime_error –
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.
-
enum TerminationCause