Skip to content

Commit

Permalink
Merge pull request #299 from LLNL/release/v0.27
Browse files Browse the repository at this point in the history
Release/v0.27
  • Loading branch information
KIwabuchi committed Nov 23, 2023
2 parents e98ff94 + 2b4e766 commit b49d865
Show file tree
Hide file tree
Showing 44 changed files with 1,659 additions and 833 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install_boost:
script:
- echo "=== build section ==="
- module load gcc/${GCC_VERSION}
- spack load boost@${BOOST_VERSION} arch=$(spack arch)
- spack load --first boost@${BOOST_VERSION} arch=$(spack arch)
- export METALL_TEST_DIR="/dev/shm/metall_test-${CI_CONCURRENT_ID}-${CI_PIPELINE_IID}"
- srun -N1 -ppdebug bash ./scripts/CI/build_and_test.sh

Expand Down
98 changes: 20 additions & 78 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.12)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(FetchContent)

Expand All @@ -17,7 +17,7 @@ endif()
# Metall general configuration
# -------------------------------------------------------------------------------- #
project(Metall
VERSION 0.26
VERSION 0.27
DESCRIPTION "A persistent memory allocator for data-centric analytics"
HOMEPAGE_URL "https://github.com/LLNL/metall")

Expand Down Expand Up @@ -82,33 +82,20 @@ option(JUST_INSTALL_METALL_HEADER "Just install Metall header files (do not buil
option(BUILD_UTILITY "Build utility programs" OFF)
option(BUILD_DOC "Build API documentation" OFF)
option(BUILD_C "Build C examples and libraries" OFF)
option(VERBOSE_SYSTEM_SUPPORT_WARNING "Show compile time warning regarding system support" OFF)
option(DISABLE_FREE_FILE_SPACE "Disable freeing file space" OFF)
option(DISABLE_SMALL_OBJECT_CACHE "Disable small object cache" OFF)
option(BUILD_EXAMPLE "Build the examples" OFF)
option(BUILD_BENCH "Build the benchmark" OFF)
option(BUILD_TEST "Build the test" OFF)
option(RUN_LARGE_SCALE_TEST "Run large scale tests" OFF)
option(RUN_BUILD_AND_TEST_WITH_CI "Perform build and basic test with CI" OFF)
option(BUILD_VERIFICATION "Build verification directory" OFF)
option(USE_SORTED_BIN "Use VM space aware algorithm in the bin directory" OFF)

set(DEFAULT_VM_RESERVE_SIZE "0" CACHE STRING
"Set the default VM reserve size (use the internally defined value if 0 is specified)")
set(MAX_SEGMENT_SIZE "0" CACHE STRING
"Set the max segment size (use the internally defined value if 0 is specified)")
set(INITIAL_SEGMENT_SIZE "0" CACHE STRING
"Set the initial segment size (use the internally defined value if 0 is specified)")
option(BUILD_BENCH "Build the benchmark" OFF)
option(BUILD_VERIFICATION "Build verification programs" OFF)
set(COMPILER_DEFS "" CACHE STRING "A list of Metall compile definitions to be added to all targets")

# ---------- Experimental options ---------- #
option(USE_ANONYMOUS_NEW_MAP "Use the anonymous map when creating a new map region" OFF)
set(UMAP_ROOT "" CACHE PATH "UMap installed root directory")

option(ONLY_DOWNLOAD_GTEST "Only downloading Google Test" OFF)
option(SKIP_DOWNLOAD_GTEST "Skip downloading Google Test" OFF)
option(BUILD_NUMA "Build programs that require the NUMA policy library (numa.h)" OFF)
set(FREE_SMALL_OBJECT_SIZE_HINT "0" CACHE STRING
"Try to free the associated pages and file space when objects equal to or larger than that is deallocated")

# -------------------------------------------------------------------------------- #

Expand Down Expand Up @@ -153,63 +140,6 @@ endif ()
# -------------------------------------------------------------------------------- #
# Executables
# -------------------------------------------------------------------------------- #
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "CMAKE_BUILD_TYPE is set as Release")
endif ()

# ---------- MPI ---------- #
find_package(MPI)

