-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
2,758 additions
and
2,514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#include <thread> | ||
#include <future> | ||
#include <chrono> | ||
#include <future> | ||
#include <thread> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
// Copyright 2023 Nesterov Alexander | ||
#include <mpi.h> | ||
|
||
#include <iostream> | ||
|
||
int main(int argc, char** argv) { | ||
MPI_Init(&argc, &argv); | ||
MPI_Init(&argc, &argv); | ||
|
||
int world_size; | ||
MPI_Comm_size(MPI_COMM_WORLD, &world_size); | ||
int world_size; | ||
MPI_Comm_size(MPI_COMM_WORLD, &world_size); | ||
|
||
int world_rank; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); | ||
int world_rank; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); | ||
|
||
char processor_name[MPI_MAX_PROCESSOR_NAME]; | ||
int len_chars; | ||
MPI_Get_processor_name(processor_name, &len_chars); | ||
char processor_name[MPI_MAX_PROCESSOR_NAME]; | ||
int len_chars; | ||
MPI_Get_processor_name(processor_name, &len_chars); | ||
|
||
MPI_Barrier(MPI_COMM_WORLD); | ||
std::cout << "Processor = " << processor_name << std::endl; | ||
std::cout << "Rank = " << world_rank << std::endl; | ||
std::cout << "Number of processors = " << world_size << std::endl; | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
std::cout << "Processor = " << processor_name << std::endl; | ||
std::cout << "Rank = " << world_rank << std::endl; | ||
std::cout << "Number of processors = " << world_size << std::endl; | ||
|
||
MPI_Finalize(); | ||
return 0; | ||
MPI_Finalize(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
// Copyright 2023 Nesterov Alexander | ||
#include <mpi.h> | ||
#include <string> | ||
#include <iostream> | ||
#include <boost/mpi/environment.hpp> | ||
|
||
#include <boost/mpi/communicator.hpp> | ||
#include <boost/mpi/environment.hpp> | ||
#include <iostream> | ||
#include <string> | ||
|
||
// https://www.boost.org/doc/libs/1_68_0/doc/html/mpi/tutorial.html | ||
int main(int argc, char** argv) { | ||
boost::mpi::environment env(argc, argv); | ||
boost::mpi::communicator world; | ||
boost::mpi::environment env(argc, argv); | ||
boost::mpi::communicator world; | ||
|
||
world.barrier(); | ||
std::cout << "Processor = " << boost::mpi::environment::processor_name() << std::endl; | ||
std::cout << "Rank = " << world.rank() << std::endl; | ||
std::cout << "Number of processors = " << world.size() << std::endl; | ||
world.barrier(); | ||
std::cout << "Processor = " << boost::mpi::environment::processor_name() | ||
<< std::endl; | ||
std::cout << "Rank = " << world.rank() << std::endl; | ||
std::cout << "Number of processors = " << world.size() << std::endl; | ||
|
||
return 0; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,52 @@ | ||
// Copyright 2023 Nesterov Alexander | ||
#include <utility> | ||
#include <iostream> | ||
#include "core/include/perf.hpp" | ||
|
||
#include <iostream> | ||
#include <utility> | ||
|
||
#include "unapproved/unapproved.h" | ||
|
||
ppc::core::Perf::Perf(std::shared_ptr<Task> task_) { | ||
set_task(std::move(task_)); | ||
set_task(std::move(task_)); | ||
} | ||
|
||
void ppc::core::Perf::set_task(std::shared_ptr<Task> task_) { | ||
task = std::move(task_); | ||
task = std::move(task_); | ||
} | ||
|
||
void ppc::core::Perf::pipeline_run(std::shared_ptr<PerfAttr> perfAttr, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
common_run(std::move(perfAttr), [&]() { | ||
void ppc::core::Perf::pipeline_run( | ||
std::shared_ptr<PerfAttr> perfAttr, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
common_run( | ||
std::move(perfAttr), | ||
[&]() { | ||
task->validation(); | ||
task->pre_processing(); | ||
task->run(); | ||
task->post_processing(); | ||
}, std::move(perfResults)); | ||
}, | ||
std::move(perfResults)); | ||
} | ||
|
||
void ppc::core::Perf::task_run(std::shared_ptr<PerfAttr> perfAttr, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
task->validation(); | ||
task->pre_processing(); | ||
common_run(std::move(perfAttr), [&]() { | ||
task->run(); | ||
}, std::move(perfResults)); | ||
task->post_processing(); | ||
void ppc::core::Perf::task_run( | ||
std::shared_ptr<PerfAttr> perfAttr, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
task->validation(); | ||
task->pre_processing(); | ||
common_run( | ||
std::move(perfAttr), [&]() { task->run(); }, std::move(perfResults)); | ||
task->post_processing(); | ||
} | ||
|
||
void ppc::core::Perf::common_run(std::shared_ptr<PerfAttr> perfAttr, std::function<void()> pipeline, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
auto begin = std::chrono::high_resolution_clock::now(); | ||
for (int i = 0; i < perfAttr->num_running; i++) { | ||
pipeline(); | ||
} | ||
auto end = std::chrono::high_resolution_clock::now(); | ||
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count(); | ||
perfResults->time_sec = duration * 1e-9; | ||
void ppc::core::Perf::common_run( | ||
std::shared_ptr<PerfAttr> perfAttr, std::function<void()> pipeline, | ||
std::shared_ptr<ppc::core::PerfResults> perfResults) { | ||
auto begin = std::chrono::high_resolution_clock::now(); | ||
for (int i = 0; i < perfAttr->num_running; i++) { | ||
pipeline(); | ||
} | ||
auto end = std::chrono::high_resolution_clock::now(); | ||
auto duration = | ||
std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count(); | ||
perfResults->time_sec = duration * 1e-9; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
// Copyright 2023 Nesterov Alexander | ||
#include "core/include/task.hpp" | ||
#include <utility> | ||
|
||
#include <stdexcept> | ||
#include <utility> | ||
|
||
void ppc::core::Task::set_data(std::shared_ptr<TaskData> taskData_) { | ||
functions_order.clear(); | ||
taskData = std::move(taskData_); | ||
functions_order.clear(); | ||
taskData = std::move(taskData_); | ||
} | ||
|
||
std::shared_ptr<ppc::core::TaskData> ppc::core::Task::get_data() const { | ||
return taskData; | ||
return taskData; | ||
} | ||
|
||
ppc::core::Task::Task(std::shared_ptr<TaskData> taskData_) { | ||
set_data(std::move(taskData_)); | ||
set_data(std::move(taskData_)); | ||
} | ||
|
||
void ppc::core::Task::internal_order_test(const std::string& str) { | ||
if (!functions_order.empty() && str == functions_order.back() && str == "run") | ||
return; | ||
void ppc::core::Task::internal_order_test(const std::string& str) { | ||
if (!functions_order.empty() && str == functions_order.back() && str == "run") | ||
return; | ||
|
||
functions_order.push_back(str); | ||
functions_order.push_back(str); | ||
|
||
for (auto i = 0; i < functions_order.size(); i++) { | ||
if (functions_order[i] != right_functions_order[i % right_functions_order.size()]) { | ||
throw std::invalid_argument("ORDER OF FUCTIONS IS NOT RIGHT: \n" + | ||
std::string("Serial number: ") + std::to_string(i + 1) + "\n" + | ||
std::string("Yours function: ") + functions_order[i] + "\n" + | ||
std::string("Expected function: ") + right_functions_order[i]); | ||
} | ||
for (auto i = 0; i < functions_order.size(); i++) { | ||
if (functions_order[i] != | ||
right_functions_order[i % right_functions_order.size()]) { | ||
throw std::invalid_argument( | ||
"ORDER OF FUCTIONS IS NOT RIGHT: \n" + | ||
std::string("Serial number: ") + std::to_string(i + 1) + "\n" + | ||
std::string("Yours function: ") + functions_order[i] + "\n" + | ||
std::string("Expected function: ") + right_functions_order[i]); | ||
} | ||
} | ||
} | ||
|
||
ppc::core::Task::~Task() { | ||
functions_order.clear(); | ||
} | ||
ppc::core::Task::~Task() { functions_order.clear(); } |
Oops, something went wrong.