Skip to content

Commit

Permalink
Changing all byte sizes to sg_size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 15, 2024
1 parent 98ca6ad commit 32d0b43
Show file tree
Hide file tree
Showing 41 changed files with 151 additions and 151 deletions.
8 changes: 4 additions & 4 deletions include/wrench/communicator/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace wrench {
unsigned long join(unsigned long desired_rank);
unsigned long getNumRanks();
void barrier();
void sendAndReceive(const std::map<unsigned long, double> &sends, int num_receives);
void sendReceiveAndCompute(const std::map<unsigned long, double> &sends, int num_receives, double flops);
void sendAndReceive(const std::map<unsigned long, sg_size_t> &sends, int num_receives);
void sendReceiveAndCompute(const std::map<unsigned long, sg_size_t> &sends, int num_receives, double flops);

void MPI_Alltoall(double bytes, std::string config = "ompi");
void MPI_Bcast(int root_rank, double bytes, std::string config = "ompi");
void MPI_Alltoall(sg_size_t bytes, std::string config = "ompi");
void MPI_Bcast(int root_rank, sg_size_t bytes, std::string config = "ompi");
void MPI_Barrier(std::string config = "ompi");

~Communicator();
Expand Down
9 changes: 5 additions & 4 deletions include/wrench/data_file/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <string>
#include <map>
#include <simgrid/forward.h>

namespace wrench {

Expand All @@ -21,19 +22,19 @@ namespace wrench {
class DataFile {

public:
double getSize() const;
void setSize(double size);
sg_size_t getSize() const;
void setSize(sg_size_t size);
std::string getID() const;
~DataFile();

protected:
friend class Simulation;
DataFile(std::string id, double size);
DataFile(std::string id, sg_size_t size);

/** @brief File id/name **/
std::string id;
/** @brief File size in bytes **/
double size;// in bytes
sg_size_t size;// in bytes
};

}// namespace wrench
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace wrench {
*/
class ExecutionControllerMessage : public SimulationMessage {
protected:
explicit ExecutionControllerMessage(double payload);
explicit ExecutionControllerMessage(sg_size_t payload);
};


Expand All @@ -32,7 +32,7 @@ namespace wrench {
*/
class ExecutionControllerAlarmTimerMessage : public ExecutionControllerMessage {
public:
explicit ExecutionControllerAlarmTimerMessage(std::string message, double payload);
explicit ExecutionControllerAlarmTimerMessage(std::string message, sg_size_t payload);
/** @brief The message sent my the timer */
std::string message;
};
Expand Down
4 changes: 2 additions & 2 deletions include/wrench/execution_events/FileReadCompletedEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ namespace wrench {
* @param num_bytes: the number of bytes read
*/
FileReadCompletedEvent(std::shared_ptr<FileLocation> location,
double num_bytes)
sg_size_t num_bytes)
: location(std::move(location)), num_bytes(num_bytes) {}

public:
/** @brief The location */
std::shared_ptr<FileLocation> location;
/** @brief The number of bytes read */
double num_bytes;
sg_size_t num_bytes;

/**
* @brief Get a textual description of the event
Expand Down
4 changes: 2 additions & 2 deletions include/wrench/execution_events/FileReadFailedEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace wrench {
* @param failure_cause: a failure cause
*/
FileReadFailedEvent(std::shared_ptr<FileLocation> location,
double num_bytes,
sg_size_t num_bytes,
std::shared_ptr<FailureCause> failure_cause)
: location(std::move(location)), num_bytes(num_bytes),
failure_cause(std::move(failure_cause)) {}
Expand All @@ -61,7 +61,7 @@ namespace wrench {
/** @brief The location */
std::shared_ptr<FileLocation> location;
/** @brief The number of bytes that should have been read */
double num_bytes;
sg_size_t num_bytes;
/** @brief The cause of the failure */
std::shared_ptr<FailureCause> failure_cause;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace wrench {
public:
NetworkProximitySenderDaemon(Simulation *simulation, const std::string& hostname,
S4U_CommPort *network_proximity_service_commport,
double message_size, double measurement_period,
sg_size_t message_size, double measurement_period,
double noise, int noise_seed, const WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE& messagepayload_list);

private:
Expand Down
12 changes: 6 additions & 6 deletions include/wrench/services/storage/StorageService.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace wrench {
* @param location a location
* @param num_bytes a number of bytes to read
*/
static void readFileAtLocation(const std::shared_ptr<FileLocation> &location, double num_bytes) {
static void readFileAtLocation(const std::shared_ptr<FileLocation> &location, sg_size_t num_bytes) {
if (location == nullptr) {
throw std::invalid_argument("StorageService::readFileAtLocation(): invalid argument argument");
}
Expand All @@ -151,7 +151,7 @@ namespace wrench {
* @param file a file
* @param num_bytes a number of bytes to read
*/
void readFile(const std::shared_ptr<DataFile> &file, double num_bytes) {
void readFile(const std::shared_ptr<DataFile> &file, sg_size_t num_bytes) {
this->readFile(wrench::FileLocation::LOCATION(this->getSharedPtr<StorageService>(), file), num_bytes);
}
/**
Expand All @@ -168,7 +168,7 @@ namespace wrench {
* @param path a path
* @param num_bytes a number of bytes to read
*/
virtual void readFile(const std::shared_ptr<DataFile> &file, const std::string &path, double num_bytes) {
virtual void readFile(const std::shared_ptr<DataFile> &file, const std::string &path, sg_size_t num_bytes) {
this->readFile(wrench::FileLocation::LOCATION(this->getSharedPtr<StorageService>(), FileLocation::sanitizePath(path), file), num_bytes);
}
/**
Expand All @@ -183,7 +183,7 @@ namespace wrench {
* @param location a location
* @param num_bytes a number of bytes to read
*/
virtual void readFile(const std::shared_ptr<FileLocation> &location, double num_bytes) {
virtual void readFile(const std::shared_ptr<FileLocation> &location, sg_size_t num_bytes) {
this->readFile(S4U_Daemon::getRunningActorRecvCommPort(), location, num_bytes, true);
}

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

virtual void readFile(S4U_CommPort *answer_commport,
const std::shared_ptr<FileLocation> &location,
double num_bytes,
sg_size_t num_bytes,
bool wait_for_answer);

virtual void writeFile(S4U_CommPort *answer_commport,
const std::shared_ptr<FileLocation> &location,
double num_bytes_to_write,
sg_size_t num_bytes_to_write,
bool wait_for_answer);

/**
Expand Down
8 changes: 4 additions & 4 deletions include/wrench/services/storage/StorageServiceMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ namespace wrench {
bool success,
std::shared_ptr<FailureCause> failure_cause,
std::map<S4U_CommPort *, double> data_write_commport_and_bytes,
double buffer_size,
sg_size_t buffer_size,
double payload);

/** @brief The file location hould be written */
Expand All @@ -206,7 +206,7 @@ namespace wrench {
/** @brief The set of destination commports and the number of bytes to send to each */
std::map<S4U_CommPort *, double> data_write_commport_and_bytes;
/** @brief The buffer size to use */
double buffer_size;
sg_size_t buffer_size;
};

/**
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace wrench {
bool success,
std::shared_ptr<FailureCause> failure_cause,
S4U_CommPort *commport_to_receive_the_file_content,
double buffer_size,
sg_size_t buffer_size,
unsigned long number_of_sources,
double payload);

Expand All @@ -253,7 +253,7 @@ namespace wrench {
/** @brief The commport_name to which the file content should be sent (or nullptr) */
S4U_CommPort *commport_to_receive_the_file_content;
/** @brief The requested buffer size */
double buffer_size;
sg_size_t buffer_size;
/** @brief The number of sources that will send data */
unsigned long number_of_sources;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ namespace wrench {

void writeFile(S4U_CommPort *answer_commport,
const std::shared_ptr<FileLocation> &location,
double num_bytes_to_write,
sg_size_t num_bytes_to_write,
bool wait_for_answer) override;

void readFile(S4U_CommPort *answer_commport,
const std::shared_ptr<FileLocation> &location,
double num_bytes,
sg_size_t num_bytes,
bool wait_for_answer) override;

void deleteFile(S4U_CommPort *answer_commport,
Expand Down
6 changes: 3 additions & 3 deletions include/wrench/services/storage/proxy/StorageServiceProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ namespace wrench {

virtual bool lookupFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file);

//void readFile(const std::shared_ptr<FileLocation> &location, double num_bytes) override;
//void readFile(const std::shared_ptr<FileLocation> &location, sg_size_t num_bytes) override;
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file);
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, double num_bytes);
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, sg_size_t num_bytes);
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, const std::string &path);
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, const std::string &path, double num_bytes);
virtual void readFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, const std::string &path, sg_size_t num_bytes);

virtual void writeFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file, const std::string &path);
virtual void writeFile(const std::shared_ptr<StorageService> &targetServer, const std::shared_ptr<DataFile> &file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ namespace wrench {


/** @brief The service's buffer size */
double buffer_size = 10000000;
sg_size_t buffer_size = 10000000;

/** @brief Whether the service is bufferized */
bool is_bufferized;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace wrench {
S4U_CommPort *answer_commport_if_read,
S4U_CommPort *answer_commport_if_write,
S4U_CommPort *answer_commport_if_copy,
double buffer_size);
sg_size_t buffer_size);

FileTransferThread(const std::string& hostname,
std::shared_ptr<StorageService> parent,
Expand All @@ -57,7 +57,7 @@ namespace wrench {
S4U_CommPort *answer_commport_if_read,
S4U_CommPort *answer_commport_if_write,
S4U_CommPort *answer_commport_if_copy,
double buffer_size);
sg_size_t buffer_size);

FileTransferThread(const std::string& hostname,
std::shared_ptr<StorageService> parent,
Expand All @@ -70,7 +70,7 @@ namespace wrench {
S4U_CommPort *answer_commport_if_read,
S4U_CommPort *answer_commport_if_write,
S4U_CommPort *answer_commport_if_copy,
double buffer_size);
sg_size_t buffer_size);

int main() override;
void cleanup(bool has_returned_from_main, int return_value) override;
Expand All @@ -97,7 +97,7 @@ namespace wrench {
S4U_CommPort *answer_commport_if_read;
S4U_CommPort *answer_commport_if_write;
S4U_CommPort *answer_commport_if_copy;
double buffer_size;
sg_size_t buffer_size;

void receiveFileFromNetwork(const std::shared_ptr<DataFile> &f, S4U_CommPort *commport, const std::shared_ptr<FileLocation> &location);
void sendLocalFileToNetwork(const std::shared_ptr<DataFile> &f, const std::shared_ptr<FileLocation> &location, double num_bytes, S4U_CommPort *commport);
Expand Down
2 changes: 1 addition & 1 deletion include/wrench/services/storage/xrootd/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace wrench {

virtual void writeFile(S4U_CommPort *answer_commport,
const std::shared_ptr<FileLocation> &location,
double num_bytes_to_write,
sg_size_t num_bytes_to_write,
bool wait_for_answer) override;

virtual double getFileLastWriteDate(const std::shared_ptr<FileLocation> &location) override;
Expand Down
2 changes: 1 addition & 1 deletion include/wrench/simgrid_S4U_util/S4U_CommPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace wrench {
/**
* @brief The default control message size
*/
static double default_control_message_size;
static sg_size_t default_control_message_size;

/**
* @brief The "not a commport_name" commport_name, to avoid getting answers back when asked
Expand Down
18 changes: 9 additions & 9 deletions include/wrench/simgrid_S4U_util/S4U_Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace wrench {
class S4U_Simulation {
public:
/** @brief The ram capacity of a physical host whenever not specified in the platform description file */
static constexpr double DEFAULT_RAM = (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0);// 1 PiB
static constexpr sg_size_t DEFAULT_RAM = LONG_LONG_MAX;

public:
static void enableSMPI();
Expand All @@ -51,25 +51,25 @@ namespace wrench {
static void turnOffLink(const std::string &link_name);
static void turnOnLink(const std::string &link_name);
static double getFlopRate();
static double getHostMemoryCapacity(const std::string &hostname);
static double getMemoryCapacity();
static sg_size_t getHostMemoryCapacity(const std::string &hostname);
static sg_size_t getMemoryCapacity();
static void compute(double);
static void compute_multi_threaded(unsigned long num_threads,
double thread_creation_overhead,
double sequential_work,
double parallel_per_thread_work);
static void sleep(double);
static void computeZeroFlop();
static void writeToDisk(double num_bytes, const std::string &hostname, std::string mount_point, simgrid::s4u::Disk *disk);
static void readFromDisk(double num_bytes, const std::string &hostname, std::string mount_point, simgrid::s4u::Disk *disk);
static void readFromDiskAndWriteToDiskConcurrently(double num_bytes_to_read, double num_bytes_to_write,
static void writeToDisk(sg_size_t num_bytes, const std::string &hostname, std::string mount_point, simgrid::s4u::Disk *disk);
static void readFromDisk(sg_size_t num_bytes, const std::string &hostname, std::string mount_point, simgrid::s4u::Disk *disk);
static void readFromDiskAndWriteToDiskConcurrently(sg_size_t num_bytes_to_read, sg_size_t num_bytes_to_write,
const std::string &hostname,
const std::string &read_mount_point,
const std::string &write_mount_point,
simgrid::s4u::Disk *src_disk,
simgrid::s4u::Disk *dst_disk);

static double getDiskCapacity(const std::string &hostname, std::string mount_point);
static sg_size_t getDiskCapacity(const std::string &hostname, std::string mount_point);
static std::vector<std::string> getDisks(const std::string &hostname);
static simgrid::s4u::Disk *hostHasMountPoint(const std::string &hostname, const std::string &mount_point);

Expand Down Expand Up @@ -104,14 +104,14 @@ namespace wrench {
static std::map<std::string, std::vector<std::string>> getAllClusterIDsByZone();
static std::map<std::string, std::vector<std::string>> getAllSubZoneIDsByZone();

static void createNewDisk(const std::string &hostname, const std::string &disk_id, double read_bandwidth_in_bytes_per_sec, double write_bandwidth_in_bytes_per_sec, double capacity_in_bytes, const std::string &mount_point);
static void createNewDisk(const std::string &hostname, const std::string &disk_id, double read_bandwidth_in_bytes_per_sec, double write_bandwidth_in_bytes_per_sec, sg_size_t capacity_in_bytes, const std::string &mount_point);

void shutdown() const;

static simgrid::s4u::Host *get_host_or_vm_by_name_or_null(const std::string &name);
static simgrid::s4u::Host *get_host_or_vm_by_name(const std::string &name);

static double getHostMemoryCapacity(simgrid::s4u::Host *host);
static sg_size_t getHostMemoryCapacity(simgrid::s4u::Host *host);

private:
static void traverseAllNetZonesRecursive(simgrid::s4u::NetZone *nz, std::map<std::string, std::vector<std::string>> &result, bool get_subzones, bool get_clusters, bool get_hosts_from_zones, bool get_hosts_from_clusters);
Expand Down
6 changes: 3 additions & 3 deletions include/wrench/simgrid_S4U_util/S4U_VirtualMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace wrench {

S4U_VirtualMachine(const std::string &vm_hostname,
unsigned long num_cores,
double ram_memory,
sg_size_t ram_memory,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list);

Expand All @@ -58,7 +58,7 @@ namespace wrench {

std::string getPhysicalHostname();
unsigned long getNumCores();
double getMemory();
sg_size_t getMemory();
WRENCH_PROPERTY_COLLECTION_TYPE getPropertyList();
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE getMessagePayloadList();

Expand All @@ -71,7 +71,7 @@ namespace wrench {
std::string vm_name;
simgrid::s4u::VirtualMachine *vm;
unsigned long num_cores;
double ram_memory;
sg_size_t ram_memory;
std::string pm_name;
WRENCH_PROPERTY_COLLECTION_TYPE property_list;
WRENCH_MESSAGE_PAYLOADCOLLECTION_TYPE messagepayload_list;
Expand Down
Loading

0 comments on commit 32d0b43

Please sign in to comment.