Skip to content

Commit

Permalink
Merge branch 'master' into simgrid-external-project-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Feb 10, 2025
2 parents ac25b05 + 1191718 commit 6aeb953
Show file tree
Hide file tree
Showing 62 changed files with 10,431 additions and 6,299 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ endif ()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/conf/cmake/")

# Find Boost
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
find_package(Boost REQUIRED)

# Find SimGrid
Expand All @@ -55,7 +58,7 @@ if (DEFINED FSMOD_PATH)
message(FATAL_ERROR "The specified FSMOD_PATH doesn't exit")
else()
file(GLOB LIBFSMOD_FILES
"${FSMOD_PATH}/liblibfsmod.so"
"${FSMOD_PATH}/lib/libfsmod.so"
"${FSMOD_PATH}/lib/libfsmod.dylib"
)
if (NOT LIBFSMOD_FILES)
Expand Down Expand Up @@ -592,7 +595,7 @@ if(GTEST_LIBRARY)
endif ()
set_target_properties(unit_tests PROPERTIES COMPILE_FLAGS "-g -O0 --coverage")
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "--coverage")
add_custom_command(TARGET unit_tests COMMAND find . -name *.gcda -delete)
add_custom_command(TARGET unit_tests POST_BUILD COMMAND find . -name *.gcda -delete)
else()
add_custom_target(unit_tests echo "ERROR: Cannot build unit_tests because Google Test (libgtest) was not found by cmake." COMMAND echo " If you have installed Google Test, re-run cmake." VERBATIM)
endif()
Expand Down
1 change: 1 addition & 0 deletions conf/cmake/Examples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/action_api/storage-service-pro
add_custom_command(TARGET examples
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/examples/run_all_examples.sh.in | sed "s~TO_FILL_IN~${CMAKE_BINARY_DIR}/examples/~g" > ${CMAKE_BINARY_DIR}/examples/run_all_examples.sh
COMMAND chmod +x ${CMAKE_BINARY_DIR}/examples/run_all_examples.sh
POST_BUILD
)
6 changes: 3 additions & 3 deletions include/wrench/communicator/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace wrench {

unsigned long join();
unsigned long join(unsigned long desired_rank);
unsigned long getNumRanks();
unsigned long getNumRanks() const;
void barrier();
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);
Expand Down Expand Up @@ -47,8 +47,8 @@ namespace wrench {

void performSMPIOperation(const std::string &op_name,
std::vector<simgrid::s4u::Host *> &hosts,
simgrid::s4u::Host *root_hosts,
int bytes,
simgrid::s4u::Host *root_host,
sg_size_t bytes,
const std::string &config);
};

Expand Down
6 changes: 3 additions & 3 deletions include/wrench/communicator/SMPIExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace wrench {
class SMPIExecutor {

public:
static void performAlltoall(std::vector<simgrid::s4u::Host *> &hosts, int data_size);
static void performBcast(std::vector<simgrid::s4u::Host *> &hosts, simgrid::s4u::Host *root_host, int data_size);
static void performBarrier(std::vector<simgrid::s4u::Host *> &hosts);
static void performAlltoall(const std::vector<simgrid::s4u::Host *> &hosts, int data_size);
static void performBcast(std::vector<simgrid::s4u::Host *> &hosts, const simgrid::s4u::Host *root_host, int data_size);
static void performBarrier(const std::vector<simgrid::s4u::Host *> &hosts);
};

/**********************/
Expand Down
Original file line number Diff line number Diff line change
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, sg_size_t>> &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_PAYLOAD_COLLECTION_TYPE messagepayload_list = {});
const WRENCH_PROPERTY_COLLECTION_TYPE& property_list = {},
const 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_PAYLOAD_COLLECTION_TYPE messagepayload_list = {});
const WRENCH_PROPERTY_COLLECTION_TYPE& property_list = {},
const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE& messagepayload_list = {});

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


