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