Commit 737f7e54 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch '88-alya-create-a-new-data-distributor' of...

Merge branch '88-alya-create-a-new-data-distributor' of https://storage.bsc.es/gitlab/hpc/gekkofs into 88-alya-create-a-new-data-distributor
parents 944a50e1 db0919c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ mark_as_advanced(CLIENT_LOG_MESSAGE_SIZE)
option(GKFS_USE_GUIDED_DISTRIBUTION "Use guided data distributor " OFF)
message(STATUS "[gekkofs] Guided data distributor: ${GKFS_USE_GUIDED_DISTRIBUTION}")

set(GKFS_USE_GUIDED_DISTRIBUTION_PATH "guided.txt" CACHE STRING "File Path for guided distributor")
set(GKFS_USE_GUIDED_DISTRIBUTION_PATH "/tmp/guided.txt" CACHE STRING "File Path for guided distributor")
set_property(CACHE GKFS_USE_GUIDED_DISTRIBUTION_PATH PROPERTY STRINGS)
message(STATUS "[gekkofs] Guided data distributor input file path: ${GKFS_USE_GUIDED_DISTRIBUTION_PATH}")

+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ if check_dependency "ofi" "${DEP_CONFIG[@]}"; then
        cd ${CURR}
        ./autogen.sh
        cd ${CURR}/build
        OFI_CONFIG="../configure --prefix=${INSTALL} --enable-tcp=yes --enable-efa=no"
        OFI_CONFIG="../configure --prefix=${INSTALL} --enable-tcp=yes"
        if check_dependency "verbs" "${DEP_CONFIG[@]}"; then
            OFI_CONFIG="${OFI_CONFIG} --enable-verbs=yes"
        elif check_dependency "psm2" "${DEP_CONFIG[@]}"; then
+4 −2
Original line number Diff line number Diff line
@@ -34,11 +34,13 @@ target_link_libraries(catch2_main
add_executable(tests
    test_example_00.cpp
    test_example_01.cpp
    test_guided_distributor.cpp
)

target_link_libraries(tests
    catch2_main
    fmt::fmt
    distributor
)

# Catch2's contrib folder includes some helper functions
+60 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2020, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2020, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  SPDX-License-Identifier: MIT
*/

#include <catch2/catch.hpp>
#include <fmt/format.h>
#include <global/rpc/distributor.hpp>
#include <fstream>

TEST_CASE( "Guided distributor Testing", "[Distributor]" ) {

    GIVEN( "A distributor" ) {

        std::ofstream o;
        o.open("/tmp/guided.txt");
        o << "/t.c01 0 3" << std::endl;
        o << "/t.c02 0 3" << std::endl;
        o << "/t.c01 1 3" << std::endl;
        o << "/t.c02 1 3" << std::endl;
        o << "/t.c01 2 3" << std::endl;
        o << "/t.c02 2 3" << std::endl;
        o << "/t.c03 1 3" << std::endl;
        o << "/t.c04 1 3" << std::endl;
        o << "/t.c05 1 3" << std::endl;
        o << "/t.c06 1 3" << std::endl;
        o << "/t.c07 1 3" << std::endl;
        o.close();

        auto d = gkfs::rpc::GuidedDistributor();

        REQUIRE( d.locate_data("/t.c01",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c02",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c03",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c04",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c05",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c06",1,10) == 3 );
        REQUIRE( d.locate_data("/t.c07",1,10) == 3 );

        // Next result is random ?
        REQUIRE ( (d.locate_data("/t.c01",5,10) +
                  d.locate_data("/t.c02",5,10) +
                  d.locate_data("/t.c03",5,10) +
                  d.locate_data("/t.c04",5,10) +
                  d.locate_data("/t.c05",5,10) +
                  d.locate_data("/t.c06",5,10) +
                  d.locate_data("/t.c07",5,10) ) == 42);



    }
}