BareMetalComputeService(const std::string &hostname,
std::map<std::string, std::tuple<unsigned long, sg_size_t>> compute_resources,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list,
const std::map<std::string, std::tuple<unsigned long, sg_size_t>>& compute_resources,
const WRENCH_PROPERTY_COLLECTION_TYPE& property_list,
const 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 All @@ -141,9 +141,9 @@ namespace wrench {
// std::shared_ptr<StorageService> scratch_space);

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

void validateProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace wrench {
public:
BatchComputeService(const std::string &hostname,
std::vector<std::string> compute_hosts,
std::string scratch_space_mount_point,
const std::string& scratch_space_mount_point,
WRENCH_PROPERTY_COLLECTION_TYPE property_list = {},
WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE messagepayload_list = {});

Expand Down
2 changes: 1 addition & 1 deletion include/wrench/services/compute/batch/BatchJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace wrench {
void setRequestedTime(unsigned long time);
unsigned long getRequestedCoresPerNode() const;
std::string getUsername();
sg_size_t getMemoryRequirement();
sg_size_t getMemoryRequirement() const;
double getBeginTimestamp() const;
void setBeginTimestamp(double time_stamp);
double getEndingTimestamp() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace wrench {
void processJobCompletion(std::shared_ptr<BatchJob> batch_job) override;
void processJobTermination(std::shared_ptr<BatchJob> batch_job) override;

std::shared_ptr<BatchJob> pickNextJobToSchedule();
std::shared_ptr<BatchJob> pickNextJobToSchedule() const;

std::map<simgrid::s4u::Host *, std::tuple<unsigned long, sg_size_t>> scheduleOnHosts(unsigned long, unsigned long, sg_size_t) override;

Expand Down
4 changes: 2 additions & 2 deletions include/wrench/services/compute/cloud/CloudComputeService.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ namespace wrench {
/***********************/

void submitCompoundJob(std::shared_ptr<CompoundJob> job,
const std::map<std::string, std::string> &service_specific_args) override{};
const std::map<std::string, std::string> &service_specific_args) override;

void terminateCompoundJob(std::shared_ptr<CompoundJob> job) override{};
void terminateCompoundJob(std::shared_ptr<CompoundJob> job) override;

void validateProperties();

Expand Down
4 changes: 2 additions & 2 deletions include/wrench/services/helper_services/alarm/Alarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace wrench {
friend class S4U_Daemon;

public:
static std::shared_ptr<Alarm> createAndStartAlarm(Simulation *simulation, double date, std::string hostname,
static std::shared_ptr<Alarm> createAndStartAlarm(Simulation *simulation, double date, const std::string& hostname,
S4U_CommPort *reply_commport,
SimulationMessage *msg, std::string suffix);
SimulationMessage *msg, const std::string& suffix);

void kill();

Expand Down
33 changes: 17 additions & 16 deletions src/wrench/communicator/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace wrench {
* @param size the size of the communicator (# of processes)
* @return a shared pointer to a communicator
*/
std::shared_ptr<Communicator> Communicator::createCommunicator(unsigned long size) {
std::shared_ptr<Communicator> Communicator::createCommunicator(const unsigned long size) {
if (size <= 1) {
throw std::invalid_argument("Communicator::createCommunicator(): invalid argument");
}
Expand All @@ -40,7 +40,8 @@ namespace wrench {
* @brief Get the number of processes participating in the communicator
* @return a number of processes
*/
unsigned long Communicator::getNumRanks() {
unsigned long Communicator::getNumRanks() const
{
return this->rank_to_commport.size();
}

Expand All @@ -59,8 +60,8 @@ namespace wrench {
* @param desired_rank: the desired rank
* @return the desired rank
*/
unsigned long Communicator::join(unsigned long desired_rank) {
auto my_pid = simgrid::s4u::this_actor::get_pid();
unsigned long Communicator::join(const unsigned long desired_rank) {
const auto my_pid = simgrid::s4u::this_actor::get_pid();

if (desired_rank >= this->size) {
throw std::invalid_argument("Communicator::join(): invalid arguments");
Expand Down Expand Up @@ -97,7 +98,7 @@ namespace wrench {
* @param sends: the specification of all outgoing communications as <rank, volume in bytes> pairs
* @param num_receives: the number of expected received (from any source)
*/
void Communicator::sendAndReceive(const std::map<unsigned long, sg_size_t> &sends, int num_receives) {
void Communicator::sendAndReceive(const std::map<unsigned long, sg_size_t> &sends, const int num_receives) {
this->sendReceiveAndCompute(sends, num_receives, 0);
}

Expand All @@ -109,16 +110,16 @@ namespace wrench {
* @param num_receives: the number of expected received (from any source)
* @param flops: the number of floating point operations to compute
*/
void Communicator::sendReceiveAndCompute(const std::map<unsigned long, sg_size_t> &sends, int num_receives, double flops) {
auto my_pid = simgrid::s4u::this_actor::get_pid();
void Communicator::sendReceiveAndCompute(const std::map<unsigned long, sg_size_t> &sends, const int num_receives, const double flops) {
const auto my_pid = simgrid::s4u::this_actor::get_pid();

if (this->actor_to_rank.find(my_pid) == this->actor_to_rank.end()) {
throw std::invalid_argument("Communicator::communicate(): Calling process is not part of this communicator");
}
// Post all the sends
std::vector<std::shared_ptr<S4U_PendingCommunication>> posted_sends;
for (auto const &send_operation: sends) {
auto dst_commport = this->rank_to_commport[send_operation.first];
const auto dst_commport = this->rank_to_commport[send_operation.first];
posted_sends.push_back(dst_commport->iputMessage(new wrench::SimulationMessage(send_operation.second)));
}
// Post the computation (if any)
Expand All @@ -145,7 +146,7 @@ namespace wrench {
* @brief Barrier method (all participants wait for each other), using standard WRENCH/SimGrid mechanisms
*/
void Communicator::barrier() {
auto my_pid = simgrid::s4u::this_actor::get_pid();
const auto my_pid = simgrid::s4u::this_actor::get_pid();
static unsigned long count = 0;
if (this->actor_to_rank.find(my_pid) == this->actor_to_rank.end()) {
throw std::invalid_argument("Communicator::barrier(): Calling process is not part of this communicator");
Expand All @@ -171,7 +172,7 @@ namespace wrench {
* @param bytes: the number of bytes in each message sent/received
* @param config: the SMPI config option
*/
void Communicator::MPI_Alltoall(sg_size_t bytes, std::string config) {
void Communicator::MPI_Alltoall(const sg_size_t bytes, std::string config) {
if (bytes < 1) {
throw std::runtime_error("Communicator::MPI_Alltoall(): invalid argument (should be >= 1)");
}
Expand All @@ -185,7 +186,7 @@ namespace wrench {
* @param bytes: the number of bytes in each message sent/received
* @param config: the SMPI config option
*/
void Communicator::MPI_Bcast(int root_rank, sg_size_t bytes, std::string config) {
void Communicator::MPI_Bcast(const int root_rank, const sg_size_t bytes, std::string config) {
if ((bytes < 1) or (root_rank < 0) or (root_rank >= static_cast<int>(this->size))) {
throw std::runtime_error("Communicator::MPI_Bcast(): invalid argument");
}
Expand All @@ -207,21 +208,21 @@ namespace wrench {
* @param op_name: operation name
* @param hosts: hosts involved
* @param root_host: root hosts (nullptr if none)
* @param data_size: data size in bytes (0 if none)
* @param bytes: data size in bytes (0 if none)
* @param config: the SMPI config option
*/
void Communicator::performSMPIOperation(const std::string &op_name,
std::vector<simgrid::s4u::Host *> &hosts,
simgrid::s4u::Host *root_host,
int data_size,
sg_size_t bytes,
const std::string &config) {


S4U_Simulation::enableSMPI();

// Global synchronization
this->barrier();
auto my_pid = simgrid::s4u::this_actor::get_pid();
const auto my_pid = simgrid::s4u::this_actor::get_pid();
static unsigned long count = 0;
if (this->actor_to_rank.find(my_pid) == this->actor_to_rank.end()) {
throw std::invalid_argument("Communicator::MPI_AllToAll(): Calling process is not part of this communicator");
Expand All @@ -235,9 +236,9 @@ namespace wrench {
simgrid::s4u::Engine::set_config(config);

if (op_name == "Alltoall") {
SMPIExecutor::performAlltoall(hosts, data_size);
SMPIExecutor::performAlltoall(hosts, bytes);
} else if (op_name == "Bcast") {
SMPIExecutor::performBcast(hosts, root_host, data_size);
SMPIExecutor::performBcast(hosts, root_host, bytes);
} else if (op_name == "Barrier") {
SMPIExecutor::performBarrier(hosts);
} else {
Expand Down
19 changes: 10 additions & 9 deletions src/wrench/communicator/SMPIExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace wrench {
* @brief Constructor
* @param data_size: number of data_size to send/recv
*/
explicit MPI_Alltoall_participant(int data_size) : data_size(data_size) {}
explicit MPI_Alltoall_participant(const int data_size) : data_size(data_size) {}

/**
* @brief The actor's main method
Expand All @@ -46,10 +46,10 @@ namespace wrench {
* @param hosts: list of hosts
* @param data_size: size in data_size of each message sent/received
*/
void SMPIExecutor::performAlltoall(std::vector<simgrid::s4u::Host *> &hosts,
int data_size) {
void SMPIExecutor::performAlltoall(const std::vector<simgrid::s4u::Host *> &hosts,
const int data_size) {
// Start actors to do an MPI_AllToAll
std::string instance_id = "MPI_AllToAll_" + std::to_string(simgrid::s4u::this_actor::get_pid());
const std::string instance_id = "MPI_AllToAll_" + std::to_string(simgrid::s4u::this_actor::get_pid());
SMPI_app_instance_start(instance_id.c_str(),
MPI_Alltoall_participant(data_size),
hosts);
Expand All @@ -70,7 +70,8 @@ namespace wrench {
/**
* @brief The actor's main method
*/
void operator()() {
void operator()() const
{

MPI_Init();
MPI_Barrier(MPI_COMM_WORLD);
Expand All @@ -83,7 +84,7 @@ namespace wrench {
* @brief Method to perform an SMPI Barrier
* @param hosts: list of hosts
*/
void SMPIExecutor::performBarrier(std::vector<simgrid::s4u::Host *> &hosts) {
void SMPIExecutor::performBarrier(const std::vector<simgrid::s4u::Host *> &hosts) {
std::string instance_id = "MPI_Barrier_" + std::to_string(simgrid::s4u::this_actor::get_pid());
// Start actors to do an MPI_AllToAll
SMPI_app_instance_start(instance_id.c_str(),
Expand All @@ -102,7 +103,7 @@ namespace wrench {
* @brief Constructor
* @param data_size: number of data_size to send/recv
*/
explicit MPI_Bcast_participant(int data_size) : data_size(data_size) {}
explicit MPI_Bcast_participant(const int data_size) : data_size(data_size) {}

/**
* @brief The actor's main method
Expand All @@ -127,8 +128,8 @@ namespace wrench {
* @param data_size: size in data_size of each message sent/received
*/
void SMPIExecutor::performBcast(std::vector<simgrid::s4u::Host *> &hosts,
simgrid::s4u::Host *root_host,
int data_size) {
const simgrid::s4u::Host *root_host,
const int data_size) {

// Make sure that the root_host is the first host in the list of hosts, so that it's always rank 0
auto it = std::find(hosts.begin(), hosts.end(), root_host);
Expand Down
1 change: 0 additions & 1 deletion src/wrench/failure_causes/HostError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <wrench/failure_causes/HostError.h>

#include <wrench/logging/TerminalOutput.h>
#include <wrench/failure_causes/FailureCause.h>

#include <utility>

Expand Down
2 changes: 0 additions & 2 deletions src/wrench/failure_causes/InvalidDirectoryPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include <wrench/logging/TerminalOutput.h>
#include <wrench/failure_causes/FailureCause.h>
#include <wrench/data_file/DataFile.h>
#include <wrench/job/Job.h>
#include <wrench/services/storage/StorageService.h>
#include <wrench/services/compute/ComputeService.h>

Expand Down
2 changes: 0 additions & 2 deletions src/wrench/failure_causes/JobKilled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
#include <wrench/failure_causes/JobKilled.h>

#include <wrench/logging/TerminalOutput.h>
#include <wrench/data_file/DataFile.h>
#include <wrench/job/Job.h>
#include <wrench/services/storage/StorageService.h>
#include <wrench/services/Service.h>

#include <utility>

Expand Down
2 changes: 0 additions & 2 deletions src/wrench/failure_causes/NetworkError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <wrench/failure_causes/NetworkError.h>

#include <wrench/logging/TerminalOutput.h>
#include <wrench/data_file/DataFile.h>
#include <wrench/job/Job.h>
#include <wrench/services/compute/ComputeService.h>

WRENCH_LOG_CATEGORY(wrench_core_network_error, "Log category for NetworkError");
Expand Down
2 changes: 0 additions & 2 deletions src/wrench/failure_causes/StorageServiceNotEnoughSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

#include <wrench/logging/TerminalOutput.h>
#include <wrench/data_file/DataFile.h>
#include <wrench/job/Job.h>
#include <wrench/services/storage/StorageService.h>
#include <wrench/services/compute/ComputeService.h>
#include <wrench/failure_causes/StorageServiceNotEnoughSpace.h>

#include <utility>
Expand Down
Loading

0 comments on commit 6aeb953

Please sign in to comment.