Skip to content

Commit

Permalink
Merge pull request #222 from LLNL/release/v0.21
Browse files Browse the repository at this point in the history
Release/v0.21
  • Loading branch information
KIwabuchi authored Jul 6, 2022
2 parents c0e50ad + bb61595 commit 2580230
Show file tree
Hide file tree
Showing 20 changed files with 305 additions and 211 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI Test
on: [push, pull_request]

jobs:
bst1-78-0:
bst1-79-0:
runs-on: ubuntu-latest
env:
METALL_LIMIT_MAKE_PARALLELS: 8
Expand All @@ -12,9 +12,9 @@ jobs:
- name: Test
run: |
pushd /dev/shm
wget -q https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz
wget -q https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.gz
mkdir boost
tar xf boost_1_78_0.tar.gz -C boost --strip-components 1
tar xf boost_1_79_0.tar.gz -C boost --strip-components 1
export BOOST_ROOT=${PWD}/boost
popd
export METALL_TEST_DIR=${GITHUB_JOB}
Expand Down
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ install_boost:
script:
- hostname
- pwd
# - spack install [email protected]
# - spack install [email protected]
# - spack install [email protected]
# - spack install [email protected]
# - spack install [email protected]
Expand Down Expand Up @@ -58,6 +60,18 @@ install_boost:
- export METALL_TEST_DIR="/dev/shm/metall_test-${CI_CONCURRENT_ID}-${CI_PIPELINE_IID}"
- srun -N1 -ppdebug bash ./scripts/CI/build_and_test.sh

build_gcc10.2.1_bst1.79.0:
extends: .build
variables:
GCC_VERSION: "10.2.1"
BOOST_VERSION: "1.79.0"

build_gcc10.2.1_bst1.78.0:
extends: .build
variables:
GCC_VERSION: "10.2.1"
BOOST_VERSION: "1.78.0"

build_gcc10.2.1_bst1.77.0:
extends: .build
variables:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake_policy(SET CMP0077 NEW)
# Metall general configuration
# -------------------------------------------------------------------------------- #
project(Metall
VERSION 0.20
VERSION 0.21
DESCRIPTION "A persistent memory allocator for data-centric analytics"
HOMEPAGE_URL "https://github.com/LLNL/metall")

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ All core files exist under

## Required

- GCC 8.1 or more (8.3 or more is recommended due to early implementation of the Filesystem library).
- Boost C++ Libraries 1.64 or more (build is not required; needs only their header files).
- Boost C++ Libraries 1.64 or more.
- Build is not required; needs only their header files.
- To use JSON containers in Metall, Boost C++ Libraries 1.75 or more is required.
- C++17 compiler
- Tested with GCC 8.1 or more; however, 8.3 or more is recommended due to early implementation of the C++ Filesystem library.

## Build

Expand Down
2 changes: 1 addition & 1 deletion docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Metall"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v0.20
PROJECT_NUMBER = v0.21

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
3 changes: 2 additions & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ else()
message(STATUS "Will skip building the MPI examples")
endif()

add_subdirectory(json)
add_subdirectory(json)
add_subdirectory(container)
3 changes: 3 additions & 0 deletions example/container/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if (Boost_VERSION_STRING VERSION_GREATER_EQUAL "1.75")
add_metall_executable(string_key_store string_key_store.cpp)
endif()
75 changes: 75 additions & 0 deletions example/container/string_key_store.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2022 Lawrence Livermore National Security, LLC and other Metall Project Developers.
// See the top-level COPYRIGHT file for details.
//
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#include <metall/metall.hpp>
#include <metall/container/string_key_store.hpp>
#include <metall/container/experimental/json/json.hpp>

namespace mc = metall::container;
namespace mj = mc::experimental::json;

// Example of a string-key-store with int value.
void int_store_example();

// Example of a string-key-store with JSON value.
void json_store_example();

int main() {
int_store_example();
json_store_example();
}

void int_store_example() {
using int_store_type = mc::string_key_store<int>;
{
metall::manager manager(metall::create_only, "./string_key_store_obj");

// Allocate an instance of the int-store which accept duplicate keys by default.
auto *store = manager.construct<int_store_type>("int-store")(manager.get_allocator());

store->insert("a"); // Insert with the default value
store->insert("b", 0); // Insert with a value
store->insert("b", 1); // Insert another element with an existing key
}

{
metall::manager manager(metall::open_read_only, "./string_key_store_obj");
auto *store = manager.find<int_store_type>("int-store").first;

// Iterate over all elements
for (auto loc = store->begin(); loc != store->end(); ++loc) {
std::cout << store->key(loc) << " : " << store->value(loc) << std::endl;
}
}
}