# ---------- Configure Metall ---------- #
if (FREE_SMALL_OBJECT_SIZE_HINT GREATER 0)
list(APPEND METALL_DEFS "METALL_FREE_SMALL_OBJECT_SIZE_HINT=${FREE_SMALL_OBJECT_SIZE_HINT}")
message(STATUS "Try to free space for objects >= ${FREE_SMALL_OBJECT_SIZE_HINT} bytes")
endif ()

if (VERBOSE_SYSTEM_SUPPORT_WARNING)
list(APPEND METALL_DEFS "METALL_VERBOSE_SYSTEM_SUPPORT_WARNING")
message(STATUS "Show compile time warning regarding system support")
endif ()

if (DISABLE_FREE_FILE_SPACE)
list(APPEND METALL_DEFS "METALL_DISABLE_FREE_FILE_SPACE")
message(STATUS "Disable freeing file space in Metall")
endif ()

if (DISABLE_SMALL_OBJECT_CACHE)
list(APPEND METALL_DEFS "METALL_DISABLE_OBJECT_CACHE")
message(STATUS "Disable small object cache")
endif ()

if (DEFAULT_VM_RESERVE_SIZE GREATER 0)
list(APPEND METALL_DEFS "METALL_DEFAULT_VM_RESERVE_SIZE=${DEFAULT_VM_RESERVE_SIZE}")
message(STATUS "METALL_DEFAULT_VM_RESERVE_SIZE=${DEFAULT_VM_RESERVE_SIZE}")
endif ()

if (MAX_SEGMENT_SIZE GREATER 0)
list(APPEND METALL_DEFS "METALL_MAX_SEGMENT_SIZE=${MAX_SEGMENT_SIZE}")
message(STATUS "METALL_MAX_SEGMENT_SIZE=${MAX_SEGMENT_SIZE}")
endif ()

if (INITIAL_SEGMENT_SIZE GREATER 0)
list(APPEND METALL_DEFS "METALL_INITIAL_SEGMENT_SIZE=${INITIAL_SEGMENT_SIZE}")
message(STATUS "METALL_INITIAL_SEGMENT_SIZE=${INITIAL_SEGMENT_SIZE}")
endif ()

if (USE_SORTED_BIN)
list(APPEND METALL_DEFS "METALL_USE_SORTED_BIN")
message(STATUS "Use VM space aware algorithm in the bin directory")
endif ()

if (USE_ANONYMOUS_NEW_MAP)
if (USE_ANONYMOUS_NEW_MAP AND UMAP_ROOT)
message(FATAL_ERROR "USE_ANONYMOUS_NEW_MAP and UMAP_ROOT options cannot coexist")
endif ()

list(APPEND METALL_DEFS "METALL_USE_ANONYMOUS_NEW_MAP")
message(STATUS "Use the anonymous map for new map region")
endif ()

# Requirements for GCC
if (NOT RUN_BUILD_AND_TEST_WITH_CI)
Expand All @@ -220,6 +150,18 @@ if (NOT RUN_BUILD_AND_TEST_WITH_CI)
endif ()
endif ()

# ---------- Metall Macros ---------- #
foreach(X ${COMPILER_DEFS})
message(STATUS "Metall compile definition: ${X}")
endforeach()


# ---------- CMAKE_BUILD_TYPE ---------- #
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "CMAKE_BUILD_TYPE is set as Release")
endif ()


# ---------- Threads ---------- #
find_package(Threads REQUIRED)
Expand Down Expand Up @@ -304,8 +246,8 @@ function(common_setup_for_metall_executable name)
# --------------------

# ----- Compile Definitions ----- #
foreach(X IN LISTS METALL_DEFS)
target_compile_definitions(${name} PRIVATE ${X})
foreach(X ${COMPILER_DEFS})
target_compile_definitions(${name} PRIVATE ${X})
endforeach()
# --------------------

