Commits on Source (3)
...@@ -128,11 +128,6 @@ find_package(Abt REQUIRED) ...@@ -128,11 +128,6 @@ find_package(Abt REQUIRED)
find_package(Margo REQUIRED) find_package(Margo REQUIRED)
find_package(Syscall_intercept REQUIRED) find_package(Syscall_intercept REQUIRED)
# boost dependencies
find_package(Boost 1.53 REQUIRED
COMPONENTS
program_options
)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
...@@ -215,6 +210,7 @@ set_target_properties(spdlog ...@@ -215,6 +210,7 @@ set_target_properties(spdlog
add_subdirectory(external/fmt) add_subdirectory(external/fmt)
set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)
if (ENABLE_CLIENT_LOG) if (ENABLE_CLIENT_LOG)
option(HERMES_LOGGING "" ON) option(HERMES_LOGGING "" ON)
option(HERMES_LOGGING_FMT_USE_BUNDLED "" OFF) option(HERMES_LOGGING_FMT_USE_BUNDLED "" OFF)
...@@ -247,6 +243,7 @@ option(GKFS_BUILD_TESTS "Build GekkoFS self tests" OFF) ...@@ -247,6 +243,7 @@ option(GKFS_BUILD_TESTS "Build GekkoFS self tests" OFF)
include(CMakeDependentOption) include(CMakeDependentOption)
cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS_BUILD_TESTS" OFF) cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS_BUILD_TESTS" OFF)
if (GKFS_BUILD_TESTS) if (GKFS_BUILD_TESTS)
# check symbols exists doesn't work for statx. This is a workaround # check symbols exists doesn't work for statx. This is a workaround
check_cxx_source_compiles(" check_cxx_source_compiles("
......
This diff is collapsed.
...@@ -87,7 +87,6 @@ set(PRELOAD_LINK_LIBRARIES ...@@ -87,7 +87,6 @@ set(PRELOAD_LINK_LIBRARIES
mercury mercury
hermes hermes
fmt::fmt fmt::fmt
Boost::boost
Threads::Threads Threads::Threads
Date::TZ Date::TZ
) )
......
...@@ -74,10 +74,8 @@ set(DAEMON_LINK_LIBRARIES ...@@ -74,10 +74,8 @@ set(DAEMON_LINK_LIBRARIES
mercury mercury
${MARGO_LIBRARIES} ${MARGO_LIBRARIES}
# others # others
Boost::boost
Boost::program_options
Threads::Threads Threads::Threads
) )
set(DAEMON_INCLUDE_DIRS set(DAEMON_INCLUDE_DIRS
${ABT_INCLUDE_DIRS} ${ABT_INCLUDE_DIRS}
${MARGO_INCLUDE_DIRS} ${MARGO_INCLUDE_DIRS}
......
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
#include <daemon/backend/metadata/db.hpp> #include <daemon/backend/metadata/db.hpp>
#include <daemon/backend/data/chunk_storage.hpp> #include <daemon/backend/data/chunk_storage.hpp>
#include <daemon/util.hpp> #include <daemon/util.hpp>
#include <CLI/CLI11.hpp>
#ifdef GKFS_ENABLE_AGIOS #ifdef GKFS_ENABLE_AGIOS
#include <daemon/scheduler/agios.hpp> #include <daemon/scheduler/agios.hpp>
#endif #endif
#include <boost/program_options.hpp>
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
...@@ -57,7 +57,6 @@ extern "C" { ...@@ -57,7 +57,6 @@ extern "C" {
} }
using namespace std; using namespace std;
namespace po = boost::program_options;
namespace fs = std::filesystem; namespace fs = std::filesystem;
static condition_variable shutdown_please; static condition_variable shutdown_please;
...@@ -371,16 +370,27 @@ initialize_loggers() { ...@@ -371,16 +370,27 @@ initialize_loggers() {
gkfs::log::setup(logger_names, level, path); gkfs::log::setup(logger_names, level, path);
} }
struct read_options {
string mountdir;
string rootdir;
string metadir;
string listen;
string hosts_file;
string rpc_protocol;
};
/** /**
* *
* @param vm * @param vm
* @throws runtime_error * @throws runtime_error
*/ */
void void
parse_input(const po::variables_map& vm) { parse_input(const read_options& opts, const CLI::App& desc) {
auto rpc_protocol = string(gkfs::rpc::protocol::ofi_sockets); auto rpc_protocol = string(gkfs::rpc::protocol::ofi_sockets);
if(vm.count("rpc-protocol")) { if(desc.count("--rpc-protocol")) {
rpc_protocol = vm["rpc-protocol"].as<string>(); rpc_protocol = opts.rpc_protocol;
if(rpc_protocol != gkfs::rpc::protocol::ofi_verbs && if(rpc_protocol != gkfs::rpc::protocol::ofi_verbs &&
rpc_protocol != gkfs::rpc::protocol::ofi_sockets && rpc_protocol != gkfs::rpc::protocol::ofi_sockets &&
rpc_protocol != gkfs::rpc::protocol::ofi_psm2) { rpc_protocol != gkfs::rpc::protocol::ofi_psm2) {
...@@ -390,15 +400,15 @@ parse_input(const po::variables_map& vm) { ...@@ -390,15 +400,15 @@ parse_input(const po::variables_map& vm) {
} }
} }
auto use_auto_sm = vm.count("auto-sm") != 0; auto use_auto_sm = desc.count("--auto-sm") != 0;
GKFS_DATA->use_auto_sm(use_auto_sm); GKFS_DATA->use_auto_sm(use_auto_sm);
GKFS_DATA->spdlogger()->debug( GKFS_DATA->spdlogger()->debug(
"{}() Shared memory (auto_sm) for intra-node communication (IPCs) set to '{}'.", "{}() Shared memory (auto_sm) for intra-node communication (IPCs) set to '{}'.",
__func__, use_auto_sm); __func__, use_auto_sm);
string addr{}; string addr{};
if(vm.count("listen")) { if(desc.count("--listen")) {
addr = vm["listen"].as<string>(); addr = opts.listen;
// ofi+verbs requires an empty addr to bind to the ib interface // ofi+verbs requires an empty addr to bind to the ib interface
if(rpc_protocol == gkfs::rpc::protocol::ofi_verbs) { if(rpc_protocol == gkfs::rpc::protocol::ofi_verbs) {
/* /*
...@@ -419,23 +429,23 @@ parse_input(const po::variables_map& vm) { ...@@ -419,23 +429,23 @@ parse_input(const po::variables_map& vm) {
GKFS_DATA->bind_addr(fmt::format("{}://{}", rpc_protocol, addr)); GKFS_DATA->bind_addr(fmt::format("{}://{}", rpc_protocol, addr));
string hosts_file; string hosts_file;
if(vm.count("hosts-file")) { if(desc.count("--hosts-file")) {
hosts_file = vm["hosts-file"].as<string>(); hosts_file = opts.hosts_file;
} else { } else {
hosts_file = gkfs::env::get_var(gkfs::env::HOSTS_FILE, hosts_file = gkfs::env::get_var(gkfs::env::HOSTS_FILE,
gkfs::config::hostfile_path); gkfs::config::hostfile_path);
} }
GKFS_DATA->hosts_file(hosts_file); GKFS_DATA->hosts_file(hosts_file);
assert(vm.count("mountdir")); assert(desc.count("--mountdir"));
auto mountdir = vm["mountdir"].as<string>(); auto mountdir = opts.mountdir;
// Create mountdir. We use this dir to get some information on the // Create mountdir. We use this dir to get some information on the
// underlying fs with statfs in gkfs_statfs // underlying fs with statfs in gkfs_statfs
fs::create_directories(mountdir); fs::create_directories(mountdir);
GKFS_DATA->mountdir(fs::canonical(mountdir).native()); GKFS_DATA->mountdir(fs::canonical(mountdir).native());
assert(vm.count("rootdir")); assert(desc.count("--rootdir"));
auto rootdir = vm["rootdir"].as<string>(); auto rootdir = opts.rootdir;
#ifdef GKFS_ENABLE_FORWARDING #ifdef GKFS_ENABLE_FORWARDING
// In forwarding mode, the backend is shared // In forwarding mode, the backend is shared
...@@ -449,8 +459,8 @@ parse_input(const po::variables_map& vm) { ...@@ -449,8 +459,8 @@ parse_input(const po::variables_map& vm) {
fs::create_directories(rootdir_path); fs::create_directories(rootdir_path);
GKFS_DATA->rootdir(rootdir_path.native()); GKFS_DATA->rootdir(rootdir_path.native());
if(vm.count("metadir")) { if(desc.count("--metadir")) {
auto metadir = vm["metadir"].as<string>(); auto metadir = opts.metadir;
#ifdef GKFS_ENABLE_FORWARDING #ifdef GKFS_ENABLE_FORWARDING
auto metadir_path = fs::path(metadir) / fmt::format_int(getpid()).str(); auto metadir_path = fs::path(metadir) / fmt::format_int(getpid()).str();
...@@ -465,7 +475,7 @@ parse_input(const po::variables_map& vm) { ...@@ -465,7 +475,7 @@ parse_input(const po::variables_map& vm) {
metadir_path.native()); metadir_path.native());
} else { } else {
// use rootdir as metadata dir // use rootdir as metadata dir
auto metadir = vm["rootdir"].as<string>(); auto metadir = opts.rootdir;
#ifdef GKFS_ENABLE_FORWARDING #ifdef GKFS_ENABLE_FORWARDING
auto metadir_path = fs::path(metadir) / fmt::format_int(getpid()).str(); auto metadir_path = fs::path(metadir) / fmt::format_int(getpid()).str();
...@@ -481,76 +491,71 @@ int ...@@ -481,76 +491,71 @@ int
main(int argc, const char* argv[]) { main(int argc, const char* argv[]) {
// Define arg parsing // Define arg parsing
po::options_description desc("Allowed options");
desc.add_options()("help,h", "Help message"); CLI::App desc{"Allowed options"};
desc.add_options()(
"mountdir,m", po::value<string>()->required(), auto opts = read_options();
"Virtual mounting directory where GekkoFS is available."); //po::options_description desc("Allowed options");
desc.add_options()( //desc.set_help_flag();
"rootdir,r", po::value<string>()->required(), desc.add_option(
"Local data directory where GekkoFS data for this daemon is stored."); "--mountdir,-m", opts.mountdir,
desc.add_options()( "Virtual mounting directory where GekkoFS is available.")->required()->expected(1);
"metadir,i", po::value<string>(), desc.add_option(
"--rootdir,-r", opts.rootdir,
"Local data directory where GekkoFS data for this daemon is stored.")->required()->expected(1);
desc.add_option(
"--metadir,-i", opts.metadir,
"Metadata directory where GekkoFS' RocksDB data directory is located. If not set, rootdir is used."); "Metadata directory where GekkoFS' RocksDB data directory is located. If not set, rootdir is used.");
desc.add_options()(
"listen,l", po::value<string>(), desc.add_option(
"--listen,-l", opts.listen,
"Address or interface to bind the daemon to. Default: local hostname.\n" "Address or interface to bind the daemon to. Default: local hostname.\n"
"When used with ofi+verbs the FI_VERBS_IFACE environment variable is set accordingly " "When used with ofi+verbs the FI_VERBS_IFACE environment variable is set accordingly "
"which associates the verbs device with the network interface. In case FI_VERBS_IFACE " "which associates the verbs device with the network interface. In case FI_VERBS_IFACE "
"is already defined, the argument is ignored. Default 'ib'."); "is already defined, the argument is ignored. Default 'ib'.");
desc.add_options()("hosts-file,H", po::value<string>(), desc.add_option("--hosts-file,-H", opts.hosts_file,
"Shared file used by deamons to register their " "Shared file used by deamons to register their "
"endpoints. (default './gkfs_hosts.txt')"); "endpoints. (default './gkfs_hosts.txt')");
desc.add_options()( desc.add_option(
"rpc-protocol,P", po::value<string>(), "--rpc-protocol,-P", opts.rpc_protocol,
"Used RPC protocol for inter-node communication.\n" "Used RPC protocol for inter-node communication.\n"
"Available: {ofi+sockets, ofi+verbs, ofi+psm2} for TCP, Infiniband, " "Available: {ofi+sockets, ofi+verbs, ofi+psm2} for TCP, Infiniband, "
"and Omni-Path, respectively. (Default ofi+sockets)\n" "and Omni-Path, respectively. (Default ofi+sockets)\n"
"Libfabric must have enabled support verbs or psm2."); "Libfabric must have enabled support verbs or psm2.");
desc.add_options()( desc.add_flag(
"auto-sm", "--auto-sm",
"Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, " "Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, "
"instead of using the RPC protocol. (Default off)"); "instead of using the RPC protocol. (Default off)");
desc.add_options()("version", "Print version and exit."); desc.add_flag("--version", "Print version and exit.");
po::variables_map vm{};
po::store(po::parse_command_line(argc, argv, desc), vm);
if(vm.count("help")) {
cout << desc << "\n";
return 1;
}
if(vm.count("version")) {
cout << GKFS_VERSION_STRING << endl;
#ifndef NDEBUG
cout << "Debug: ON" << endl;
#else
cout << "Debug: OFF" << endl;
#endif
#if CREATE_CHECK_PARENTS
cout << "Create check parents: ON" << endl;
#else
cout << "Create check parents: OFF" << endl;
#endif
cout << "Chunk size: " << gkfs::config::rpc::chunksize << " bytes"
<< endl;
return 0;
}
try { try {
po::notify(vm); (desc).parse((argc), (argv));
} catch(po::required_option& e) { } catch(const CLI::ParseError &e) { \
std::cerr << "Error: " << e.what() << "\n"; if(desc.count("--version")) {
return 1; cout << GKFS_VERSION_STRING << endl;
#ifndef NDEBUG
cout << "Debug: ON" << endl;
#else
cout << "Debug: OFF" << endl;
#endif
#if CREATE_CHECK_PARENTS
cout << "Create check parents: ON" << endl;
#else
cout << "Create check parents: OFF" << endl;
#endif
cout << "Chunk size: " << gkfs::config::rpc::chunksize << " bytes"
<< endl;
return 0;
}
return desc.exit(e);
} }
// intitialize logging framework // intitialize logging framework
initialize_loggers(); initialize_loggers();
GKFS_DATA->spdlogger(spdlog::get("main")); GKFS_DATA->spdlogger(spdlog::get("main"));
// parse all input parameters and populate singleton structures // parse all input parameters and populate singleton structures
try { try {
parse_input(vm); parse_input(opts, desc);
} catch(const std::exception& e) { } catch(const std::exception& e) {
cerr << fmt::format("Parsing arguments failed: '{}'. Exiting.", cerr << fmt::format("Parsing arguments failed: '{}'. Exiting.",
e.what()); e.what());
...@@ -584,4 +589,5 @@ main(int argc, const char* argv[]) { ...@@ -584,4 +589,5 @@ main(int argc, const char* argv[]) {
destroy_enviroment(); destroy_enviroment();
GKFS_DATA->spdlogger()->info("{}() Complete. Exiting...", __func__); GKFS_DATA->spdlogger()->info("{}() Complete. Exiting...", __func__);
return 0; return 0;
} }
...@@ -66,12 +66,6 @@ add_executable(gkfs.io ...@@ -66,12 +66,6 @@ add_executable(gkfs.io
include(FetchContent) include(FetchContent)
set(FETCHCONTENT_QUIET OFF) set(FETCHCONTENT_QUIET OFF)
FetchContent_Declare(cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG dd0d8e4fe729e5b1110232c7a5c9566dad884686 # v1.9.0
GIT_SHALLOW ON
GIT_PROGRESS ON
)
FetchContent_Declare(nlohmann_json FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json GIT_REPOSITORY https://github.com/nlohmann/json
...@@ -80,14 +74,7 @@ FetchContent_Declare(nlohmann_json ...@@ -80,14 +74,7 @@ FetchContent_Declare(nlohmann_json
GIT_PROGRESS ON GIT_PROGRESS ON
) )
FetchContent_GetProperties(cli11)
if(NOT cli11_POPULATED)
FetchContent_Populate(cli11)
message(STATUS "[gkfs.io] CLI11 source dir: ${cli11_SOURCE_DIR}")
message(STATUS "[gkfs.io] CLI11 binary dir: ${cli11_BINARY_DIR}")
add_subdirectory(${cli11_SOURCE_DIR} ${cli11_BINARY_DIR})
endif()
FetchContent_GetProperties(nlohmann_json) FetchContent_GetProperties(nlohmann_json)
...@@ -109,9 +96,8 @@ endif() ...@@ -109,9 +96,8 @@ endif()
target_include_directories(gkfs.io PRIVATE target_include_directories(gkfs.io PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/gkfs.io> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/gkfs.io>
) )
include_directories(${CMAKE_HOME_DIRECTORY}/external/CLI)
target_link_libraries(gkfs.io target_link_libraries(gkfs.io
CLI11::CLI11
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
fmt::fmt fmt::fmt
# open issue for std::filesystem https://gitlab.kitware.com/cmake/cmake/-/issues/17834 # open issue for std::filesystem https://gitlab.kitware.com/cmake/cmake/-/issues/17834
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <commands.hpp> #include <commands.hpp>
void void
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
/* C++ includes */ /* C++ includes */
#include <CLI/CLI.hpp> #include "CLI11.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <memory> #include <memory>
#include <fmt/format.h> #include <fmt/format.h>
......