Verified Commit 97c7c5cd authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Add C examples

parent c8e06afa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+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).                       #
@@ -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)
+31 −0
Original line number Diff line number Diff line
#include <stdlib.h>
#include <stdio.h>
#include <admire.h>

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);
    }

#if 0
    ADM_server_t* server = ADM_server_create("tcp", argv[1]);

    ADM_job_handle_t job = ADM_job_handle_init();
    ADM_job_requirements_t reqs = ADM_job_requirements_init();
    ADM_dataset_info_t info = ADM_dataset_info_init();
    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(EXIT_FAILURE);
    }
#endif

    fprintf(stdout, "ADM_register_job() remote procedure completed "
                    "successfully\n");
}
+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()
Loading