Skip to content

Commit

Permalink
Merge branch 'development' into feat-dash-asyncatomic
Browse files Browse the repository at this point in the history
  • Loading branch information
devreal authored Mar 5, 2018
2 parents 2221556 + 2e59fa1 commit 68bc30c
Show file tree
Hide file tree
Showing 16 changed files with 309 additions and 129 deletions.
2 changes: 0 additions & 2 deletions .gitconfig

This file was deleted.

1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "vendor/googletest"]
path = vendor/googletest
url = https://github.com/google/googletest.git
ignore = all
17 changes: 17 additions & 0 deletions CMakeExt/Code/test_compatible_ompi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <mpi.h>

int main()
{

#if defined(OMPI_MAJOR_VERSION) \
&& OMPI_MAJOR_VERSION > 2 \
|| ( OMPI_MAJOR_VERSION == 2 \
&& OMPI_MINOR_VERSION >= 1 \
&& OMPI_RELEASE_VERSION >= 1)
// Open MPI >=2.1.1 is fine
return 0;
#else
#error "Open MPI version with broken alignment of shared memory windows detected!"
#endif
}

12 changes: 12 additions & 0 deletions CMakeExt/Code/test_mpi_support.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <mpi.h>

int main()
{

#if MPI_VERSION >= 3
return 0;
#else
#error "Support for at least MPI 3.0 required!"
#endif
}

13 changes: 7 additions & 6 deletions CMakeExt/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,20 @@ elseif ("${CMAKE_C_COMPILER_ID}" MATCHES "Cray")
CACHE STRING "C compiler std flag")
endif()

if(${CMAKE_VERSION} VERSION_GREATER 3.0.0 )
if(${CMAKE_VERSION} VERSION_LESS 3.0.0 )
# clear STD flags as set using CXX_STANDARD
set(CXX_STD_FLAG "")
set(CC_STD_FLAG "")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${CXX_STD_FLAG}")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${CC_STD_FLAG}")
endif()

set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${CC_ENV_SETUP_FLAGS}")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${CXX_ENV_SETUP_FLAGS}")

