Skip to content

Commit

Permalink
Merge pull request #315 from HDFGroup/chogan/adapter_reorg
Browse files Browse the repository at this point in the history
Reorganize adapter file structure and simplify CMake files
  • Loading branch information
ChristopherHogan committed Jan 6, 2022
2 parents 600c9a0 + 3bc2a8c commit dca824a
Show file tree
Hide file tree
Showing 60 changed files with 223 additions and 306 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ endif()

project(HERMES)

include_directories(${PROJECT_BINARY_DIR})

#------------------------------------------------------------------------------
# Version information
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -329,18 +327,20 @@ endif()
#-----------------------------------------------------------------------------
# Source
#-----------------------------------------------------------------------------

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)

if(HERMES_HAVE_GOTCHA)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/gotcha_intercept)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)

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

if(HERMES_ENABLE_WRAPPER)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/wrapper)
endif()
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mpi_io_adapter)
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/hermes_vol)

if(HERMES_BUILD_BUFFER_POOL_VISUALIZER AND SDL2_FOUND)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/buffer_pool_visualizer)
Expand Down Expand Up @@ -374,10 +374,8 @@ endif()

if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
find_package(Catch2 REQUIRED)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
if(HERMES_ENABLE_ADAPTERS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/adapter/test)
endif()
endif()

#-----------------------------------------------------------------------------
Expand Down
18 changes: 8 additions & 10 deletions adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Set hermes to preload if adapter is linked.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHERMES_PRELOAD -DHERMES_RPC_THALLIUM")

# include directory for absolute references to files and headers.
include_directories(${CMAKE_SOURCE_DIR}/adapter/include
${CMAKE_SOURCE_DIR}/adapter/src)
set(HERMES_ADAPTER_DIR ${CMAKE_SOURCE_DIR}/adapter)

# add stdio adapter
add_subdirectory(src/hermes/adapter/stdio)
add_subdirectory(stdio)
add_subdirectory(posix)
add_subdirectory(mpiio)

# add posix adapter
add_subdirectory(src/hermes/adapter/posix)

# add mpiio adapter
add_subdirectory(src/hermes/adapter/mpiio)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <regex>
#include <experimental/filesystem>

#include "hermes/adapter/utils.h"
#include "adapter_utils.h"

namespace fs = std::experimental::filesystem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@

#include <dlfcn.h>
#include <stdlib.h>
#include <utils.h>

#include <fstream>
#include <string>
#include <unordered_set>
#include <vector>
#include <regex>

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

/**
* Define Interceptor list for adapter.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
project(MPIIOAdapter VERSION 0.1.0)

# include directories for mpiio headers
include_directories(${CMAKE_SOURCE_DIR}/adapter/include)

# MPIIO src code. We only include mpiio.cc as it includes other cc to reduce compilation time.
set(MPIIO_ADAPTER_SRC mpiio.cc)

set(HERMES_MPIIO_ADAPTER_DIR ${HERMES_ADAPTER_DIR}/mpiio)

# Only mpiio.h is the public adapter.
set(MPIIO_ADAPTER_PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/adapter/include/hermes/adapter/mpiio.h)
set(MPIIO_ADAPTER_PUBLIC_HEADER ${HERMES_MPIIO_ADAPTER_DIR}/mpiio.h)
# Private headers
set(MPIIO_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/mapper_factory.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/abstract_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/balanced_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/common/datastructures.h
${CMAKE_CURRENT_SOURCE_DIR}/common/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/common/constants.h)
${CMAKE_CURRENT_SOURCE_DIR}/datastructures.h
${CMAKE_CURRENT_SOURCE_DIR}/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/constants.h)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@
#ifndef HERMES_MPIIO_COMMON_CONSTANTS_H
#define HERMES_MPIIO_COMMON_CONSTANTS_H

/**
* Standard header
*/

/**
* Dependent library header
*/

/**
* Internal header
*/
#include <hermes/adapter/mpiio/common/enumerations.h>
#include "mpiio/enumerations.h"

/**
* Constants file for MPIIO adapter.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@

#ifndef HERMES_MPIIO_ADAPTER_ABSTRACT_ADAPTER_H
#define HERMES_MPIIO_ADAPTER_ABSTRACT_ADAPTER_H
/**
* Standard headers
*/
/**
* Dependent library headers
*/
/**
* Internal headers
*/
#include <hermes/adapter/mpiio/common/datastructures.h>

#include "mpiio/datastructures.h"

/**
* Typedef to simplify the return types
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,9 @@
#ifndef HERMES_MPIIO_ADAPTER_BALANCED_MAPPER_H
#define HERMES_MPIIO_ADAPTER_BALANCED_MAPPER_H

/**
* Standard header
*/
#include <vector>

/**
* Dependent library header
*/

/**
* Internal header
*/
#include <hermes/adapter/mpiio/common/constants.h>

#include "mpiio/constants.h"
#include "abstract_mapper.h"

