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

Merge branch '32-replace-margo-with-mercury-in-client-code' into 'dev_toto'

Resolve "Replace Margo with Mercury in client code"

See merge request !29

Closes #32 #72
parents 866b8016 006c7d4e
Loading
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@ variables:
  # Configuration variables
  GKFS_LOG_LEVEL:   "100"
  GKFS_DAEMON_LOG_PATH:  "${CI_PROJECT_DIR}/logs/daemon.log"
  GKFS_PRELOAD_LOG_PATH: "${CI_PROJECT_DIR}/logs/preload.log"
  LIBGKFS_LOG:           "all"
  LIBGKFS_LOG_OUTPUT:    "${CI_PROJECT_DIR}/logs/gkfs_client.log"
  GIT_SUBMODULE_STRATEGY: recursive

image: gekkofs/gekkofs:build_env

@@ -49,6 +51,7 @@ compile GekkoFS:
      -Wdev
      -Wdeprecate
      -DCMAKE_BUILD_TYPE=Debug
      -DRPC_PROTOCOL="ofi+sockets"
      -DCMAKE_PREFIX_PATH=${DEPS_INSTALL_PATH}
      -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH}
      ${CI_PROJECT_DIR}
@@ -77,6 +80,7 @@ test wr:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_wr
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -88,6 +92,7 @@ test directories:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_dir
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -99,6 +104,7 @@ test truncate:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_truncate
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -110,6 +116,7 @@ test path resolution:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_path_resolution
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

@@ -121,6 +128,6 @@ test lseek:
    - sleep 4
    - LD_PRELOAD=${INSTALL_PATH}/lib/libgkfs_intercept.so ${TESTS_BUILD_PATH}/gkfs_test_lseek
  artifacts:
    when: on_failure
    paths:
     - "${LOG_PATH}"

.gitmodules

0 → 100644
+6 −0
Original line number Diff line number Diff line
[submodule "external/hermes"]
	path = external/hermes
	url = https://github.com/bsc-ssrg/hermes.git
[submodule "external/fmt"]
	path = external/fmt
	url = https://github.com/fmtlib/fmt

CMake/FindDate.cmake

0 → 100644
+40 −0
Original line number Diff line number Diff line
find_path(DATE_INCLUDE_DIR
    NAMES date/date.h
)

find_path(TZ_INCLUDE_DIR
    NAMES date/tz.h
)

find_library(TZ_LIBRARY
    NAMES tz
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( Date 
    DEFAULT_MSG 
    DATE_INCLUDE_DIR
    TZ_INCLUDE_DIR
    TZ_LIBRARY
)

if(Date_FOUND)
    set(DATE_INCLUDE_DIRS ${DATE_INCLUDE_DIR})
    set(TZ_INCLUDE_DIRS ${TZ_INCLUDE_DIR})
    set(TZ_LIBRARIES ${TZ_LIBRARY})

    if(NOT TARGET Date::TZ)
        add_library(Date::TZ UNKNOWN IMPORTED)
        set_target_properties(Date::TZ PROPERTIES
            IMPORTED_LOCATION "${TZ_LIBRARY}"
            INTERFACE_COMPILE_DEFINITIONS "USE_OS_TZDB=1"
            INTERFACE_INCLUDE_DIRECTORIES "${TZ_INCLUDE_DIR}"
        )
    endif()
endif()

mark_as_advanced(
    DATE_INCLUDE_DIR
    TZ_INCLUDE_DIR
    TZ_LIBRARY
)
+49 −16
Original line number Diff line number Diff line
@@ -22,14 +22,18 @@ if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release
            CACHE STRING "Choose the type of build: Debug Release Memcheck" FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "[gekkofs] Build type: ${CMAKE_BUILD_TYPE}")

