Skip to content

Commit

Permalink
Changing double into sg_size_t for bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 16, 2024
1 parent 41f0542 commit c20e62c
Show file tree
Hide file tree
Showing 101 changed files with 361 additions and 415 deletions.
7 changes: 4 additions & 3 deletions include/wrench/action/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <set>
#include <stack>
#include <iostream>
#include <simgrid/forward.h>

namespace wrench {

Expand Down Expand Up @@ -65,7 +66,7 @@ namespace wrench {

virtual unsigned long getMinNumCores() const;
virtual unsigned long getMaxNumCores() const;
virtual double getMinRAMFootprint() const;
virtual sg_size_t getMinRAMFootprint() const;

virtual bool usesScratch() const;

Expand All @@ -91,7 +92,7 @@ namespace wrench {
/** @brief Number of allocated cores **/
unsigned long num_cores_allocated = 0;
/** @brief RAM allocated cores **/
double ram_allocated = 0;
sg_size_t ram_allocated = 0;
/** @brief Failure cause (if applicable) **/
std::shared_ptr<FailureCause> failure_cause;
};
Expand All @@ -118,7 +119,7 @@ namespace wrench {
void setState(Action::State new_state);
void setExecutionHost(const std::string &host);
void setNumCoresAllocated(unsigned long num_cores);
void setRAMAllocated(double ram);
void setRAMAllocated(sg_size_t ram);
void setFailureCause(const std::shared_ptr<FailureCause> &failure_cause);

virtual ~Action();
Expand Down
6 changes: 3 additions & 3 deletions include/wrench/action/ComputeAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ namespace wrench {
double getFlops() const;
unsigned long getMinNumCores() const override;
unsigned long getMaxNumCores() const override;
double getMinRAMFootprint() const override;
sg_size_t getMinRAMFootprint() const override;
std::shared_ptr<ParallelModel> getParallelModel() const;

protected:
friend class CompoundJob;

ComputeAction(const std::string &name,
double flops,
double ram,
sg_size_t ram,
unsigned long min_core,
unsigned long max_core,
std::shared_ptr<ParallelModel> parallel_model);
Expand All @@ -52,7 +52,7 @@ namespace wrench {
double flops;
unsigned long min_num_cores;
unsigned long max_num_cores;
double ram;
sg_size_t ram;
std::shared_ptr<ParallelModel> parallel_model;

static void simulateComputationAsSleep(const std::shared_ptr<ActionExecutor> &action_executor, unsigned long num_threads, double sequential_work, double parallel_per_thread_work);
Expand Down
6 changes: 3 additions & 3 deletions include/wrench/action/CustomAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ namespace wrench {
friend class CompoundJob;

CustomAction(const std::string &name,
double ram,
sg_size_t ram,
unsigned long num_cores,
std::function<void(std::shared_ptr<ActionExecutor>)> lambda_execute,
std::function<void(std::shared_ptr<ActionExecutor>)> lambda_terminate);

unsigned long getMinNumCores() const override;
unsigned long getMaxNumCores() const override;
double getMinRAMFootprint() const override;
sg_size_t getMinRAMFootprint() const override;

void execute(const std::shared_ptr<ActionExecutor> &action_executor) override;
void terminate(const std::shared_ptr<ActionExecutor> &action_executor) override;

private:
double ram;
sg_size_t ram;
unsigned long num_cores;

std::function<void(std::shared_ptr<ActionExecutor> action_executor)> lambda_execute;
Expand Down
2 changes: 1 addition & 1 deletion include/wrench/action/FileRegistryDeleteEntryAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace wrench {
std::shared_ptr<FileRegistryService> file_registry_service,
std::shared_ptr<FileLocation> file_location) : FileRegistryAction(FileRegistryAction::DELETE, name, std::move(file_registry_service), std::move(file_location)) {}

// void execute(std::shared_ptr<ActionExecutor> action_executor,unsigned long num_threads, double ram_footprint) override;
// void execute(std::shared_ptr<ActionExecutor> action_executor,unsigned long num_threads, sg_size_t ram_footprint) override;
// void terminate(std::shared_ptr<ActionExecutor> action_executor) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion include/wrench/action/MPIAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace wrench {

unsigned long getMinNumCores() const override;
unsigned long getMaxNumCores() const override;
double getMinRAMFootprint() const override;
sg_size_t getMinRAMFootprint() const override;

void execute(const std::shared_ptr<ActionExecutor> &action_executor) override;
void terminate(const std::shared_ptr<ActionExecutor> &action_executor) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace wrench {
const std::shared_ptr<FileRegistryService> &file_registry_service = nullptr);

void initiateAsynchronousFileRead(const std::shared_ptr<FileLocation> &location,
const double num_bytes);
const sg_size_t num_bytes);

void initiateAsynchronousFileRead(const std::shared_ptr<FileLocation> &location);

Expand Down Expand Up @@ -99,12 +99,12 @@ namespace wrench {

struct ReadRequestSpecs {
std::shared_ptr<FileLocation> location;
double num_bytes;
sg_size_t num_bytes;

~ReadRequestSpecs() = default;

ReadRequestSpecs(std::shared_ptr<FileLocation> location,
double num_bytes) : location(std::move(location)), num_bytes(num_bytes) {}
sg_size_t num_bytes) : location(std::move(location)), num_bytes(num_bytes) {}

bool operator==(const ReadRequestSpecs &rhs) const {
return (location->equal(rhs.location));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ namespace wrench {
class DataManagerFileReadAnswerMessage : public DataMovementManagerMessage {
public:
DataManagerFileReadAnswerMessage(std::shared_ptr<FileLocation> location,
double num_bytes,
sg_size_t num_bytes,
bool success,
std::shared_ptr<FailureCause> failure_cause);
/** @brief The read location */
std::shared_ptr<FileLocation> location;
/** @brief The number of bytes to read */
double num_bytes;
sg_size_t num_bytes;
/** @brief Whether the operation succeeded */
bool success;
/** @brief The failure cause, if any */
Expand Down Expand Up @@ -90,12 +90,12 @@ namespace wrench {
*/
class DataMovementManagerFileReaderThreadMessage : public DataMovementManagerMessage {
public:
DataMovementManagerFileReaderThreadMessage(std::shared_ptr<FileLocation> location, double num_bytes,
DataMovementManagerFileReaderThreadMessage(std::shared_ptr<FileLocation> location, sg_size_t num_bytes,
bool success, std::shared_ptr<FailureCause> failure_cause);
/** @brief The read location */
std::shared_ptr<FileLocation> location;
/** @brief The number of bytes to read */
double num_bytes;
sg_size_t num_bytes;
/** @brief Whether the operation succeeded */
bool success;
/** @brief The failure cause, if any */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ namespace wrench {
public:
FileReaderThread(std::string hostname, S4U_CommPort *creator_commport,
std::shared_ptr<FileLocation> location,
double num_bytes);
sg_size_t num_bytes);

protected:
private:
int main() override;

S4U_CommPort *creator_commport;
std::shared_ptr<FileLocation> location;
double num_bytes;
sg_size_t num_bytes;
};

/***********************/
Expand Down
10 changes: 5 additions & 5 deletions include/wrench/services/Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace wrench {
/**
* @brief Abstraction of a service message payload collection type
*/
typedef std::map<WRENCH_MESSAGEPAYLOAD_TYPE, double> WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE;
typedef std::map<WRENCH_MESSAGEPAYLOAD_TYPE, sg_size_t> WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE;


class FailureCause;
Expand Down Expand Up @@ -81,7 +81,7 @@ namespace wrench {


double getMessagePayloadValue(WRENCH_MESSAGEPAYLOAD_TYPE);
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE &getMessagePayloadList() const;
const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE &getMessagePayloadList() const;

void setStateToDown();

Expand Down Expand Up @@ -116,16 +116,16 @@ namespace wrench {
// MessagePayload stuff
void setMessagePayload(WRENCH_MESSAGEPAYLOAD_TYPE, double);

void setMessagePayloads(const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE &default_messagepayload_values,
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE &overriden_messagepayload_values);
void setMessagePayloads(const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE &default_messagepayload_values,
const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE &overriden_messagepayload_values);

void serviceSanityCheck();

/** @brief The service's property list */
WRENCH_PROPERTY_COLLECTION_TYPE property_list;

/** @brief The service's messagepayload list */
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list;
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list;

/** @brief The service's name */
std::string name;
Expand Down
4 changes: 2 additions & 2 deletions include/wrench/services/compute/ComputeService.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace wrench {
/** @brief A convenient constant to mean "use all ram of a physical host" whenever a ram capacity
* is needed when instantiating compute services
*/
static constexpr double ALL_RAM = DBL_MAX;
static constexpr sg_size_t ALL_RAM = LONG_LONG_MAX;

/***********************/
/** \cond DEVELOPER **/
Expand Down Expand Up @@ -111,7 +111,7 @@ namespace wrench {

virtual unsigned long getTotalNumIdleCores(bool simulate_it = false);

virtual bool isThereAtLeastOneHostWithIdleResources(unsigned long num_cores, double ram);
virtual bool isThereAtLeastOneHostWithIdleResources(unsigned long num_cores, sg_size_t ram);

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

Expand Down
4 changes: 2 additions & 2 deletions include/wrench/services/compute/ComputeServiceMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ namespace wrench {
public:
ComputeServiceIsThereAtLeastOneHostWithAvailableResourcesRequestMessage(S4U_CommPort *answer_commport,
unsigned long num_cores,
double ram, double payload);
sg_size_t ram, sg_size_t payload);

/** @brief The commport_name to which a reply should be sent */
S4U_CommPort *answer_commport;
/** @brief The number of cores desired */
unsigned long num_cores;
/** @brief The RAM desired */
double ram;
sg_size_t ram;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace wrench {
{BareMetalComputeServiceProperty::TERMINATE_WHENEVER_ALL_RESOURCES_ARE_DOWN, "false"},
{BareMetalComputeServiceProperty::SCRATCH_SPACE_BUFFER_SIZE, "0"}};

WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE default_messagepayload_values = {
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE default_messagepayload_values = {
{BareMetalComputeServiceMessagePayload::STOP_DAEMON_MESSAGE_PAYLOAD, S4U_CommPort::default_control_message_size},
{BareMetalComputeServiceMessagePayload::DAEMON_STOPPED_MESSAGE_PAYLOAD, S4U_CommPort::default_control_message_size},
{BareMetalComputeServiceMessagePayload::JOB_TYPE_NOT_SUPPORTED_MESSAGE_PAYLOAD, S4U_CommPort::default_control_message_size},
Expand Down Expand Up @@ -91,17 +91,17 @@ namespace wrench {
public:
// Public Constructor
BareMetalComputeService(const std::string &hostname,
const std::map<std::string, std::tuple<unsigned long, double>> &compute_resources,
const std::map<std::string, std::tuple<unsigned long, sg_size_t>> &compute_resources,
const std::string &scratch_space_mount_point,
WRENCH_PROPERTY_COLLECTION_TYPE property_list = {},
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list = {});
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list = {});

// Public Constructor
BareMetalComputeService(const std::string &hostname,
const std::vector<std::string> &compute_hosts,
const std::string &scratch_space_mount_point,
WRENCH_PROPERTY_COLLECTION_TYPE property_list = {},
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list = {});
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list = {});

bool supportsStandardJobs() override;
bool supportsCompoundJobs() override;
Expand All @@ -117,7 +117,7 @@ namespace wrench {

~BareMetalComputeService() override;

bool isThereAtLeastOneHostWithIdleResourcesInstant(unsigned long num_cores, double ram);
bool isThereAtLeastOneHostWithIdleResourcesInstant(unsigned long num_cores, sg_size_t ram);

protected:
friend class JobManager;
Expand All @@ -127,33 +127,33 @@ namespace wrench {


BareMetalComputeService(const std::string &hostname,
std::map<std::string, std::tuple<unsigned long, double>> compute_resources,
std::map<std::string, std::tuple<unsigned long, sg_size_t>> compute_resources,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list,
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list,
std::shared_ptr<PilotJob> pj, const std::string &suffix,
std::shared_ptr<StorageService> scratch_space);// reference to upper level scratch space

// BareMetalComputeService(const std::string &hostname,
// std::map<simgrid::s4u::Host *, std::tuple<unsigned long, double>> compute_resources,
// std::map<simgrid::s4u::Host *, std::tuple<unsigned long, sg_size_t>> compute_resources,
// WRENCH_PROPERTY_COLLECTION_TYPE property_list,
// WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list,
// WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list,
// std::shared_ptr<PilotJob> pj, const std::string &suffix,
// std::shared_ptr<StorageService> scratch_space);

BareMetalComputeService(const std::string &hostname,
const std::map<std::string, std::tuple<unsigned long, double>> &compute_resources,
const std::map<std::string, std::tuple<unsigned long, sg_size_t>> &compute_resources,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list,
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list,
std::shared_ptr<StorageService> scratch_space);

void validateProperties();


// Low-level constructor helper method
void initiateInstance(const std::string &hostname,
const std::map<std::string, std::tuple<unsigned long, double>>& compute_resources,
const std::map<std::string, std::tuple<unsigned long, sg_size_t>>& compute_resources,
const WRENCH_PROPERTY_COLLECTION_TYPE& property_list,
const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& messagepayload_list,
const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE& messagepayload_list,
const std::shared_ptr<PilotJob>& pj);


Expand Down Expand Up @@ -219,7 +219,7 @@ namespace wrench {
std::map<std::string, std::string> &service_specific_arguments);

void processIsThereAtLeastOneHostWithAvailableResources(
S4U_CommPort *answer_commport, unsigned long num_cores, double ram);
S4U_CommPort *answer_commport, unsigned long num_cores, sg_size_t ram);

void cleanup(bool has_terminated_cleanly, int return_value) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ namespace wrench {

BareMetalComputeServiceOneShot(std::shared_ptr<CompoundJob> job,
const std::string &hostname,
std::map<std::string, std::tuple<unsigned long, double>> compute_resources,
std::map<std::string, std::tuple<unsigned long, sg_size_t>> compute_resources,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list,
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list,
std::shared_ptr<PilotJob> pj,
const std::string &suffix,
std::shared_ptr<StorageService> scratch_space);// reference to upper level scratch space
Expand Down
Loading

0 comments on commit c20e62c

Please sign in to comment.