set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${CC_STD_FLAG} ${CC_OMP_FLAG}")
"${CMAKE_C_FLAGS} ${CC_OMP_FLAG}")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${CC_REPORT_FLAG} ${CC_WARN_FLAG}")
set(CMAKE_C_FLAGS_DEBUG
Expand All @@ -236,7 +237,7 @@ set(CMAKE_C_FLAGS_RELEASE
"${CMAKE_C_FLAGS_RELEASE} -Ofast -DDASH_RELEASE")

set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${CXX_STD_FLAG} ${CXX_OMP_FLAG}")
"${CMAKE_CXX_FLAGS} ${CXX_OMP_FLAG}")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${CC_REPORT_FLAG} ${CXX_WARN_FLAG}")
set(CMAKE_CXX_FLAGS_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion CMakeExt/HDF5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if(HDF5_FOUND)
check_symbol_exists(H5_HAVE_PARALLEL "H5pubconf.h" HAVE_H5_PARALLEL)
cmake_pop_check_state()

if(NOT HAVE_H5_PARALLEL)
if(NOT HAVE_H5_PARALLEL OR "${MPI_IMPL_ID}" STREQUAL "")
message(STATUS "HDF5 provides only serial version")
set(HDF5_FOUND OFF CACHE BOOL "HDF5_FOUND" FORCE)
unset(HDF5_LIBRARIES)
Expand Down
195 changes: 147 additions & 48 deletions CMakeExt/MPI.cmake
Original file line number Diff line number Diff line change
@@ -1,57 +1,156 @@
INCLUDE (CheckSymbolExists)
INCLUDE (CMakePushCheckState)

if (NOT $ENV{MPI_C_COMPILER} STREQUAL "")
set(MPI_C_COMPILER $ENV{MPI_C_COMPILER}
CACHE STRING "MPI C compiler")
endif()
if (NOT $ENV{MPI_CXX_COMPILER} STREQUAL "")
set(MPI_CXX_COMPILER $ENV{MPI_CXX_COMPILER}
CACHE STRING "MPI C++ compiler")
endif()

find_package(MPI)

if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
set(MPI_FOUND TRUE CACHE BOOL "Found the MPI library")
if ("${MPI_INCLUDE_PATH}" MATCHES "mpich")
set(MPI_IMPL_IS_MPICH TRUE CACHE BOOL "MPICH detected")
set(MPI_IMPL_ID "mpich" CACHE STRING "MPI implementation identifier")
elseif ("${MPI_INCLUDE_PATH}" MATCHES "cray")
set(MPI_IMPL_IS_CRAY TRUE CACHE BOOL "CrayMPI detected")
set(MPI_IMPL_ID "craympi" CACHE STRING "MPI implementation identifier")
elseif ("${MPI_INCLUDE_PATH}" MATCHES "mvapich")
set(MPI_IMPL_IS_MVAPICH TRUE CACHE BOOL "MVAPICH detected")
set(MPI_IMPL_ID "mvapich" CACHE STRING "MPI implementation identifier")
elseif ("${MPI_INCLUDE_PATH}" MATCHES "impi"
OR "${MPI_INCLUDE_PATH}" MATCHES "intel")
set(MPI_IMPL_IS_INTEL TRUE CACHE BOOL "IntelMPI detected")
set(MPI_IMPL_ID "intelmpi" CACHE STRING "MPI implementation identifier")
elseif ("${MPI_INCLUDE_PATH}" MATCHES "openmpi")
set(MPI_IMPL_IS_OPENMPI TRUE CACHE BOOL "OpenMPI detected")
set(MPI_IMPL_ID "openmpi" CACHE STRING "MPI implementation identifier")
# temporarily disable shared memory windows due to alignment problems
set(ENABLE_SHARED_WINDOWS OFF)
message(WARNING "MPI shared windows disabled due to defective allocation in OpenMPI")
if (NOT DEFINED MPI_IMPL_ID)

if (NOT $ENV{MPI_C_COMPILER} STREQUAL "")
set(MPI_C_COMPILER $ENV{MPI_C_COMPILER}
CACHE STRING "MPI C compiler")
endif()
if (NOT $ENV{MPI_CXX_COMPILER} STREQUAL "")
set(MPI_CXX_COMPILER $ENV{MPI_CXX_COMPILER}
CACHE STRING "MPI C++ compiler")
endif()

# find MPI environment
find_package(MPI)

# helper function that executes the MPI compiler
# on the given source file and sets
# resvar to true if the compile step succeeded
function (check_mpi_compile sourcefile resvar)

# check for MPI-3
get_filename_component(filename ${sourcefile} NAME)
execute_process(
COMMAND "${MPI_C_COMPILER}" -c "${sourcefile}" -o "${CMAKE_BINARY_DIR}/${filename}.o"
RESULT_VARIABLE RETURN_VAL
OUTPUT_VARIABLE OUTPUT
ERROR_VARIABLE OUTPUT
)

if (RETURN_VAL EQUAL 0)
set (${resvar} TRUE PARENT_SCOPE)
else ()
set (${resvar} FALSE PARENT_SCOPE)
message (STATUS "Failed to execute MPI compiler: \n${OUTPUT}")
endif ()

endfunction ()


# Determine MPI implementation

# save current state
cmake_push_check_state()
set (CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH})

# check for Open MPI
check_symbol_exists(
OMPI_MAJOR_VERSION
mpi.h
HAVE_OPEN_MPI
)
if (HAVE_OPEN_MPI)
set (MPI_IMPL_IS_OPENMPI TRUE CACHE BOOL "OpenMPI detected")
set (MPI_IMPL_ID "openmpi" CACHE STRING "MPI implementation identifier")
check_mpi_compile(${CMAKE_SOURCE_DIR}/CMakeExt/Code/test_compatible_ompi.c OMPI_OK)
if (NOT OMPI_OK)
message(WARNING
"Disabling shared memory window support due to defective allocation "
"in OpenMPI <2.1.1")
set (ENABLE_SHARED_WINDOWS OFF)
endif()
endif()

# order matters: all of the following
# implementations also define MPICH
if (NOT DEFINED MPI_IMPL_ID)
# check for Intel MPI
check_symbol_exists(
I_MPI_VERSION
mpi.h
HAVE_I_MPI
)
if (HAVE_I_MPI)
set (MPI_IMPL_IS_INTEL TRUE CACHE BOOL "IntelMPI detected")
set (MPI_IMPL_ID "intelmpi" CACHE STRING "MPI implementation identifier")
endif ()
endif ()