void json_store_example() {
using json_type = mj::value<metall::manager::allocator_type<std::byte>>;
using json_store_type = mc::string_key_store<json_type>;
{
metall::manager manager(metall::open_only, "./string_key_store_obj");

const bool unique = true;
const uint64_t hash_seed = 123;
auto *store = manager.construct<json_store_type>("json-store")(unique, hash_seed, manager.get_allocator());

store->insert("a",
mj::parse(R"({"name":"Alice"})", manager.get_allocator()));

store->insert("b",
mj::parse(R"({"name":"N/A"})", manager.get_allocator()));
store->insert("b",
mj::parse(R"({"name":"Bob"})", manager.get_allocator())); // Overwrite
}

{
metall::manager manager(metall::open_read_only, "./string_key_store_obj");
auto *store = manager.find<json_store_type>("json-store").first;

// Use find() to locate elements.
std::cout << "a : " << mj::serialize(store->value(store->find("a"))) << std::endl;
std::cout << "b : " << mj::serialize(store->value(store->find("b"))) << std::endl;
}
}
137 changes: 0 additions & 137 deletions include/metall/container/experimental/json/detail/string_view.hpp

This file was deleted.

32 changes: 26 additions & 6 deletions include/metall/container/experimental/json/equal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ inline bool operator==(const array<allocator_type> &array, const bj::array &bj_a

template <typename allocator_type>
inline bool operator==(const bj::array &bj_array, const array<allocator_type> &array) {
return bj_array == array;
return array == bj_array;
}

template <typename allocator_type>
Expand All @@ -77,7 +77,7 @@ inline bool operator!=(const array<allocator_type> &array, const bj::array &bj_a

template <typename allocator_type>
inline bool operator!=(const bj::array &bj_array, const array<allocator_type> &array) {
return bj_array != array;
return array != bj_array;
}

template <typename allocator_type>
Expand All @@ -87,7 +87,7 @@ inline bool operator==(const compact_object<allocator_type> &object, const bj::o

template <typename allocator_type>
inline bool operator==(const bj::object &bj_object, const compact_object<allocator_type> &object) {
return bj_object == object;
return object == bj_object;
}

template <typename allocator_type>
Expand All @@ -97,7 +97,7 @@ inline bool operator!=(const compact_object<allocator_type> &object, const bj::o

template <typename allocator_type>
inline bool operator!=(const bj::object &bj_object, const compact_object<allocator_type> &object) {
return bj_object != object;
return object != bj_object;
}

template <typename allocator_type>
Expand All @@ -107,7 +107,7 @@ inline bool operator==(const indexed_object<allocator_type> &object, const bj::o

template <typename allocator_type>
inline bool operator==(const bj::object &bj_object, const indexed_object<allocator_type> &object) {
return bj_object == object;
return object == bj_object;
}

template <typename allocator_type>
Expand All @@ -117,7 +117,27 @@ inline bool operator!=(const indexed_object<allocator_type> &object, const bj::o

template <typename allocator_type>
inline bool operator!=(const bj::object &bj_object, const indexed_object<allocator_type> &object) {
return bj_object != object;
return object != bj_object;
}

template <typename char_t, typename traits, typename allocator>
inline bool operator==(const string<char_t, traits, allocator> &string, const bj::string &bj_string) {
return jsndtl::general_string_equal(string, bj_string);
}

template <typename char_t, typename traits, typename allocator>
inline bool operator==(const bj::string &bj_string, const string<char_t, traits, allocator> &string) {
return string == bj_string;
}

template <typename char_t, typename traits, typename allocator>
inline bool operator!=(const string<char_t, traits, allocator> &string, const bj::string &bj_string) {
return !(string == bj_string);
}

template <typename char_t, typename traits, typename allocator>
inline bool operator!=(const bj::string &bj_string, const string<char_t, traits, allocator> &string) {
return string != bj_string;
}
} // namespace metall::container::experimental::json
#endif //METALL_CONTAINER_EXPERIMENT_JSON_EQUAL_HPP
1 change: 1 addition & 0 deletions include/metall/container/experimental/json/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <metall/container/experimental/json/array.hpp>
#include <metall/container/experimental/json/key_value_pair.hpp>
#include <metall/container/experimental/json/value.hpp>
#include <metall/container/experimental/json/string.hpp>
#include <metall/container/experimental/json/parse.hpp>
#include <metall/container/experimental/json/serialize.hpp>
#include <metall/container/experimental/json/pretty_print.hpp>
Expand Down
Loading

0 comments on commit 2580230

Please sign in to comment.