Skip to content

Commit

Permalink
Merge 6248005 into 71cb9c0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan committed Jan 26, 2022
2 parents 71cb9c0 + 6248005 commit 2acfbbf
Show file tree
Hide file tree
Showing 20 changed files with 1,757 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
sudo apt update
sudo apt-get install -y autoconf
sudo apt-get install -y automake
sudo apt-get install -y libtool
sudo apt-get install -y libtool-bin
sudo apt-get install -y mpich
sudo apt-get install -y lcov
sudo apt-get install -y zlib1g-dev
Expand Down
64 changes: 32 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ option(HERMES_BUILD_BENCHMARKS "Build the Hermes benchmark suite." OFF)
option(HERMES_ENABLE_TIMING "Turn on timing of selected functions." OFF)
option(HERMES_ENABLE_COVERAGE "Enable code coverage." OFF)
option(HERMES_ENABLE_ADAPTERS "Enable hermes adapters." ON)
option(HERMES_ENABLE_VFD "Build the Hermes HDF5 Virtual File Driver" OFF)
option(HERMES_ENABLE_WRAPPER "Enable hermes C API wrapper." ON)
option(HERMES_INSTALL_TESTS "Enable installation of tests." OFF)
# Calculate code coverage with debug mode
Expand Down Expand Up @@ -183,10 +184,11 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
CACHE STRING "" FORCE)
endif()

if (HERMES_USE_ADDRESS_SANITIZER AND
NOT "${CMAKE_CXX_FLAGS_DEBUG}" MATCHES ".*-fsanitize=address.*")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address"
if (HERMES_USE_ADDRESS_SANITIZER)
if(NOT "${CMAKE_CXX_FLAGS_DEBUG}" MATCHES ".*-fsanitize=address.*")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address"
CACHE STRING "" FORCE)
endif()
else()
string(REPLACE
"-fsanitize=address" "" FLAGS_NO_SANITIZE "${CMAKE_CXX_FLAGS_DEBUG}")
Expand All @@ -197,10 +199,11 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(FATAL_ERROR "Cannont use -fsanitize=address and -fsanitize=thread "
"at the same time")
else()
if (HERMES_USE_THREAD_SANITIZER AND
NOT "${CMAKE_CXX_FLAGS_DEBUG}" MATCHES ".*-fsanitize=thread.*")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread"
CACHE STRING "" FORCE)
if (HERMES_USE_THREAD_SANITIZER)
if(NOT "${CMAKE_CXX_FLAGS_DEBUG}" MATCHES ".*-fsanitize=thread.*")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread"
CACHE STRING "" FORCE)
endif()
else()
string(REPLACE
"-fsanitize=thread" "" FLAGS_NO_SANITIZE "${CMAKE_CXX_FLAGS_DEBUG}")
Expand Down Expand Up @@ -334,10 +337,6 @@ if(HERMES_HAVE_GOTCHA)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/gotcha_intercept)
endif()

if(HERMES_ENABLE_ADAPTERS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/adapter)
endif()

if(HERMES_ENABLE_WRAPPER)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/wrapper)
endif()
Expand All @@ -346,6 +345,28 @@ if(HERMES_BUILD_BUFFER_POOL_VISUALIZER AND SDL2_FOUND)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/buffer_pool_visualizer)
endif()

#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
include(CTest)
if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
find_package(Catch2 REQUIRED)
find_program(IOR_EXE ior)
if(IOR_EXE)
message(STATUS "Found ior at ${IOR_EXE}")
set(HERMES_HAVE_IOR "YES")
else()
message(WARNING "Couldn't find the 'ior' executable. Some tests will be skipped.")
set(HERMES_HAVE_IOR "NO")
endif()
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()

if(HERMES_ENABLE_ADAPTERS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/adapter)
endif()

#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
Expand All @@ -365,27 +386,6 @@ if(HERMES_ENABLE_DOXYGEN)
)
endif()

