Skip to content

Commit

Permalink
Merge pull request #201 from HDFGroup/hari/pr176
Browse files Browse the repository at this point in the history
Replaces #176
  • Loading branch information
ChristopherHogan committed Jun 17, 2021
2 parents 81f9b05 + 204fee2 commit 6211991
Show file tree
Hide file tree
Showing 31 changed files with 1,970 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ __pycache__/
/cmake-build-debug-system/
/src/adapter/posix/cmake-build-debug-system/CMakeFiles/clion-log.txt
/adapter/test/posix/Testing/Temporary/LastTest.log
/.cache/
3 changes: 3 additions & 0 deletions adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ add_subdirectory(src/hermes/adapter/stdio)

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

# add mpiio adapter
add_subdirectory(src/hermes/adapter/mpiio)
107 changes: 106 additions & 1 deletion adapter/include/hermes/adapter/mpiio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,111 @@
#ifndef HERMES_MPIIO_H
#define HERMES_MPIIO_H

class mpiio {};
/**
* Standard header
*/
#include <fcntl.h>
#include <stdarg.h>
#include <unistd.h>

#include <experimental/filesystem>

/**
* Dependent library headers
*/
#include <mpi.h>
#include <mpio.h>

#include "glog/logging.h"

/**
* Internal headers
*/
#include <bucket.h>
#include <hermes.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>

/**
* Function declaration
*/
HERMES_FORWARD_DECL(MPI_File_close, int, (MPI_File * fh));
HERMES_FORWARD_DECL(MPI_File_iread_at, int,
(MPI_File fh, MPI_Offset offset, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_iread, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_iread_shared, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_iwrite_at, int,
(MPI_File fh, MPI_Offset offset, const void *buf, int count,
MPI_Datatype datatype, MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_iwrite, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_iwrite_shared, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Request *request));
HERMES_FORWARD_DECL(MPI_File_open, int,
(MPI_Comm comm, const char *filename, int amode,
MPI_Info info, MPI_File *fh));

HERMES_FORWARD_DECL(MPI_File_read_all, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_read_at_all, int,
(MPI_File fh, MPI_Offset offset, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));

HERMES_FORWARD_DECL(MPI_File_read_at, int,
(MPI_File fh, MPI_Offset offset, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_read, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Status *status));

HERMES_FORWARD_DECL(MPI_File_read_ordered, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_read_shared, int,
(MPI_File fh, void *buf, int count, MPI_Datatype datatype,
MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_sync, int, (MPI_File fh));
HERMES_FORWARD_DECL(MPI_File_write_all, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_write_at_all, int,
(MPI_File fh, MPI_Offset offset, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_write_at, int,
(MPI_File fh, MPI_Offset offset, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_write, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_write_ordered, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_write_shared, int,
(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPI_Status *status));
HERMES_FORWARD_DECL(MPI_File_seek, int,
(MPI_File fh, MPI_Offset offset, int whence));
HERMES_FORWARD_DECL(MPI_File_seek_shared, int,
(MPI_File fh, MPI_Offset offset, int whence));
HERMES_FORWARD_DECL(MPI_File_get_position, int,
(MPI_File fh, MPI_Offset *offset));
/**
* MPI functions declarations
*/
HERMES_FORWARD_DECL(MPI_Init, int, (int *argc, char ***argv));
HERMES_FORWARD_DECL(MPI_Finalize, int, (void));

#endif // HERMES_MPIIO_H
4 changes: 2 additions & 2 deletions adapter/src/hermes/adapter/interceptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const char* kPathInclusions[] = {"/var/opt/cray/dws/mounts/"};
/**
* Splits a string given a delimiter
*/
std::vector<std::string> StringSplit(char* str, char delimiter) {
inline std::vector<std::string> StringSplit(char* str, char delimiter) {
std::stringstream ss(str);
std::vector<std::string> v;
while (ss.good()) {
Expand All @@ -70,7 +70,7 @@ std::vector<std::string> StringSplit(char* str, char delimiter) {
}
return v;
}
std::string GetFilenameFromFP(FILE* fh) {
inline std::string GetFilenameFromFP(FILE* fh) {
const int kMaxSize = 0xFFF;
char proclnk[kMaxSize];
char filename[kMaxSize];
Expand Down
49 changes: 49 additions & 0 deletions adapter/src/hermes/adapter/mpiio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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)

# Only mpiio.h is the public adapter.
set(MPIIO_ADAPTER_PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/adapter/include/hermes/adapter/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)

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
#-----------------------------------------------------------------------------
install(
TARGETS
hermes_mpiio
EXPORT
${HERMES_EXPORTED_TARGETS}
LIBRARY DESTINATION ${HERMES_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${HERMES_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${HERMES_INSTALL_BIN_DIR}
)
#-----------------------------------------------------------------------------
# Add Target(s) to Coverage
#-----------------------------------------------------------------------------
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(hermes_mpiio)
endif()
47 changes: 47 additions & 0 deletions adapter/src/hermes/adapter/mpiio/common/constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Distributed under BSD 3-Clause license. *
* Copyright by The HDF Group. *
* Copyright by the Illinois Institute of Technology. *
* All rights reserved. *
* *
* This file is part of Hermes. The full Hermes copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the top directory. If you do not *
* have access to the file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#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>

/**
* Constants file for MPIIO adapter.
*/
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
*/
const char kStringDelimiter = '#';

#endif // HERMES_MPIIO_COMMON_CONSTANTS_H

0 comments on commit 6211991

Please sign in to comment.