# Compiler flags for various cmake build types
set(WARNINGS_FLAGS "-Wall -Wextra --pedantic -Wno-unused-parameter")
set(WARNINGS_FLAGS "-Wall -Wextra --pedantic -Wno-unused-parameter -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${WARNINGS_FLAGS} -g -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${WARNINGS_FLAGS} -g -O0 -DGKFS_DEBUG_BUILD -DHERMES_DEBUG_BUILD")
set(CMAKE_CXX_FLAGS_MEMCHECK "${WARNINGS_FLAGS} -g -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_MAINTAINER "${WARNINGS_FLAGS} -g -O0 -pg -no-pie")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG -O3")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${WARNINGS_FLAGS} -g -O0 -DGKFS_DEBUG_BUILD")
set(CMAKE_C_FLAGS_MEMCHECK "${WARNINGS_FLAGS} -g -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_MAINTAINER "${WARNINGS_FLAGS} -g -O0 -pg -no-pie")
mark_as_advanced(CMAKE_CXX_FLAGS_MAINTAINER)

# Project version
@@ -60,7 +64,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
        endif()
    endif()
endif()
message(STATUS "Project version: ${PROJECT_VERSION}")
message(STATUS "[gekkofs] Project version: ${PROJECT_VERSION}")
set(GKFS_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(GKFS_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(GKFS_VERSION_PATCH ${PROJECT_VERSION_PATCH})
@@ -94,6 +98,8 @@ find_package(Boost 1.53 REQUIRED

find_package(Threads REQUIRED)

find_package(Date REQUIRED)

set(RPC_PROTOCOL "ofi+sockets" CACHE STRING "Communication plugin used for RPCs")
set_property(CACHE RPC_PROTOCOL PROPERTY STRINGS
   "bmi+tcp"
@@ -102,13 +108,10 @@ set_property(CACHE RPC_PROTOCOL PROPERTY STRINGS
   "ofi+verbs"
   "ofi+psm2"
)
message(STATUS "RPC protocol: '${RPC_PROTOCOL}'")
message(STATUS "[gekkofs] RPC protocol: '${RPC_PROTOCOL}'")

option(USE_SHM "Use shared memory for intra-node communication" OFF)
message(STATUS "Shared-memory communication: ${USE_SHM}")

option(LOG_SYSCALLS "Enable verbose logging for syscalls interception" OFF)
message(STATUS "Syscall logging: ${LOG_SYSCALLS}")
message(STATUS "[gekkofs] Shared-memory communication: ${USE_SHM}")

option(CREATE_CHECK_PARENTS "Check parent directory existance before creating child node" ON)
message(STATUS "Create checks parents: ${CREATE_CHECK_PARENTS}")
@@ -117,7 +120,31 @@ option(SYMLINK_SUPPORT "Compile with support for symlinks" ON)
if(SYMLINK_SUPPORT)
    add_definitions(-DHAS_SYMLINKS)
endif()
message(STATUS "Symlink support: ${SYMLINK_SUPPORT}")
message(STATUS "[gekkofs] Symlink support: ${SYMLINK_SUPPORT}")

set(MAX_INTERNAL_FDS 256 CACHE STRING "Number of file descriptors reserved for internal use")
add_definitions(-DMAX_INTERNAL_FDS=${MAX_INTERNAL_FDS})
message(STATUS "[gekkofs] File descriptors reserved for internal use: ${MAX_INTERNAL_FDS}")

execute_process(COMMAND getconf OPEN_MAX
                OUTPUT_VARIABLE GETCONF_MAX_FDS
                OUTPUT_STRIP_TRAILING_WHITESPACE
                ERROR_QUIET)
if(NOT GETCONF_MAX_FDS)
    set(GETCONF_MAX_FDS=512)
endif()
add_definitions(-DMAX_OPEN_FDS=${GETCONF_MAX_FDS})

option(ENABLE_CLIENT_LOG "Enable logging messages" ON)
if(ENABLE_CLIENT_LOG)
    add_definitions(-DGKFS_ENABLE_LOGGING)
endif()
message(STATUS "[gekkofs] Client logging output: ${ENABLE_CLIENT_LOG}")

set(CLIENT_LOG_MESSAGE_SIZE 1024 CACHE STRING "Maximum size of a log message in the client library")
add_definitions(-DLIBGKFS_LOG_MESSAGE_SIZE=${CLIENT_LOG_MESSAGE_SIZE})
message(STATUS "[gekkofs] Maximum log message size in the client library: ${CLIENT_LOG_MESSAGE_SIZE}")
mark_as_advanced(CLIENT_LOG_MESSAGE_SIZE)

configure_file(include/global/configure.hpp.in include/global/configure.hpp)

@@ -153,12 +180,18 @@ set_target_properties(spdlog
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/external"
)

add_library(fmt INTERFACE)
# we cannot use target_include_directories with CMake < 3.11
set_target_properties(fmt
    PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/external/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)
    option(HERMES_LOGGING_FMT_HEADER_ONLY "" OFF)
endif()

option(HERMES_MARGO_COMPATIBLE_RPCS "" ON)
add_subdirectory(external/hermes)
target_compile_definitions(hermes INTERFACE)

set(INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include")

+69 −19
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ This is a file system.
(execute the script for help):

```bash
usage: dl_dep.sh [-h] [-n <NAPLUGIN>] [-c <CLUSTER>]
usage: dl_dep.sh [-h] [-l] [-n <NAPLUGIN>] [-c <CLUSTER>] [-d <DEPENDENCY>] 
                    source_path
	

@@ -54,18 +54,23 @@ positional arguments:

optional arguments:
        -h, --help              shows this help message and exits
        -l, --list-dependencies
                                list dependencies available for download
        -n <NAPLUGIN>, --na <NAPLUGIN>
                                network layer that is used for communication. Valid: {bmi,ofi,all}
                                defaults to 'all'
        -c <CLUSTER>, --cluster <CLUSTER>
                                additional configurations for specific compute clusters
                                supported clusters: {mogon1,fh2}
                                supported clusters: {mogon1,mogon2,fh2}
        -d <DEPENDENCY>, --dependency <DEPENDENCY>
                                download a specific dependency. If unspecified 
                                all dependencies are built and installed.
```
- Now use the install script to compile them and install them to the desired directory. You can choose the according
na_plugin (execute the script for help):

```bash
usage: compile_dep.sh [-h] [-n <NAPLUGIN>] [-c <CLUSTER>] [-j <COMPILE_CORES>]
usage: compile_dep.sh [-h] [-l] [-n <NAPLUGIN>] [-c <CLUSTER>] [-d <DEPENDENCY>] [-j <COMPILE_CORES>]
                      source_path install_path
	

@@ -78,15 +83,21 @@ positional arguments:

optional arguments:
    -h, --help  shows this help message and exits
    -l, --list-dependencies
                list dependencies available for building and installation
    -n <NAPLUGIN>, --na <NAPLUGIN>
                network layer that is used for communication. Valid: {bmi,ofi,all}
                defaults to 'all'
    -c <CLUSTER>, --cluster <CLUSTER>
                additional configurations for specific compute clusters
                supported clusters: {mogon1,mogon2,fh2}
    -d <DEPENDENCY>, --dependency <DEPENDENCY>
                build and install a specific dependency. If unspecified 
                all dependencies are built and installed.
    -j <COMPILE_CORES>, --compilecores <COMPILE_CORES>
                number of cores that are used to compile the depdencies
                number of cores that are used to compile the dependencies
                defaults to number of available cores
    -t, --test  Perform libraries tests.
```

## Compile GekkoFS
@@ -129,11 +140,50 @@ Run the application with the preload library: `LD_PRELOAD=<path>/build/lib/libgk
an MPI application use the `{mpirun, mpiexec} -x` argument.
 
### Logging
To enable logging the following environment variables are used:
GKFS_PRELOAD_LOG_PATH="<path/to/file>" to set the path to the logging file of the client library.
GKFS_DAEMON_LOG_PATH="<path/to/file>" to set the path to the logging file of the daemon.
GKFS_LOG_LEVEL={off,critical,err,warn,info,debug,trace} to set the trace level verbosity.
Numbers from 0-6 may also be used where as 0 is off and 6 represents trace.
The following environment variables can be used to enable logging in the client
library: `LIBGKFS_LOG=<module>` and `LIBGKFS_LOG_OUTPUT=<path/to/file>` to
configure the output module and set the path to the log file of the client
library. If not path is specified in `LIBGKFS_LOG_OUTPUT`, the client library 
will send log messages to `/tmp/gkfs_client.log`.

The following modules are available:

 - `none`: don't print any messages
 - `syscalls`: Trace system calls: print the name of each system call, its
   arguments, and its return value. All system calls are printed after being
   executed save for those that may not return, such as `execve()`,
   `execve_at()`, `exit()`, and `exit_group()`. This module will only be
   available if the client library is built in `Debug` mode.
 - `syscalls_at_entry`: Trace system calls: print the name of each system call
   and its arguments. All system calls are printed before being executed and
   therefore their return values are not available in the log. This module will
   only be available if the client library is built in `Debug` mode.
 - `info`: Print information messages.
 - `critical`: Print critical errors.
 - `errors`: Print errors.
 - `warnings`: Print warnings.
 - `mercury`: Print Mercury messages.
 - `debug`: Print debug messages.  This module will only be available if the
   client library is built in `Debug` mode.
 - `most`: All previous options combined except `syscalls_at_entry`. This
   module will only be available if the client library is built in `Debug`
   mode.
 - `all`: All previous options combined.
 - `help`: Print a help message and exit.

When tracing sytem calls, specific syscalls can be removed from log messages by
setting the `LIBGKFS_LOG_SYSCALL_FILTER` environment variable. For instance,
setting it to `LIBGKFS_LOG_SYSCALL_FILTER=epoll_wait,epoll_create` will filter
out any log entries from the `epoll_wait()` and `epoll_create()` system calls.

Additionally, setting the `LIBGKFS_LOG_OUTPUT_TRUNC` environment variable with
a value different from `0` will instruct the logging subsystem to truncate 
the file used for logging, rather than append to it.

For the daemon, the `GKFS_DAEMON_LOG_PATH=<path/to/file>` environment variable 
can be provided to set the path to the log file, and the log module can be 
selected with the `GKFS_LOG_LEVEL={off,critical,err,warn,info,debug,trace}`
environment variable.


### Acknowledgment
Loading