#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(CMAKE_PROJECT_NAME STREQUAL HERMES)
include(CTest)
endif()

if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
find_package(Catch2 REQUIRED)
find_program(IOR_EXE ior)
if(IOR_EXE)
message(STATUS "Found ior at ${IOR_EXE}")
set(HERMES_HAVE_IOR "YES")
else()
message(WARNING "Couldn't find the 'ior' executable. Some tests will be skipped.")
set(HERMES_HAVE_IOR "NO")
endif()
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()

#-----------------------------------------------------------------------------
# Benchmarks
#-----------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ add_subdirectory(posix)
add_subdirectory(mpiio)
add_subdirectory(pubsub)

if(HERMES_ENABLE_VFD)
if(HERMES_ENABLE_WRAPPER)
add_subdirectory(vfd)
else()
message(FATAL_ERROR "The Hermes VFD requires HERMES_ENABLE_WRAPPER=ON")
endif()
endif()

if(BUILD_TESTING)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
Expand Down
3 changes: 3 additions & 0 deletions adapter/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/posix)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/stdio)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mpiio)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pubsub)
if(HERMES_ENABLE_VFD)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vfd)
endif()

install(
TARGETS
Expand Down
39 changes: 39 additions & 0 deletions adapter/test/vfd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
set(HERMES_VFD_DIR ${HERMES_ADAPTER_DIR}/vfd)

set(hermes_vfd_tests
hermes_vfd_test
)

foreach(vfd_test ${hermes_vfd_tests})
add_executable(${vfd_test} ${CMAKE_CURRENT_SOURCE_DIR}/${vfd_test}.cc)
add_dependencies(${vfd_test} hermes)
target_include_directories(${vfd_test} PRIVATE ${HERMES_VFD_DIR})
target_include_directories(${vfd_test}
SYSTEM PUBLIC ${HDF5_HERMES_VFD_EXT_INCLUDE_DEPENDENCIES}
)
target_link_libraries(${vfd_test}
MPI::MPI_CXX
hermes
${HDF5_HERMES_VFD_EXPORTED_LIBS}
${HDF5_HERMES_VFD_EXT_LIB_DEPENDENCIES}
${HDF5_HERMES_VFD_EXT_PKG_DEPENDENCIES}
)
add_test(NAME "Test${vfd_test}" COMMAND ${vfd_test})
set_property(TEST "Test${vfd_test}"
PROPERTY ENVIRONMENT HERMES_CONF=${CMAKE_CURRENT_SOURCE_DIR}/hermes.conf)
set_property(TEST "Test${vfd_test}" APPEND
PROPERTY ENVIRONMENT LSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/test/data/asan.supp)
endforeach()

# IOR tests
if(HERMES_HAVE_IOR)
add_test(NAME "TestVFDWrite" COMMAND ${IOR_EXE} -a HDF5 -w -W -r -R)
set_property(TEST "TestVFDWrite"
PROPERTY ENVIRONMENT HERMES_CONF=${CMAKE_CURRENT_SOURCE_DIR}/hermes.conf)
set_property(TEST "TestVFDWrite" APPEND
PROPERTY ENVIRONMENT HDF5_PLUGIN_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set_property(TEST "TestVFDWrite" APPEND
PROPERTY ENVIRONMENT HDF5_DRIVER_CONFIG=true\ 1024)
set_property(TEST "TestVFDWrite" APPEND
PROPERTY ENVIRONMENT HDF5_DRIVER=hermes)
endif()
48 changes: 48 additions & 0 deletions adapter/test/vfd/hermes.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
num_devices = 4;
num_targets = 4;

capacities_mb = {50, 50, 50, 50};
block_sizes_kb = {1, 1, 1, 1};
num_slabs = {1, 1, 1, 1};

slab_unit_sizes = {
{1},
{1},
{1},
{1},
};

desired_slab_percentages = {
{1},
{1},
{1},
{1},
};

bandwidths_mbps = {6000, 300, 150, 70};
latencies_us = {15, 250000, 500000, 1000000};

buffer_pool_arena_percentage = 0.85;
metadata_arena_percentage = 0.04;
transient_arena_percentage = 0.11;

max_buckets_per_node = 16;
max_vbuckets_per_node = 8;
system_view_state_update_interval_ms = 1000;

mount_points = {"", "./", "./", "./"};
is_shared_device = {0, 0, 0, 0};
swap_mount = "./";
num_buffer_organizer_retries = 3;
rpc_server_base_name = "localhost";
rpc_server_suffix = "";
rpc_protocol = "ofi+sockets";
rpc_domain = "";
rpc_port = 8080;
buffer_organizer_port = 8081;
rpc_host_number_range = {};
rpc_num_threads = 1;
buffer_organizer_num_threads = 4;
buffer_pool_shmem_name = "/hermes_buffer_pool_";
default_placement_policy = "RoundRobin";
default_rr_split = 0;
90 changes: 90 additions & 0 deletions adapter/test/vfd/hermes_vfd_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>

#include <mpi.h>
#include <hdf5.h>
/* HDF5 header for dynamic plugin loading */
#include <H5PLextern.h>

#include "H5FDhermes.h"

void AssertFunc(bool expr, const char *file, int lineno, const char *message) {
if (!expr) {
fprintf(stderr, "Assertion failed at %s: line %d: %s\n", file, lineno,
message);
exit(-1);
}
}

#define Assert(expr) AssertFunc((expr), __FILE__, __LINE__, #expr)

int main(int argc, char *argv[]) {
hid_t file_id;
hid_t dset_id;
hid_t dataspace_id;
hid_t fapl_id;
hsize_t dims[2];
const char *file_name = "hermes_test.h5";
const int kNx = 128;
const int kNy = 128;
int data_in[kNx][kNy]; /* data to write */
int data_out[kNx][kNy]; /* data to read */
int i, j;

int mpi_threads_provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &mpi_threads_provided);
if (mpi_threads_provided < MPI_THREAD_MULTIPLE) {
fprintf(stderr,
"Didn't receive appropriate MPI threading specification\n");
return 1;
}

const char kDatasetName[] = "IntArray";
dims[0] = kNx;
dims[1] = kNy;

Assert((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) >= 0);
Assert(H5Pset_fapl_hermes(fapl_id, true, 1024) >= 0);

Assert((file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT,
fapl_id)) >= 0);
Assert((dataspace_id = H5Screate_simple(2, dims, NULL)) >= 0);
dset_id = H5Dcreate(file_id, kDatasetName, H5T_NATIVE_INT, dataspace_id,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
Assert(dset_id >= 0);

for (j = 0; j < kNx; j++) {
for (i = 0; i < kNy; i++) {
data_in[j][i] = i + j;
data_out[j][i] = 0;
}
}

Assert(H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data_in) >= 0);
Assert(H5Dclose(dset_id) >= 0);
Assert(H5Fclose(file_id) >= 0);

hid_t fid;
Assert((fid = H5Fopen(file_name, H5F_ACC_RDONLY, H5P_DEFAULT)) >= 0);
Assert((dset_id = H5Dopen(fid, kDatasetName, H5P_DEFAULT)) >= 0);
Assert(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data_out) >= 0);

for (j = 0; j < kNx; j++) {
for (i = 0; i < kNy; i++) {
Assert(data_out[j][i] == data_in[j][i]);
}
}

Assert(H5Dclose(dset_id) >= 0);
Assert(H5Fclose(fid) >= 0);
Assert(H5Sclose(dataspace_id) >= 0);
Assert(H5Pclose(fapl_id) >= 0);
remove(file_name);

return 0;
}
Loading

0 comments on commit 2acfbbf

Please sign in to comment.