namespace hermes::adapter::mpiio {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#ifndef HERMES_MPIIO_ADAPTER_ADAPTER_FACTORY_H
#define HERMES_MPIIO_ADAPTER_ADAPTER_FACTORY_H

#include <hermes/adapter/singleton.h>
#include <hermes/adapter/mpiio/common/enumerations.h>
#include "singleton.h"
#include "mpiio/enumerations.h"

#include "abstract_mapper.h"
#include "balanced_mapper.h"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,17 @@
#ifndef HERMES_MPIIO_ADAPTER_METADATA_MANAGER_H
#define HERMES_MPIIO_ADAPTER_METADATA_MANAGER_H

/**
* Standard headers
*/
#include <ftw.h>

#include <unordered_map>

/**
* Internal headers
*/
#include <hermes/adapter/constants.h>
#include <hermes/adapter/enumerations.h>
#include <hermes/adapter/interceptor.h>
#include <hermes/adapter/mpiio/common/constants.h>
#include <hermes/adapter/mpiio/common/datastructures.h>
#include <mpi.h>

#include "constants.h"
#include "enumerations.h"
#include "interceptor.h"
#include "mpiio/constants.h"
#include "mpiio/datastructures.h"

namespace hermes::adapter::mpiio {
/**
* Metadata manager for MPIIO adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
* have access to the file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/**
* Internal headers
*/
#include <hermes/adapter/mpiio.h>
#include <thread_pool.h>
#include "mpiio/mpiio.h"

#include "thread_pool.h"
#include "adapter_utils.cc"
#include "mpiio/mapper/balanced_mapper.cc"

#include <hermes/adapter/utils.cc>
#include <hermes/adapter/mpiio/mapper/balanced_mapper.cc>
/**
* Namespace declarations
*/
Expand Down
14 changes: 7 additions & 7 deletions adapter/include/hermes/adapter/mpiio.h → adapter/mpiio/mpiio.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
#include <bucket.h>
#include <vbucket.h>

#include <hermes/adapter/utils.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 "adapter_utils.h"
#include "constants.h"
#include "singleton.h"
#include "interceptor.h"
#include "mpiio/mapper/mapper_factory.h"

#include <hermes/adapter/interceptor.cc>
#include <hermes/adapter/mpiio/metadata_manager.cc>
#include "interceptor.cc"
#include "mpiio/metadata_manager.cc"

/**
* Function declaration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
project(PosixAdapter VERSION 0.1.0)

# include directories for posix headers
include_directories(${CMAKE_SOURCE_DIR}/adapter/include)

# POSIX src code. We only include posix.cc as it includes other cc to reduce compilation time.
set(POSIX_ADAPTER_SRC posix.cc)

set(HERMES_POSIX_ADAPTER_DIR ${HERMES_ADAPTER_DIR}/posix)

# Only posix.h is the public adapter.
set(POSIX_ADAPTER_PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/adapter/include/hermes/adapter/posix.h)
set(POSIX_ADAPTER_PUBLIC_HEADER ${HERMES_POSIX_ADAPTER_DIR}/posix.h)
# Private headers
set(POSIX_ADAPTER_PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/mapper_factory.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/abstract_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/mapper/balanced_mapper.h
${CMAKE_CURRENT_SOURCE_DIR}/common/datastructures.h
${CMAKE_CURRENT_SOURCE_DIR}/common/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/common/constants.h)
${CMAKE_CURRENT_SOURCE_DIR}/datastructures.h
${CMAKE_CURRENT_SOURCE_DIR}/enumerations.h
${CMAKE_CURRENT_SOURCE_DIR}/constants.h)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Internal header
*/
#include <hermes/adapter/posix/common/enumerations.h>
#include "posix/enumerations.h"

/**
* Constants file for POSIX adapter.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@

#ifndef HERMES_ABSTRACT_ADAPTER_H
#define HERMES_ABSTRACT_ADAPTER_H
/**
* Standard headers
*/
/**
* Dependent library headers
*/
/**
* Internal headers
*/
#include <hermes/adapter/posix/common/datastructures.h>

#include "posix/datastructures.h"

/**
* Typedef to simplify the return types
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,9 @@
#ifndef HERMES_BALANCED_MAPPER_H
#define HERMES_BALANCED_MAPPER_H

/**
* Standard header
*/
#include <vector>

/**
* Dependent library header
*/

/**
* Internal header
*/
#include <hermes/adapter/posix/common/constants.h>
#include "posix/constants.h"

#include "abstract_mapper.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,8 @@
#ifndef HERMES_ADAPTER_FACTORY_H
#define HERMES_ADAPTER_FACTORY_H

/**
* Standard header
*/

/**
* Dependent library header
*/

/**
* Internal header
*/
#include <hermes/adapter/singleton.h>
#include <hermes/adapter/posix/common/enumerations.h>
#include "singleton.h"
#include "posix/enumerations.h"

#include "abstract_mapper.h"
#include "balanced_mapper.h"
Expand Down
File renamed without changes.
Loading

0 comments on commit dca824a

Please sign in to comment.