Skip to content

Commit

Permalink
Enable page size and write-only control in posix adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan committed Nov 16, 2021
1 parent ddceb25 commit 404b02b
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 285 deletions.
8 changes: 5 additions & 3 deletions adapter/include/hermes/adapter/mpiio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
/**
* Internal headers
*/
#include <bucket.h>
#include <hermes.h>
#include <bucket.h>
#include <vbucket.h>

#include <hermes/adapter/constants.h>
#include <hermes/adapter/singleton.h>
#include <hermes/adapter/interceptor.h>
#include <hermes/adapter/mpiio/mapper/mapper_factory.h>
#include <hermes/adapter/singleton.h>
#include <vbucket.h>

#include <hermes/adapter/interceptor.cc>
#include <hermes/adapter/mpiio/metadata_manager.cc>
Expand Down
8 changes: 5 additions & 3 deletions adapter/include/hermes/adapter/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@
/**
* Internal headers
*/
#include <bucket.h>
#include <hermes.h>
#include <bucket.h>
#include <vbucket.h>

#include <hermes/adapter/constants.h>
#include <hermes/adapter/interceptor.h>
#include <hermes/adapter/singleton.h>
#include <hermes/adapter/posix/common/constants.h>
#include <hermes/adapter/posix/common/datastructures.h>
#include <hermes/adapter/posix/mapper/mapper_factory.h>
#include <hermes/adapter/posix/metadata_manager.h>
#include <hermes/adapter/singleton.h>
#include <vbucket.h>

/**
* Function declarations
Expand Down
1 change: 1 addition & 0 deletions adapter/include/hermes/adapter/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
#include <bucket.h>
#include <hermes.h>
#include <hermes/adapter/constants.h>
#include <hermes/adapter/interceptor.h>
#include <hermes/adapter/singleton.h>
#include <hermes/adapter/stdio/common/constants.h>
Expand Down
38 changes: 38 additions & 0 deletions adapter/src/hermes/adapter/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef HERMES_ADAPTER_CONSTANTS_H
#define HERMES_ADAPTER_CONSTANTS_H

#include <glog/logging.h>

/**
* Constants file for all adapter.
* This file contains common constants across different adapters.
Expand Down Expand Up @@ -88,4 +90,40 @@ const char* kAdapterScratchMode = "SCRATCH";
* Default value: \c 1
*/
const char* kStopDaemon = "HERMES_STOP_DAEMON";

/**
* The page size in bytes when mapping files to Hermes Blobs. Hermes will be
* more efficient if you set this number to the most common size of writes in
* your application. This is set via HERMES_PAGE_SIZE.
*
* Example: With a page size of 1MiB, a 100 MiB file will be mapped to 100, 1MiB
* Blobs. In this scenario, doing several smaller writes within the same 1MiB
* region will cause all of those writes to transfer 1MiB of data, which is why
* it's important to align the page size to your workload.
*/
const size_t kPageSize = []() {
const char *kPageSizeVar = "HERMES_PAGE_SIZE";
const size_t kDefaultPageSize = 1 * 1024 * 1024;

size_t result = kDefaultPageSize;
char *page_size = getenv(kPageSizeVar);

if (page_size) {
result = (size_t)std::strtoull(page_size, NULL, 0);
if (result == 0) {
LOG(FATAL) << "Invalid value of " << kPageSizeVar << ": " << page_size;
}
}

LOG(INFO) << "Adapter page size: " << result << "\n";

return result;
}();

/**
* Set this environment variable to '1' for more efficient performance on
* workloads that are write-only.
*/
const char* kHermesWriteOnlyVar = "HERMES_WRITE_ONLY";

#endif // HERMES_ADAPTER_CONSTANTS_H
1 change: 0 additions & 1 deletion adapter/src/hermes/adapter/interceptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <regex>

#include <buffer_pool_internal.h>
#include <hermes/adapter/constants.h>
#include <hermes/adapter/enumerations.h>
#include <hermes/adapter/singleton.h>

Expand Down
9 changes: 1 addition & 8 deletions adapter/src/hermes/adapter/mpiio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ set(MPIIO_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/common/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/common/constants.h)

set(MPIIO_INTERNAL_ADAPTER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.cc
${CMAKE_CURRENT_SOURCE_DIR}/mapper/balanced_mapper.cc)

# Add library hermes_mpiio
add_library(hermes_mpiio SHARED ${MPIIO_ADAPTER_PRIVATE_HEADER} ${MPIIO_ADAPTER_PUBLIC_HEADER} ${MPIIO_ADAPTER_SRC})
add_dependencies(hermes_mpiio hermes)
target_link_libraries(hermes_mpiio hermes MPI::MPI_CXX)

add_library(hermes_mpiio_internal SHARED ${MPIIO_ADAPTER_PRIVATE_HEADER} ${MPIIO_ADAPTER_PUBLIC_HEADER} ${MPIIO_INTERNAL_ADAPTER_SRC})
add_dependencies(hermes_mpiio_internal hermes)
target_link_libraries(hermes_mpiio_internal hermes MPI::MPI_CXX)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
#-----------------------------------------------------------------------------
Expand All @@ -46,4 +39,4 @@ install(
#-----------------------------------------------------------------------------
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(hermes_mpiio)
endif()
endif()
5 changes: 1 addition & 4 deletions adapter/src/hermes/adapter/mpiio/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ using hermes::adapter::mpiio::MapperType;
* Which mapper to be used by MPIIO adapter.
*/
const MapperType kMapperType = MapperType::BALANCED;
/**
* Define kPageSize for balanced mapping.
*/
const size_t kPageSize = 1024 * 1024;

/**
* String delimiter
*/
Expand Down
9 changes: 1 addition & 8 deletions adapter/src/hermes/adapter/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ set(POSIX_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/common/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/common/constants.h)

set(POSIX_INTERNAL_ADAPTER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.cc
${CMAKE_CURRENT_SOURCE_DIR}/mapper/balanced_mapper.cc)

# Add library hermes_posix
add_library(hermes_posix SHARED ${POSIX_ADAPTER_PRIVATE_HEADER} ${POSIX_ADAPTER_PUBLIC_HEADER} ${POSIX_ADAPTER_SRC})
add_dependencies(hermes_posix hermes)
target_link_libraries(hermes_posix hermes MPI::MPI_CXX)

add_library(hermes_posix_internal SHARED ${POSIX_ADAPTER_PRIVATE_HEADER} ${POSIX_ADAPTER_PUBLIC_HEADER} ${POSIX_INTERNAL_ADAPTER_SRC})
add_dependencies(hermes_posix_internal hermes)
target_link_libraries(hermes_posix_internal hermes MPI::MPI_CXX)

#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install
#-----------------------------------------------------------------------------
Expand All @@ -46,4 +39,4 @@ install(
#-----------------------------------------------------------------------------
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(hermes_posix)
endif()
endif()
5 changes: 1 addition & 4 deletions adapter/src/hermes/adapter/posix/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ using hermes::adapter::posix::MapperType;
* Which mapper to be used by POSIX adapter.
*/
const MapperType kMapperType = MapperType::BALANCED;
/**
* Define kPageSize for balanced mapping.
*/
const size_t kPageSize = 1024 * 1024;

/**
* String delimiter
*/
Expand Down
Loading

0 comments on commit 404b02b

Please sign in to comment.