Draft: Resolve "Add dedicated storage backend for NVM"

  • Add PMDK dependency to CMake
  • Add PMDK dependencies to docker images
  • Update dl_dep.sh and compile_dep.sh scripts with PMDK library
  • Enable runtime configuration of data backends
  • Design common interface for data backends
  • Implement PMDK backend
    • Add abstraction to manage PMDK pools
    • Implement pmdk::ChunkStorage class
  • Enable integration tests to run also for PMDK backends

Closes #124

Edited by Alberto Miranda

Merge request reports

Loading
+1055

File added.

Preview size limit exceeded, changes collapsed.

+5 −1
Changes for docker/debian_build_env.docker: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@ RUN apt-get update && \
		zlib1g-dev \
		# syscall_intercept dependencies
		libcapstone-dev \
        # pmdk dependencies
        libndctl-dev \
        libdaxctl-dev \
        pandoc \
		# GekkoFS
		libboost-filesystem-dev \
		libboost-program-options-dev \
@@ -48,7 +52,7 @@ RUN apt-get update && \
		lsb-release \
		wget \
		software-properties-common \
		gnupg2 \
		gnupg2 && \
    # add clang-10 repos
    wget https://apt.llvm.org/llvm.sh -P /tmp && chmod +x /tmp/llvm.sh && /tmp/llvm.sh 10 && \
    # install clang-format
Compare 0af45bfa to 97820ed8
Changes for external/hermes: 1 added line, 1 removed line.
Original line number Diff line number Diff line
Subproject commit 0af45bfa667f7ff9c78167ef94d975bffbd879f0
Subproject commit 97820ed81aba9ef7c05891ce80c53a8533b78609
+162
Changes for include/daemon/backend/data/pmdk/pool.hpp: 162 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, 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.

  This file is part of GekkoFS.

  GekkoFS 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.

  GekkoFS 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 GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_DAEMON_DATA_PMDK_POOL_HPP
#define GEKKOFS_DAEMON_DATA_PMDK_POOL_HPP

#include <filesystem>
#include <spdlog/spdlog.h>

namespace fs = std::filesystem;

namespace pmdk {

/**
 * This class implements a RAII-enabled non-volatile memory pool based on
 * Intel's PMDK C library.
 */
class pool {

public:
    /**
     * Create a pool of non-volatile memory of a fixed `size` under
     * `parent_dir`. Give it a random name.
     *
     * @param[in]  parent_dir the parent directory where the memory pool backing
     *                        file will be stored
     * @param[in] size the maximum capacity in bytes of the pool
     * @returns the newly created pool
     */
    pool(const fs::path& parent_dir, std::size_t size) noexcept;

    pool(pool&& rhs) = default;
    pool(const pool& other) = delete;
    pool&
    operator=(pool&& rhs) = default;
    pool&
    operator=(const pool& other) = delete;

    /**
     * Destroy an existing pool.
     */
    ~pool();

    /**
     * Returns the path to a pool's data storage in the file system.
     *
     * @returns If the pool was correctly created, the function returns a
     *          `boost::fylesystem::path` with the path to the file backing the
     *          pool in the file system. Otherwise, `boost::filesystem::path{}`
     *          is returned.
     */
    fs::path
    path() const noexcept;

    /**
     * Returns the address to a pool's data region in non-volatile memory.
     *
     * @returns If the pool was correctly created, the function returns a
     *          void pointer to the non-volatile memory region containing the
     *          pool's data. Otherwise, `nullptr` is returned.
     */
    void*
    data() const noexcept;

    /**
     * Returns the size of a pool's data region in non-volatile memory.
     *
     * @returns If the pool was correctly created, the function returns the
     *          size of the non-volatile memory region containing
     *          the pool's data. Otherwise, `0` is returned.
     */
    std::size_t
    size() const noexcept;

    /**
     * Returns whether a pool's data is actually stored in non-volatile
     * memory.
     *
     * @returns The function returns `true` if the pool was correctly created,
     *          and the pool's data is stored in NVM. Otherwise, `false` is
     *          returned.
     */
    bool
    is_persistent() const noexcept;

    /**
     *
     * Check whether a pool is valid.
     *
     * @returns `true` if the pool was correctly created. Otherwise it
     *           returns `false`.
     */
    explicit operator bool() const noexcept;

    /**
     *
     * Check whether a pool is invalid.
     *
     * @returns `true` if the pool was not correctly created. Otherwise it
     *           returns `false`.
     */
    bool
    operator!() const noexcept;

    /**
     *
     * Check whether a pool is valid.
     *
     * @returns `true` if the pool was correctly created. Otherwise it
     *           returns `false`.
     */
    bool
    valid() const noexcept;

private:
    /// Logger instance
    std::shared_ptr<spdlog::logger> log_;

    /// Path to the pool file in the file system
    fs::path path_;

    /// Address of the pool's non-volatile memory region
    void* data_ = nullptr;

    /// Size of the pool's non-volatile memory region
    std::size_t size_ = 0;

    /// Flag set if the pool file is actually stored in non-volatile memory
    bool is_persistent_ = false;

    /// Flag set if the pool was created correctly
    bool is_valid_ = false;
};

} // namespace pmdk

#endif // GEKKOFS_DAEMON_DATA_PMDK_POOL_HPP
 No newline at end of file
+15 −6
Changes for scripts/compile_dep.sh: 15 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -40,30 +40,30 @@ VALID_DEP_OPTIONS="mogon2 mogon1 ngio direct all ci"

MOGON1_DEPS=(
    "zstd" "lz4" "snappy" "capstone" "ofi" "mercury" "argobots" "margo" "rocksdb"
    "syscall_intercept" "date" "verbs"
    "syscall_intercept" "date" "verbs" "pmdk"
)

MOGON2_DEPS=(
    "bzip2" "zstd" "lz4" "snappy" "capstone" "ofi" "mercury" "argobots" "margo" "rocksdb"
    "syscall_intercept" "date" "psm2"
    "syscall_intercept" "date" "psm2" "pmdk"
)

NGIO_DEPS=(
    "zstd" "lz4" "snappy" "capstone" "ofi" "mercury" "argobots" "margo" "rocksdb"
    "syscall_intercept" "date" "agios" "psm2"
    "syscall_intercept" "date" "agios" "psm2" "pmdk"
)

DIRECT_DEPS=(
  "ofi" "mercury" "argobots" "margo" "rocksdb" "syscall_intercept" "date"
  "ofi" "mercury" "argobots" "margo" "rocksdb" "syscall_intercept" "date" "pmdk"
)

ALL_DEPS=(
    "bzip2" "zstd" "lz4" "snappy" "capstone" "bmi" "ofi" "mercury" "argobots" "margo" "rocksdb"
     "syscall_intercept" "date" "agios"
     "syscall_intercept" "date" "agios" "pmdk"
)

CI_DEPS=(
    "ofi" "mercury" "argobots" "margo" "rocksdb" "syscall_intercept" "date" "agios"
    "ofi" "mercury" "argobots" "margo" "rocksdb" "syscall_intercept" "date" "agios" "pmdk"
)

usage_short() {
@@ -514,4 +514,13 @@ if check_dependency "date" "${DEP_CONFIG[@]}"; then
    make install
fi

# PMDK
if check_dependency "pmdk" "${DEP_CONFIG[@]}"; then
    echo "############################################################ Installing:  PMDK"
    CURR=${SOURCE}/pmdk
    cd "${CURR}"
    make -j"${CORES}"
    make install prefix="${INSTALL}"
fi

echo "Done"
Loading
Loading