if (NOT DEFINED MPI_IMPL_ID)
# check for MVAPICH
check_symbol_exists(
MVAPICH2_VERSION
mpi.h
HAVE_MVAPICH
)
if (HAVE_MVAPICH)
set (MPI_IMPL_IS_MVAPICH TRUE CACHE BOOL "MVAPICH detected")
set (MPI_IMPL_ID "mvapich" CACHE STRING "MPI implementation identifier")
endif ()
endif ()

if (NOT DEFINED MPI_IMPL_ID)
# check for Cray MPI
check_symbol_exists(
CRAY_MPICH_VERSION
mpi.h
HAVE_CRAY_MPI
)
if (NOT HAVE_CRAY_MPI)
# fall-back for versions prior to MPT 7.6.0
# MPIX_PortName_Backlog is a Cray extension
check_symbol_exists(
MPIX_PortName_Backlog
mpi.h
HAVE_CRAY_MPI
)
endif()
if (HAVE_CRAY_MPI)
set(MPI_IMPL_IS_CRAY TRUE CACHE BOOL "CrayMPI detected")
set(MPI_IMPL_ID "craympi" CACHE STRING "MPI implementation identifier")
endif ()
endif ()

if (NOT DEFINED MPI_IMPL_ID)
# check for MVAPICH
check_symbol_exists(
MPICH
mpi.h
HAVE_MPICH
)
if (HAVE_MPICH)
set (MPI_IMPL_IS_MPICH TRUE CACHE BOOL "MPICH detected")
set (MPI_IMPL_ID "mpich" CACHE STRING "MPI implementation identifier")
endif ()
endif ()

# restore state
cmake_pop_check_state()

if (NOT DEFINED MPI_IMPL_ID)
set (MPI_IMPL_ID "UNKNOWN" CACHE STRING "MPI implementation identifier")
endif()
else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
set(MPI_FOUND FALSE CACHE BOOL "Did not find the MPI library")
endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)

message(STATUS "Detected MPI implementation: ${MPI_IMPL_ID}")
message(STATUS "Detected MPI C compiler: ${MPI_C_COMPILER}")

# check for MPI-3
check_mpi_compile(${CMAKE_SOURCE_DIR}/CMakeExt/Code/test_mpi_support.c HAVE_MPI3)

# save current state
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH})
check_symbol_exists(
MPI_NO_OP
mpi.h
HAVE_MPI_NO_OP
)
cmake_pop_check_state()
if (NOT HAVE_MPI3)
message(${OUTPUT})
set(MPI_IS_DART_COMPATIBLE FALSE CACHE BOOL
"MPI LIB has support for MPI-3")
message (WARNING
"Detected MPI implementation (${MPI_IMPL_ID}) does not support MPI-3")
message (STATUS "${OUTPUT}")
unset (MPI_IMPL_ID CACHE)
else()
set(MPI_IS_DART_COMPATIBLE TRUE CACHE BOOL
"MPI LIB has support for MPI-3")
endif()

if (NOT HAVE_MPI_NO_OP)
message(FATAL_ERROR "Detected MPI library does not support MPI-3.")
endif()
set (CMAKE_C_COMPILER ${CMAKE_C_COMPILER_SAFE})

endif(NOT DEFINED MPI_IMPL_ID)
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ message(INFO "Enabled DART backends: (DART_IMPLEMENTATIONS) "
${DART_IMPLEMENTATIONS})
message(INFO "C compiler id: ${CMAKE_C_COMPILER_ID}")
message(INFO "C++ compiler id: ${CMAKE_CXX_COMPILER_ID}")
if (MPI_FOUND)
if (DEFINED MPI_IMPL_ID)
message(INFO "MPI implementation: " ${MPI_IMPL_ID})
endif()

Expand Down
47 changes: 9 additions & 38 deletions dart-if/include/dash/dart/if/dart_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,59 +96,30 @@ typedef enum
*
* \ingroup DartTypes
*/
/**
typedef enum
{
DART_TYPE_UNDEFINED = 0,
/// integral data types
DART_TYPE_BYTE,
DART_TYPE_SHORT,
DART_TYPE_INT,
DART_TYPE_UINT,
DART_TYPE_LONG,
DART_TYPE_ULONG,
DART_TYPE_LONGLONG,
/// floating point data types
DART_TYPE_FLOAT,
DART_TYPE_DOUBLE,
/// Reserved, do not use!
DART_TYPE_COUNT
} dart_datatype_t;
**/

