Loading CMakeLists.txt +16 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ cmake_minimum_required(VERSION 3.14) project( scord VERSION 0.1.0 LANGUAGES CXX LANGUAGES C CXX ) # Set default build type and also populate a list of available options Loading Loading @@ -209,6 +209,21 @@ FetchContent_Declare( FetchContent_MakeAvailable(genopts) ### expected: required for using tl::expected in the C++ library implementation ### until std::expected makes it to C++ message(STATUS "[${PROJECT_NAME}] Downloading and building tl::expected") set(EXPECTED_BUILD_PACKAGE OFF) set(EXPECTED_BUILD_TESTS OFF) FetchContent_Declare( expected GIT_REPOSITORY https://github.com/TartanLlama/expected GIT_TAG 96d547c03d2feab8db64c53c3744a9b4a7c8f2c5 # latest GIT_SHALLOW ON GIT_PROGRESS ON ) FetchContent_MakeAvailable(expected) ### Mark any CMake variables imported from {fmt} and spdlog as advanced, so ### that they don't appear in cmake-gui or ccmake. Similarly for FETCHCONTENT Loading examples/CMakeLists.txt +3 −18 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 @@ -22,20 +22,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ list(APPEND examples ping ADM_register_job ADM_update_job ADM_remove_job ADM_register_adhoc_storage ADM_update_adhoc_storage ADM_remove_adhoc_storage ADM_deploy_adhoc_storage ADM_in_situ_ops ADM_in_transit_ops ADM_transfer_dataset ADM_set_dataset_information ADM_set_io_resources ADM_get_transfer_priority ADM_set_transfer_priority ADM_cancel_transfer ADM_get_pending_transfers 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) foreach (example IN LISTS examples) add_executable(${example}) target_sources(${example} PRIVATE ${example}.cpp) target_link_libraries(${example} PUBLIC network_engine fmt::fmt adm_iosched) endforeach() add_subdirectory(c) add_subdirectory(cxx) examples/c/ADM_register_job.c 0 → 100644 +68 −0 Original line number Diff line number Diff line #include <stdlib.h> #include <stdio.h> #include <admire.h> #define NINPUTS 10 #define NOUTPUTS 5 int main(int argc, char* argv[]) { if(argc != 3) { fprintf(stderr, "ERROR: no location provided\n"); fprintf(stderr, "Usage: ADM_register_job <REMOTE_IP> <JOB_REQS>\n"); exit(EXIT_FAILURE); } int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); ADM_job_t job; ADM_dataset_handle_t inputs[NINPUTS]; for(int i = 0; i < NINPUTS; ++i) { const char* pattern = "input-dataset-%d"; size_t n = snprintf(NULL, 0, pattern, i); char* id = (char*) malloc(n + 1); snprintf(id, n, pattern, i); inputs[i] = ADM_dataset_create(id); } ADM_dataset_handle_t outputs[NOUTPUTS]; for(int i = 0; i < NOUTPUTS; ++i) { const char* pattern = "output-dataset-%d"; size_t n = snprintf(NULL, 0, pattern, i); char* id = (char*) malloc(n + 1); snprintf(id, n, pattern, i); outputs[i] = ADM_dataset_create(id); } ADM_job_requirements_t reqs = ADM_job_requirements_create( inputs, NINPUTS, outputs, NOUTPUTS, NULL); ADM_return_t ret = ADM_register_job(server, reqs, &job); if(ret != ADM_SUCCESS) { fprintf(stdout, "ADM_register_job() remote procedure not completed " "successfully\n"); exit_status = EXIT_FAILURE; goto cleanup; } fprintf(stdout, "ADM_register_job() remote procedure completed " "successfully\n"); cleanup: for(int i = 0; i < NINPUTS; ++i) { ADM_dataset_destroy(inputs[i]); } for(int i = 0; i < NOUTPUTS; ++i) { ADM_dataset_destroy(outputs[i]); } ADM_server_destroy(server); exit(exit_status); } examples/c/CMakeLists.txt 0 → 100644 +32 −0 Original line number Diff line number Diff line ################################################################################ # 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). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ list(APPEND examples_c ADM_register_job) foreach(example IN LISTS examples_c) add_executable(${example}_c) target_sources(${example}_c PRIVATE ${example}.c) target_link_libraries(${example}_c PUBLIC adm_iosched) set_target_properties(${example}_c PROPERTIES OUTPUT_NAME ${example}) endforeach() examples/ADM_cancel_transfer.cpp→examples/cxx/ADM_cancel_transfer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; ADM_job_handle_t job{}; ADM_job_t job{}; ADM_transfer_handle_t tx_handle{}; ADM_return_t ret = ADM_SUCCESS; Loading Loading
CMakeLists.txt +16 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ cmake_minimum_required(VERSION 3.14) project( scord VERSION 0.1.0 LANGUAGES CXX LANGUAGES C CXX ) # Set default build type and also populate a list of available options Loading Loading @@ -209,6 +209,21 @@ FetchContent_Declare( FetchContent_MakeAvailable(genopts) ### expected: required for using tl::expected in the C++ library implementation ### until std::expected makes it to C++ message(STATUS "[${PROJECT_NAME}] Downloading and building tl::expected") set(EXPECTED_BUILD_PACKAGE OFF) set(EXPECTED_BUILD_TESTS OFF) FetchContent_Declare( expected GIT_REPOSITORY https://github.com/TartanLlama/expected GIT_TAG 96d547c03d2feab8db64c53c3744a9b4a7c8f2c5 # latest GIT_SHALLOW ON GIT_PROGRESS ON ) FetchContent_MakeAvailable(expected) ### Mark any CMake variables imported from {fmt} and spdlog as advanced, so ### that they don't appear in cmake-gui or ccmake. Similarly for FETCHCONTENT Loading
examples/CMakeLists.txt +3 −18 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 @@ -22,20 +22,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ list(APPEND examples ping ADM_register_job ADM_update_job ADM_remove_job ADM_register_adhoc_storage ADM_update_adhoc_storage ADM_remove_adhoc_storage ADM_deploy_adhoc_storage ADM_in_situ_ops ADM_in_transit_ops ADM_transfer_dataset ADM_set_dataset_information ADM_set_io_resources ADM_get_transfer_priority ADM_set_transfer_priority ADM_cancel_transfer ADM_get_pending_transfers 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) foreach (example IN LISTS examples) add_executable(${example}) target_sources(${example} PRIVATE ${example}.cpp) target_link_libraries(${example} PUBLIC network_engine fmt::fmt adm_iosched) endforeach() add_subdirectory(c) add_subdirectory(cxx)
examples/c/ADM_register_job.c 0 → 100644 +68 −0 Original line number Diff line number Diff line #include <stdlib.h> #include <stdio.h> #include <admire.h> #define NINPUTS 10 #define NOUTPUTS 5 int main(int argc, char* argv[]) { if(argc != 3) { fprintf(stderr, "ERROR: no location provided\n"); fprintf(stderr, "Usage: ADM_register_job <REMOTE_IP> <JOB_REQS>\n"); exit(EXIT_FAILURE); } int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); ADM_job_t job; ADM_dataset_handle_t inputs[NINPUTS]; for(int i = 0; i < NINPUTS; ++i) { const char* pattern = "input-dataset-%d"; size_t n = snprintf(NULL, 0, pattern, i); char* id = (char*) malloc(n + 1); snprintf(id, n, pattern, i); inputs[i] = ADM_dataset_create(id); } ADM_dataset_handle_t outputs[NOUTPUTS]; for(int i = 0; i < NOUTPUTS; ++i) { const char* pattern = "output-dataset-%d"; size_t n = snprintf(NULL, 0, pattern, i); char* id = (char*) malloc(n + 1); snprintf(id, n, pattern, i); outputs[i] = ADM_dataset_create(id); } ADM_job_requirements_t reqs = ADM_job_requirements_create( inputs, NINPUTS, outputs, NOUTPUTS, NULL); ADM_return_t ret = ADM_register_job(server, reqs, &job); if(ret != ADM_SUCCESS) { fprintf(stdout, "ADM_register_job() remote procedure not completed " "successfully\n"); exit_status = EXIT_FAILURE; goto cleanup; } fprintf(stdout, "ADM_register_job() remote procedure completed " "successfully\n"); cleanup: for(int i = 0; i < NINPUTS; ++i) { ADM_dataset_destroy(inputs[i]); } for(int i = 0; i < NOUTPUTS; ++i) { ADM_dataset_destroy(outputs[i]); } ADM_server_destroy(server); exit(exit_status); }
examples/c/CMakeLists.txt 0 → 100644 +32 −0 Original line number Diff line number Diff line ################################################################################ # 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). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ list(APPEND examples_c ADM_register_job) foreach(example IN LISTS examples_c) add_executable(${example}_c) target_sources(${example}_c PRIVATE ${example}.c) target_link_libraries(${example}_c PUBLIC adm_iosched) set_target_properties(${example}_c PROPERTIES OUTPUT_NAME ${example}) endforeach()
examples/ADM_cancel_transfer.cpp→examples/cxx/ADM_cancel_transfer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; ADM_job_handle_t job{}; ADM_job_t job{}; ADM_transfer_handle_t tx_handle{}; ADM_return_t ret = ADM_SUCCESS; Loading