Skip to content

Commit

Permalink
Merge branch 'master' into daemonize
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Mar 3, 2018
2 parents 96d3644 + 5883543 commit c85f23f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ And, one of the following:
- [Google Test](https://github.com/google/googletest) - version 1.8 or higher (only required for running test cases)
- [Doxygen](http://www.doxygen.org) - version 1.8 or higher (only required for generating documentation)

- [Batsched](https://gitlab.inria.fr/batsim/batsched) -- only needed for batch-scheduled resource simulation
- [Batsched](https://gitlab.inria.fr/batsim/batsched) - only needed for batch-scheduled resource simulation


## Building From Source
Expand Down
4 changes: 2 additions & 2 deletions examples/simple-wms/SimpleWMSCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ int main(int argc, char **argv) {
std::string hostname_copy(hostname_list[0]);
wrench::NetworkProximityService *NPS = new wrench::NetworkProximityService(hostname_copy, hostname_list_copy, {
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_SERVICE_TYPE, "alltoall"},
{wrench::NetworkProximityServiceProperty::NETWORK_DAEMON_COMMUNICATION_COVERAGE, "0.4"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD, "0"},
{wrench::NetworkProximityServiceProperty::NETWORK_DAEMON_COMMUNICATION_COVERAGE, "1.0"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD, "10"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD_MAX_NOISE, "10"}});

simulation.add(std::unique_ptr<wrench::NetworkProximityService>(NPS));
Expand Down
51 changes: 18 additions & 33 deletions src/wrench/services/compute/cloud/CloudService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace wrench {
* @param default_storage_service: a storage service (or nullptr)
* @param plist: a property list ({} means "use all defaults")
*
* @throw std::invalid_argument
* @throw std::runtime_error
*/
CloudService::CloudService(const std::string &hostname,
bool supports_standard_jobs,
Expand Down Expand Up @@ -245,7 +245,6 @@ namespace wrench {
}
}


/**
* @brief Terminate a standard job to the compute service (virtual)
* @param job: the job
Expand Down Expand Up @@ -593,50 +592,38 @@ namespace wrench {

// Num hosts
std::vector<double> num_hosts;
num_hosts.push_back((double)(this->vm_list.size()));
num_hosts.push_back((double) (this->vm_list.size()));
dict.insert(std::make_pair("num_hosts", num_hosts));

// Num cores per vm
std::vector<double> num_cores;
std::vector<double> num_idle_cores;
std::vector<double> flop_rates;
std::vector<double> ram_capacities;
std::vector<double> ram_availabilities;

for (auto &vm : this->vm_list) {
// Num cores per vm
num_cores.push_back(std::get<2>(vm.second));
}

dict.insert(std::make_pair("num_cores", num_cores));

// Num idle cores per vm
std::vector<double> num_idle_cores;
for (auto &vm : this->vm_list) {
// Num idle cores per vm
std::vector<unsigned long> idle_core_counts = std::get<1>(vm.second)->getNumIdleCores();
num_idle_cores.push_back(std::accumulate(idle_core_counts.begin(), idle_core_counts.end(), 0));
}

dict.insert(std::make_pair("num_idle_cores", num_idle_cores));

// Flop rate per vm
std::vector<double> flop_rates;
for (auto &vm : this->vm_list) {
// TODO: This is calling a S4U thing directly, without going though our
// TODO: S4U_Simulation class (perhaps change later, but then the CloudService
// TODO: implementation will have to change since it uses the simgrid::s4u stuff
// TODO: directly
flop_rates.push_back((std::get<0>(vm.second))->getPstateSpeed(0));
}
dict.insert(std::make_pair("flop_rates", flop_rates));
// Flop rate per vm
flop_rates.push_back(S4U_Simulation::getFlopRate(std::get<0>(vm)));

// RAM capacity per host
std::vector<double> ram_capacities;
for (auto &vm : this->vm_list) {
// RAM capacity per host
ram_capacities.push_back(S4U_Simulation::getHostMemoryCapacity(std::get<0>(vm)));
}
dict.insert(std::make_pair("ram_capacities", ram_capacities));

// RAM availability per host
std::vector<double> ram_availabilities;
for (auto &vm : this->vm_list) {
// RAM availability per
ram_availabilities.push_back(
ComputeService::ALL_RAM); // TODO FOR RAFAEL : What about VM memory availabilities???
}

dict.insert(std::make_pair("num_cores", num_cores));
dict.insert(std::make_pair("num_idle_cores", num_idle_cores));
dict.insert(std::make_pair("flop_rates", flop_rates));
dict.insert(std::make_pair("ram_capacities", ram_capacities));
dict.insert(std::make_pair("ram_availabilities", ram_availabilities));

std::vector<double> ttl;
Expand Down Expand Up @@ -668,6 +655,4 @@ namespace wrench {
std::get<1>(vm.second)->stop();
}
}


}
2 changes: 1 addition & 1 deletion src/wrench/services/helpers/Alarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace wrench {
// Start the daemon on the same host
try {
WRENCH_INFO("Alarm Service starting...");
this->start_daemon(hostname, true);
this->start_daemon(hostname, true); // Daemonize
this->state = UP;
} catch (std::invalid_argument &e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ namespace wrench {
NetworkProximityServiceProperty::NETWORK_PROXIMITY_MESSAGE_SIZE));
}

if (this->getPropertyValueAsDouble(NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD) < 0) {
if (this->getPropertyValueAsDouble(NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD) <= 0) {
throw std::invalid_argument(error_prefix + "Invalid NETWORK_PROXIMITY_MEASUREMENT_PERIOD value " +
this->getPropertyValueAsString(
NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD));
Expand Down

0 comments on commit c85f23f

Please sign in to comment.