typedef intptr_t dart_datatype_t;
#if 0
extern struct dart_datatype_struct __dart_type_undefined_t;
extern struct dart_datatype_struct __dart_type_byte_t;
extern struct dart_datatype_struct __dart_type_short_t;
extern struct dart_datatype_struct __dart_type_int_t;
extern struct dart_datatype_struct __dart_type_uint_t;
extern struct dart_datatype_struct __dart_type_long_t;
extern struct dart_datatype_struct __dart_type_ulong_t;
extern struct dart_datatype_struct __dart_type_longlong_t;
extern struct dart_datatype_struct __dart_type_float_t;
extern struct dart_datatype_struct __dart_type_double_t;
#endif


#define DART_TYPE_UNDEFINED (dart_datatype_t)(0)
/// integral data types
#define DART_TYPE_BYTE (dart_datatype_t)(1)
#define DART_TYPE_SHORT (dart_datatype_t)(2)
#define DART_TYPE_INT (dart_datatype_t)(3)
#define DART_TYPE_UINT (dart_datatype_t)(4)
#define DART_TYPE_LONG (dart_datatype_t)(5)
#define DART_TYPE_ULONG (dart_datatype_t)(6)
#define DART_TYPE_LONGLONG (dart_datatype_t)(7)
#define DART_TYPE_FLOAT (dart_datatype_t)(8)
#define DART_TYPE_DOUBLE (dart_datatype_t)(9)
#define DART_TYPE_LAST (dart_datatype_t)(10)
#define DART_TYPE_ULONGLONG (dart_datatype_t)(8)
/// floating point data types
#define DART_TYPE_FLOAT (dart_datatype_t)(9)
#define DART_TYPE_DOUBLE (dart_datatype_t)(10)
/// Reserved, do not use!
#define DART_TYPE_LAST (dart_datatype_t)(11)


/** size for integral \c size_t */
#if (UINT32_MAX == SIZE_MAX)
# define DART_TYPE_SIZET DART_TYPE_UINT
# define DART_TYPE_SIZET DART_TYPE_ULONG
#elif (UINT64_MAX == SIZE_MAX)
# define DART_TYPE_SIZET DART_TYPE_LONGLONG
# define DART_TYPE_SIZET DART_TYPE_ULONGLONG
#else
# error "Cannot determine DART type for size_t!"
#endif
Expand Down
4 changes: 4 additions & 0 deletions dart-impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(DART_IMPLEMENTATIONS_LIST ${DART_IMPLEMENTATIONS_LIST}
set(ENABLE_THREADSUPPORT ${ENABLE_THREADSUPPORT}
PARENT_SCOPE)


if (ENABLE_THREADSUPPORT)
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DDART_ENABLE_THREADSUPPORT")
Expand All @@ -28,6 +29,9 @@ add_subdirectory(base)

# DART implementation of every enabled DART variant:
if (";${DART_IMPLEMENTATIONS_LIST};" MATCHES ";mpi;")
if(NOT MPI_IS_DART_COMPATIBLE)
message(FATAL_ERROR "Detected MPI library does not support MPI-3.")
endif()
set(DART_IMPLEMENTATION_MPI_ENABLED ON
CACHE BOOL INTERNAL FORCE)
add_subdirectory(mpi)
Expand Down
2 changes: 2 additions & 0 deletions dart-impl/mpi/src/dart_mpi_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static const char* __dart_base_type_names[DART_TYPE_LAST+1] = {
"LONG",
"UNSIGNED LONG",
"LONG LONG",
"UNSIGNED LONG LONG",
"FLOAT",
"DOUBLE",
"INVALID"
Expand Down Expand Up @@ -96,6 +97,7 @@ dart__mpi__datatype_init()
init_basic_datatype(DART_TYPE_LONG, MPI_LONG);
init_basic_datatype(DART_TYPE_ULONG, MPI_UNSIGNED_LONG);
init_basic_datatype(DART_TYPE_LONGLONG, MPI_LONG_LONG);
init_basic_datatype(DART_TYPE_ULONGLONG, MPI_UNSIGNED_LONG_LONG);
init_basic_datatype(DART_TYPE_FLOAT, MPI_FLOAT);
init_basic_datatype(DART_TYPE_DOUBLE, MPI_DOUBLE);

Expand Down
Loading

0 comments on commit 68bc30c

Please sign in to comment.