Expand All @@ -325,7 +267,7 @@ function(common_setup_for_metall_executable name)
target_include_directories(${name} PRIVATE ${UMAP_ROOT}/include)
if (LIBUMAP)
target_link_libraries(${name} PRIVATE ${LIBUMAP})
target_compile_definitions(${name} PRIVATE METALL_USE_UMAP)
target_compile_definitions(${name} PRIVATE "METALL_USE_UMAP")
endif ()
endif ()
# --------------------
Expand Down
29 changes: 7 additions & 22 deletions bench/adjacency_list/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
find_package(OpenMP)
if (NOT OpenMP_CXX_FOUND)
MESSAGE(STATUS "OpenMP is not found. Use single thread in adjacency_list.")
endif ()
include(setup_omp)

add_metall_executable(run_adj_list_bench_stl run_adj_list_bench_stl.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_stl PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_stl)

add_metall_executable(run_adj_list_bench_bip run_adj_list_bench_bip.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_bip PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_bip)

add_metall_executable(run_adj_list_bench_bip_extend run_adj_list_bench_bip_extend.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_bip_extend PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_bip_extend)

add_metall_executable(run_adj_list_bench_metall run_adj_list_bench_metall.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_metall PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_metall)

add_metall_executable(run_adj_list_bench_reflink_snapshot run_adj_list_bench_reflink_snapshot.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_reflink_snapshot PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_reflink_snapshot)

if (MEMKIND_ROOT)
add_metall_executable(run_adj_list_bench_pmem run_adj_list_bench_pmem.cpp)
Expand All @@ -39,9 +26,7 @@ if (MEMKIND_ROOT)
message(FATAL_ERROR "Cannot find memkind library")
endif ()
endif ()
if (OpenMP_CXX_FOUND)
target_link_libraries(run_adj_list_bench_pmem PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_adj_list_bench_pmem)
endif ()

