Loading examples/cxx/ADM_register_job.cpp +4 −12 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain * Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain * * This software was partially supported by the EuroHPC-funded project ADMIRE * (Project ID: 956748, https://www.admire-eurohpc.eu). Loading @@ -24,6 +24,7 @@ #include <fmt/format.h> #include <admire.hpp> #include "common.hpp" #define NINPUTS 10 #define NOUTPUTS 5 Loading @@ -39,17 +40,8 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; std::vector<admire::dataset> inputs; inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { inputs.emplace_back(fmt::format("input-dataset-{}", i)); } std::vector<admire::dataset> outputs; outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { outputs.emplace_back(fmt::format("output-dataset-{}", i)); } const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); auto p = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading examples/cxx/ADM_update_job.cpp +9 −33 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain * Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain * * This software was partially supported by the EuroHPC-funded project ADMIRE * (Project ID: 956748, https://www.admire-eurohpc.eu). Loading @@ -24,6 +24,7 @@ #include <fmt/format.h> #include <admire.hpp> #include "common.hpp" #define NINPUTS 10 #define NOUTPUTS 5 Loading @@ -39,17 +40,8 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; std::vector<admire::dataset> inputs; inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { inputs.emplace_back(fmt::format("input-dataset-{}", i)); } std::vector<admire::dataset> outputs; outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { outputs.emplace_back(fmt::format("output-dataset-{}", i)); } const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); auto p = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading @@ -59,17 +51,9 @@ main(int argc, char* argv[]) { admire::job_requirements reqs{inputs, outputs, std::move(p)}; std::vector<admire::dataset> new_inputs; new_inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { new_inputs.emplace_back(fmt::format("input-new-dataset-{}", i)); } std::vector<admire::dataset> new_outputs; new_outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { new_outputs.emplace_back(fmt::format("output-new-dataset-{}", i)); } const auto new_inputs = prepare_datasets("input-new-dataset-{}", NINPUTS); const auto new_outputs = prepare_datasets("output-new-dataset-{}", NOUTPUTS); auto p2 = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading @@ -78,13 +62,11 @@ main(int argc, char* argv[]) { admire::job_requirements new_reqs{new_inputs, new_outputs, std::move(p2)}; ADM_return_t ret = ADM_SUCCESS; try { [[maybe_unused]] const auto job = admire::register_job(server, reqs); ret = admire::update_job(server, job, new_reqs); [[maybe_unused]] ADM_return_t ret = admire::update_job(server, job, new_reqs); fmt::print( stdout, Loading @@ -97,10 +79,4 @@ main(int argc, char* argv[]) { e.what()); exit(EXIT_FAILURE); } if(ret != ADM_SUCCESS) { fmt::print(stdout, "ADM_update_job() remote procedure not completed " "successfully\n"); exit(EXIT_FAILURE); } } examples/cxx/CMakeLists.txt +6 −2 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # Loading Loading @@ -37,11 +37,15 @@ list(APPEND examples_cxx ADM_set_qos_constraints ADM_get_qos_constraints ADM_define_data_operation ADM_connect_data_operation ADM_finalize_data_operation ADM_link_transfer_to_data_operation ADM_get_statistics) add_library(examples_common STATIC) target_sources(examples_common PUBLIC common.hpp PRIVATE common.cpp) target_link_libraries(examples_common common::api::types) foreach(example IN LISTS examples_cxx) add_executable(${example}_cxx) target_sources(${example}_cxx PRIVATE ${example}.cpp) target_link_libraries(${example}_cxx PUBLIC common::network::engine fmt::fmt adm_iosched) PUBLIC common::network::engine fmt::fmt adm_iosched examples_common) set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example}) endforeach() Loading examples/cxx/common.cpp 0 → 100644 +12 −0 Original line number Diff line number Diff line #include "common.hpp" std::vector<admire::dataset> prepare_datasets(const std::string& pattern, size_t n) { std::vector<admire::dataset> datasets; datasets.reserve(n); for(size_t i = 0; i < n; ++i) { datasets.emplace_back(fmt::format(pattern, i)); } return datasets; } examples/cxx/common.hpp 0 → 100644 +10 −0 Original line number Diff line number Diff line #ifndef SCORD_CXX_EXAMPLES_COMMON_HPP #define SCORD_CXX_EXAMPLES_COMMON_HPP #include <vector> #include <admire_types.hpp> std::vector<admire::dataset> prepare_datasets(const std::string& pattern, size_t n); #endif // SCORD_CXX_EXAMPLES_COMMON_HPP Loading
examples/cxx/ADM_register_job.cpp +4 −12 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain * Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain * * This software was partially supported by the EuroHPC-funded project ADMIRE * (Project ID: 956748, https://www.admire-eurohpc.eu). Loading @@ -24,6 +24,7 @@ #include <fmt/format.h> #include <admire.hpp> #include "common.hpp" #define NINPUTS 10 #define NOUTPUTS 5 Loading @@ -39,17 +40,8 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; std::vector<admire::dataset> inputs; inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { inputs.emplace_back(fmt::format("input-dataset-{}", i)); } std::vector<admire::dataset> outputs; outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { outputs.emplace_back(fmt::format("output-dataset-{}", i)); } const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); auto p = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading
examples/cxx/ADM_update_job.cpp +9 −33 Original line number Diff line number Diff line /****************************************************************************** * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain * Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain * * This software was partially supported by the EuroHPC-funded project ADMIRE * (Project ID: 956748, https://www.admire-eurohpc.eu). Loading @@ -24,6 +24,7 @@ #include <fmt/format.h> #include <admire.hpp> #include "common.hpp" #define NINPUTS 10 #define NOUTPUTS 5 Loading @@ -39,17 +40,8 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; std::vector<admire::dataset> inputs; inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { inputs.emplace_back(fmt::format("input-dataset-{}", i)); } std::vector<admire::dataset> outputs; outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { outputs.emplace_back(fmt::format("output-dataset-{}", i)); } const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); auto p = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading @@ -59,17 +51,9 @@ main(int argc, char* argv[]) { admire::job_requirements reqs{inputs, outputs, std::move(p)}; std::vector<admire::dataset> new_inputs; new_inputs.reserve(NINPUTS); for(int i = 0; i < NINPUTS; ++i) { new_inputs.emplace_back(fmt::format("input-new-dataset-{}", i)); } std::vector<admire::dataset> new_outputs; new_outputs.reserve(NOUTPUTS); for(int i = 0; i < NOUTPUTS; ++i) { new_outputs.emplace_back(fmt::format("output-new-dataset-{}", i)); } const auto new_inputs = prepare_datasets("input-new-dataset-{}", NINPUTS); const auto new_outputs = prepare_datasets("output-new-dataset-{}", NOUTPUTS); auto p2 = std::make_unique<admire::adhoc_storage>( admire::storage::type::gekkofs, "foobar", Loading @@ -78,13 +62,11 @@ main(int argc, char* argv[]) { admire::job_requirements new_reqs{new_inputs, new_outputs, std::move(p2)}; ADM_return_t ret = ADM_SUCCESS; try { [[maybe_unused]] const auto job = admire::register_job(server, reqs); ret = admire::update_job(server, job, new_reqs); [[maybe_unused]] ADM_return_t ret = admire::update_job(server, job, new_reqs); fmt::print( stdout, Loading @@ -97,10 +79,4 @@ main(int argc, char* argv[]) { e.what()); exit(EXIT_FAILURE); } if(ret != ADM_SUCCESS) { fmt::print(stdout, "ADM_update_job() remote procedure not completed " "successfully\n"); exit(EXIT_FAILURE); } }
examples/cxx/CMakeLists.txt +6 −2 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # Loading Loading @@ -37,11 +37,15 @@ list(APPEND examples_cxx ADM_set_qos_constraints ADM_get_qos_constraints ADM_define_data_operation ADM_connect_data_operation ADM_finalize_data_operation ADM_link_transfer_to_data_operation ADM_get_statistics) add_library(examples_common STATIC) target_sources(examples_common PUBLIC common.hpp PRIVATE common.cpp) target_link_libraries(examples_common common::api::types) foreach(example IN LISTS examples_cxx) add_executable(${example}_cxx) target_sources(${example}_cxx PRIVATE ${example}.cpp) target_link_libraries(${example}_cxx PUBLIC common::network::engine fmt::fmt adm_iosched) PUBLIC common::network::engine fmt::fmt adm_iosched examples_common) set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example}) endforeach() Loading
examples/cxx/common.cpp 0 → 100644 +12 −0 Original line number Diff line number Diff line #include "common.hpp" std::vector<admire::dataset> prepare_datasets(const std::string& pattern, size_t n) { std::vector<admire::dataset> datasets; datasets.reserve(n); for(size_t i = 0; i < n; ++i) { datasets.emplace_back(fmt::format(pattern, i)); } return datasets; }
examples/cxx/common.hpp 0 → 100644 +10 −0 Original line number Diff line number Diff line #ifndef SCORD_CXX_EXAMPLES_COMMON_HPP #define SCORD_CXX_EXAMPLES_COMMON_HPP #include <vector> #include <admire_types.hpp> std::vector<admire::dataset> prepare_datasets(const std::string& pattern, size_t n); #endif // SCORD_CXX_EXAMPLES_COMMON_HPP