Skip to content

Commit

Permalink
double removal
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 16, 2024
1 parent f3cf3cf commit 7c74307
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


#include <cmath>
#include <utility>
#include <utility>

#include <gtest/gtest.h>

Expand Down Expand Up @@ -42,33 +44,33 @@ class SimpleStorageServicePerformanceTest : public ::testing::Test {
sg_size_t buffer_size) {
double expected_elapsed = 0;
if (buffer_size >= total_size) {
return (total_size / bw_stage1) + (total_size / bw_stage2);
return ((double)total_size / bw_stage1) + ((double)total_size / bw_stage2);
} else {
double bottleneck_bandwidth = std::min<double>(bw_stage1, bw_stage2);
double num_full_buffers = std::floor(total_size / buffer_size);
return buffer_size / bw_stage1 +
return (double)buffer_size / bw_stage1 +
(num_full_buffers - 1) * (buffer_size / bottleneck_bandwidth) +
buffer_size / bw_stage2 +
(total_size - num_full_buffers * buffer_size) / bw_stage2;
((double)total_size - num_full_buffers * buffer_size) / bw_stage2;
}
}

static double computeExpectedThreeStagePipelineTime(double bw_stage1, double bw_stage2, double bw_stage3,
sg_size_t total_size, sg_size_t buffer_size) {
double expected_elapsed = 0;
if (buffer_size >= total_size) {
return (total_size / bw_stage1) + (total_size / bw_stage2) + (total_size / bw_stage3);
return ((double)total_size / bw_stage1) + ((double)total_size / bw_stage2) + ((double)total_size / bw_stage3);
} else {
double bottleneck_bandwidth = std::min<double>(std::min<double>(bw_stage1, bw_stage2), bw_stage3);
double num_full_buffers = std::floor(total_size / buffer_size);
double last_nonfull_buffer_size = total_size - num_full_buffers * buffer_size;
double last_nonfull_buffer_size = total_size - num_full_buffers * (double)buffer_size;

return buffer_size / bw_stage1 +
buffer_size / std::min<double>(bw_stage1, bw_stage2) +
(num_full_buffers - 2) * (buffer_size / bottleneck_bandwidth) +
return (double)buffer_size / bw_stage1 +
(double)buffer_size / std::min<double>(bw_stage1, bw_stage2) +
(num_full_buffers - 2) * ((double)buffer_size / bottleneck_bandwidth) +
std::max<double>(last_nonfull_buffer_size / bw_stage1,
buffer_size / std::min<double>(bw_stage2, bw_stage3)) +
std::max<double>(last_nonfull_buffer_size / bw_stage2, buffer_size / bw_stage3) +
(double)buffer_size / std::min<double>(bw_stage2, bw_stage3)) +
std::max<double>(last_nonfull_buffer_size / bw_stage2, (double)buffer_size / bw_stage3) +
last_nonfull_buffer_size / bw_stage3;
}
}
Expand Down Expand Up @@ -151,7 +153,7 @@ class SimpleStorageServiceConcurrentFileCopiesTestWMS : public wrench::Execution

public:
SimpleStorageServiceConcurrentFileCopiesTestWMS(SimpleStorageServicePerformanceTest *test,
std::string hostname,
const std::string& hostname,
sg_size_t buffer_size) : wrench::ExecutionController(hostname, "test"), test(test), buffer_size(buffer_size) {
}

Expand Down Expand Up @@ -278,7 +280,7 @@ void SimpleStorageServicePerformanceTest::do_ConcurrentFileCopies_test(sg_size_t
{{wrench::StorageServiceProperty::BUFFER_SIZE, std::to_string(buffer_size)}})));

// Create a WMS
std::shared_ptr<wrench::ExecutionController> wms = nullptr;
std::shared_ptr<wrench::ExecutionController> wms;
ASSERT_NO_THROW(wms = simulation->add(
new SimpleStorageServiceConcurrentFileCopiesTestWMS(
this, "WMSHost", buffer_size)));
Expand Down Expand Up @@ -310,7 +312,7 @@ class SimpleStorageServiceFileReadTestWMS : public wrench::ExecutionController {
public:
SimpleStorageServiceFileReadTestWMS(SimpleStorageServicePerformanceTest *test,
std::shared_ptr<wrench::FileRegistryService> file_registry_service,
const std::string& hostname, sg_size_t buffer_size) : wrench::ExecutionController(hostname, "test"), test(test), file_registry_service(file_registry_service), buffer_size(buffer_size) {
const std::string& hostname, sg_size_t buffer_size) : wrench::ExecutionController(hostname, "test"), test(test), file_registry_service(std::move(std::move(file_registry_service))), buffer_size(buffer_size) {
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class SimulationTimestampFileReadTest : public ::testing::Test {

workflow = wrench::Workflow::createWorkflow();

file_1 = wrench::Simulation::addFile("file_1", 100.0);
file_2 = wrench::Simulation::addFile("file_2", 100.0);
file_3 = wrench::Simulation::addFile("file_3", 100.0);
file_1 = wrench::Simulation::addFile("file_1", 100);
file_2 = wrench::Simulation::addFile("file_2", 100);
file_3 = wrench::Simulation::addFile("file_3", 100);

xl_file = wrench::Simulation::addFile("xl_file", 1000000000.0);
xl_file = wrench::Simulation::addFile("xl_file", 1000000000);
}

std::string platform_file_path = UNIQUE_TMP_PATH_PREFIX + "platform.xml";
Expand Down Expand Up @@ -165,7 +165,6 @@ void SimulationTimestampFileReadTest::do_SimulationTimestampFileReadBasic_test()
ASSERT_NO_THROW(storage_service = simulation->add(wrench::SimpleStorageService::createSimpleStorageService(host1, {"/"},
{{wrench::SimpleStorageServiceProperty::BUFFER_SIZE, "infinity"}})));

std::shared_ptr<wrench::FileRegistryService> file_registry_service = nullptr;
ASSERT_NO_THROW(file_registry_service = simulation->add(new wrench::FileRegistryService(host1)));

std::shared_ptr<wrench::ExecutionController> wms = nullptr;
Expand Down

0 comments on commit 7c74307

Please sign in to comment.