configure_file(run_bench.sh run_bench.sh COPYONLY)
Expand Down
4 changes: 1 addition & 3 deletions bench/adjacency_list/edge_generator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
add_metall_executable(generate_rmat_edge_list generate_rmat_edge_list.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(generate_rmat_edge_list PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(generate_rmat_edge_list)
4 changes: 2 additions & 2 deletions bench/adjacency_list/edge_generator/rmat_edge_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class rmat_edge_generator_iterator {
const uint64_t mask = (1ULL << m_ptr_parent->m_vertex_scale) - 1;
// Assume utility::hash is a good hash function
m_current_edge.first =
metall::utility::hash<uint64_t>()(m_current_edge.first) & mask;
metall::utility::hash<>()(m_current_edge.first) & mask;
m_current_edge.second =
metall::utility::hash<uint64_t>()(m_current_edge.second) & mask;
metall::utility::hash<>()(m_current_edge.second) & mask;
}
++m_num_generated_edges;
}
Expand Down
4 changes: 2 additions & 2 deletions bench/adjacency_list/test/compare_key_value_lists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
using key_type = uint64_t;
using value_type = uint64_t;
using item_type = std::pair<key_type, value_type>;
using table_type = std::unordered_map<item_type, std::size_t,
metall::utility::hash<item_type>>;
using table_type =
std::unordered_map<item_type, std::size_t, metall::utility::hash<>>;

void ingest_item(const std::string& file_name, table_type* table) {
std::ifstream ifs(file_name);
Expand Down
3 changes: 2 additions & 1 deletion bench/adjacency_list/test/test_large.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ a=0.57
b=0.19
c=0.19
seed=123
e=$((2**$((${v}+4)))) # The number of edges to generate

# The default path to store data.
# This value is overwritten if '-d' option is specified
Expand Down Expand Up @@ -78,6 +77,8 @@ main() {
ref_edge_dump_file1="${out_dir_path}/ref_edge_list1"
ref_edge_dump_file2="${out_dir_path}/ref_edge_list2"

local e=$((2**$((${v}+4)))) # The number of edges to generate

./run_adj_list_bench_metall -o ${data_store_path} -d ${adj_list_dump_file} -s ${seed} -v ${v} -e ${e} -a ${a} -b ${b} -c ${c} -r 1 -u 1 -D ${ref_edge_dump_file1}
check_program_exit_status
echo ""
Expand Down
17 changes: 4 additions & 13 deletions bench/bfs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
find_package(OpenMP)
if (NOT OpenMP_CXX_FOUND)
MESSAGE(STATUS "OpenMP is not found. Use single thread in BFS")
endif()
include(setup_omp)

add_metall_executable(run_bfs_bench_metall run_bfs_bench_metall.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_bfs_bench_metall PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_bfs_bench_metall)

add_metall_executable(run_bfs_bench_metall_multiple run_bfs_bench_metall_multiple.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_bfs_bench_metall_multiple PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_bfs_bench_metall_multiple)

add_metall_executable(run_bfs_bench_bip run_bfs_bench_bip.cpp)
if (OpenMP_CXX_FOUND)
target_link_libraries(run_bfs_bench_bip PRIVATE OpenMP::OpenMP_CXX)
endif ()
setup_omp_target(run_bfs_bench_bip)

configure_file(run_bench.sh run_bench.sh COPYONLY)
13 changes: 7 additions & 6 deletions bench/data_structure/multithread_adjacency_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ class multithread_adjacency_list {

using key_table_allocator_type = container::scoped_allocator_adaptor<
other_allocator_type<std::pair<const key_type, list_type>>>;
using key_table_type = container::unordered_map<
key_type, list_type, metall::utility::hash<key_type>,
std::equal_to<key_type>, key_table_allocator_type>;
using key_table_type =
container::unordered_map<key_type, list_type, metall::utility::hash<>,
std::equal_to<key_type>,
key_table_allocator_type>;

using bank_table_allocator_type =
container::scoped_allocator_adaptor<other_allocator_type<key_table_type>>;
Expand Down Expand Up @@ -81,9 +82,9 @@ class multithread_adjacency_list {
m_bank_table[bank_index(key)][key].emplace_back(std::move(value));
#else
m_bank_table[bank_index(key)][key].emplace_back(std::move(value));
// m_bank_table[bank_index(key)].try_emplace(key,
// list_allocator_type(m_bank_table.get_allocator()));
// m_bank_table[bank_index(key)].at(key).emplace_back(std::move(value));
// m_bank_table[bank_index(key)].try_emplace(key,
// list_allocator_type(m_bank_table.get_allocator()));
// m_bank_table[bank_index(key)].at(key).emplace_back(std::move(value));
#endif
#else
// MEMO: GCC does not work with STL Containers (tested with GCC 10.2.0 on
Expand Down
14 changes: 14 additions & 0 deletions cmake/setup_mpi.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if (MPI_CXX_FOUND)
find_package(MPI)
endif ()

function(setup_mpi_target target)
if (MPI_CXX_FOUND)
target_link_libraries(${target} PRIVATE MPI::MPI_CXX)
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(${target} PRIVATE rt)
endif ()
else ()
message(SEND_ERROR "MPI not found, ${target} will not be built")
endif ()
endfunction()
11 changes: 11 additions & 0 deletions cmake/setup_omp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if (NOT OpenMP_CXX_FOUND)
find_package(OpenMP)
endif ()

function(setup_omp_target target)
if (OpenMP_CXX_FOUND)
target_link_libraries(${target} PUBLIC OpenMP::OpenMP_CXX)
else ()
message(WARNING "OpenMP not found, ${target} will not be built with OpenMP support")
endif ()
endfunction()
6 changes: 2 additions & 4 deletions 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.26
PROJECT_NUMBER = v0.27

# 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 Expand Up @@ -835,8 +835,6 @@ INPUT = ../include/metall \
../include/metall/json \
../include/metall/container/experimental/jgraph \
../include/metall/utility \
../include/metall/detail/base_stl_allocator.hpp \
../include/metall/detail/utility/named_proxy.hpp \
../example/graph_data_structure \
../example/json

Expand Down Expand Up @@ -2139,7 +2137,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/advanced_build/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake build_doc # option; BUILD_DOC must be ON when running cmake

## Required

- CMake 3.10 or more.
- CMake 3.12 or more.
- GCC 8.1 or more.
- Boost C++ Libraries 1.64 or more (build is not required; needs only their header files).

Expand Down
Loading

0 comments on commit b49d865

Please sign in to comment.