Commit 7863e933 authored by Andrew J. Burns (Cont's avatar Andrew J. Burns (Cont
Browse files

Merge branch 'master' of hsai-dev.arl.army.mil:/data/Repository/Xdmf2

parents da24996b b92bfe9e
# - FindMPI4PY
# Find mpi4py includes and library
# This module defines:
# MPI4PY_INCLUDE_DIR, where to find mpi4py.h, etc.
# MPI4PY_FOUND
# https://compacc.fnal.gov/projects/repositories/entry/synergia2/CMake/FindMPI4PY.cmake?rev=c147eafb60728606af4fe7b1b161a660df142e9a
if(NOT MPI4PY_INCLUDE_DIR)
execute_process(COMMAND
"${PYTHON_EXECUTABLE}" "-c" "import mpi4py; print mpi4py.get_include()"
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR
RESULT_VARIABLE MPI4PY_COMMAND_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MPI4PY_COMMAND_RESULT)
message("jfa: mpi4py not found")
set(MPI4PY_FOUND FALSE)
else(MPI4PY_COMMAND_RESULT)
if (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
message("jfa: mpi4py matches traceback")
## Did not successfully include MPI4PY
set(MPI4PY_FOUND FALSE)
else (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
## successful
set(MPI4PY_FOUND TRUE)
set(MPI4PY_INCLUDE_DIR ${MPI4PY_INCLUDE_DIR} CACHE STRING "mpi4py include path")
endif (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
endif(MPI4PY_COMMAND_RESULT)
else(NOT MPI4PY_INCLUDE_DIR)
set(MPI4PY_FOUND TRUE)
endif(NOT MPI4PY_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPI4PY DEFAULT_MSG MPI4PY_INCLUDE_DIR)
...@@ -53,6 +53,13 @@ option(XDMF_WRAP_JAVA OFF) ...@@ -53,6 +53,13 @@ option(XDMF_WRAP_JAVA OFF)
option(XDMF_BUILD_DSM OFF) option(XDMF_BUILD_DSM OFF)
if(XDMF_BUILD_DSM) if(XDMF_BUILD_DSM)
find_package(MPI REQUIRED)
if(MPI_FOUND)
include_directories(${MPI_INCLUDE_PATH})
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
get_filename_component(MPI_LIBRARY_DIR ${MPI_LIBRARY} PATH)
set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${MPI_LIBRARY_DIR})
endif(MPI_FOUND)
option(XDMF_BUILD_DSM_THREADS ON) option(XDMF_BUILD_DSM_THREADS ON)
if (XDMF_WRAP_PYTHON) if (XDMF_WRAP_PYTHON)
mark_as_advanced(FORCE PYTHON_INCLUDE_MPI4PY_DIR) mark_as_advanced(FORCE PYTHON_INCLUDE_MPI4PY_DIR)
...@@ -74,6 +81,12 @@ if(XDMF_WRAP_PYTHON) ...@@ -74,6 +81,12 @@ if(XDMF_WRAP_PYTHON)
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED) find_package(PythonLibs REQUIRED)
if (XDMF_BUILD_DSM) if (XDMF_BUILD_DSM)
find_package (MPI4PY REQUIRED)
if (MPI4PY_FOUND)
if ("${PYTHON_INCLUDE_MPI4PY_DIR}" STREQUAL "")
set(PYTHON_INCLUDE_MPI4PY_DIR ${MPI4PY_INCLUDE_DIR})
endif ()
endif ()
include_directories(${PYTHON_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH} ${PYTHON_INCLUDE_MPI4PY_DIR}) include_directories(${PYTHON_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH} ${PYTHON_INCLUDE_MPI4PY_DIR})
else (XDMF_BUILD_DSM) else (XDMF_BUILD_DSM)
include_directories(${PYTHON_INCLUDE_DIRS}) include_directories(${PYTHON_INCLUDE_DIRS})
......
...@@ -35,6 +35,16 @@ if(Boost_FOUND) ...@@ -35,6 +35,16 @@ if(Boost_FOUND)
mark_as_advanced(FORCE Boost_INCLUDE_DIR) mark_as_advanced(FORCE Boost_INCLUDE_DIR)
endif(Boost_FOUND) endif(Boost_FOUND)
# Find HDF5_ROOT if not set
if ("$ENV{HDF5_ROOT}" STREQUAL "")
find_file (HDF5_LIB libhdf5.so HINTS ENV LD_LIBRARY_PATH)
if (NOT "${HDF5_LIB}" STREQUAL "")
get_filename_component(HDF5_LIBRARY_DIR "${HDF5_LIB}" PATH)
get_filename_component(HDF5_ROOT "${HDF5_LIBRARY_DIR}/../" ABSOLUTE)
set(ENV{HDF5_ROOT} ${HDF5_ROOT})
endif (NOT "${HDF5_LIB}" STREQUAL "")
endif ("$ENV{HDF5_ROOT}" STREQUAL "")
mark_as_advanced(CLEAR HDF5_C_INCLUDE_DIR) mark_as_advanced(CLEAR HDF5_C_INCLUDE_DIR)
mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_DEBUG) mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_DEBUG)
mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_RELEASE) mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_RELEASE)
...@@ -51,16 +61,21 @@ if(HDF5_FOUND) ...@@ -51,16 +61,21 @@ if(HDF5_FOUND)
# FIXME: Would like to get this info from HDF5 so we don't have conflicting # FIXME: Would like to get this info from HDF5 so we don't have conflicting
# MPI versions # MPI versions
if(HDF5_IS_PARALLEL) if(HDF5_IS_PARALLEL)
find_package(MPI REQUIRED) if (NOT MPI_FOUND)
if(MPI_FOUND) find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH}) if(MPI_FOUND)
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) include_directories(${MPI_INCLUDE_PATH})
get_filename_component(MPI_LIBRARY_DIR ${MPI_LIBRARY} PATH) set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${MPI_LIBRARY_DIR}) get_filename_component(MPI_LIBRARY_DIR ${MPI_LIBRARY} PATH)
endif(MPI_FOUND) set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${MPI_LIBRARY_DIR})
endif(MPI_FOUND)
endif (NOT MPI_FOUND)
endif(HDF5_IS_PARALLEL) endif(HDF5_IS_PARALLEL)
get_filename_component(HDF5_ROOT "${HDF5_INCLUDE_DIR}/../" REALPATH) get_filename_component(HDF5_ROOT "${HDF5_INCLUDE_DIR}/../" REALPATH)
set(HDF5_BINARY_DIRS ${HDF5_ROOT}/bin ${HDF5_ROOT}/dll) set(HDF5_BINARY_DIRS ${HDF5_ROOT}/bin ${HDF5_ROOT}/dll)
if (NOT HDF5_LIBRARIES)
find_library (HDF5_LIBRARIES hdf5 HINTS ${HDF5_ROOT} ENV LD_LIBRARY_PATH)
endif (NOT HDF5_LIBRARIES)
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${HDF5_LIBRARIES}) set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${HDF5_LIBRARIES})
set(XDMF_HDF5_BINARY_DIRS ${HDF5_BINARY_DIRS} PARENT_SCOPE) set(XDMF_HDF5_BINARY_DIRS ${HDF5_BINARY_DIRS} PARENT_SCOPE)
set(XDMF_BINARIES ${XDMF_BINARIES} ${HDF5_BINARY_DIRS}) set(XDMF_BINARIES ${XDMF_BINARIES} ${HDF5_BINARY_DIRS})
......
...@@ -238,7 +238,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -238,7 +238,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// where there is a mixed type of Char and UChar // where there is a mixed type of Char and UChar
// The resulting type should be a Short // The resulting type should be a Short
return Int16(); return Int16();
break;
} }
case 3: case 3:
// Short // Short
...@@ -249,7 +248,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -249,7 +248,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// Char/UChar and Short // Char/UChar and Short
// In all of these cases the result shoule be a Short // In all of these cases the result shoule be a Short
return Int16(); return Int16();
break;
} }
case 4: case 4:
// UShort // UShort
...@@ -258,7 +256,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -258,7 +256,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// When mixing UShort with a signed type that has a lower precision // When mixing UShort with a signed type that has a lower precision
// the resulting type should be an int // the resulting type should be an int
return Int32(); return Int32();
break;
} }
else if (type2Name.compare("UChar") == 0 || else if (type2Name.compare("UChar") == 0 ||
type2Name.compare("UShort") == 0) { type2Name.compare("UShort") == 0) {
...@@ -270,7 +267,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -270,7 +267,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return Int32(); return Int32();
} }
break;
} }
case 5: case 5:
// Int // Int
...@@ -286,7 +282,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -286,7 +282,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return Int64(); return Int64();
} }
break;
} }
if (type2Name.compare("Int") == 0) { if (type2Name.compare("Int") == 0) {
if (type2->getElementSize() == 4) { if (type2->getElementSize() == 4) {
...@@ -295,7 +290,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -295,7 +290,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return Int64(); return Int64();
} }
break;
} }
case 6: case 6:
// UInt // UInt
...@@ -312,7 +306,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -312,7 +306,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return Int64(); return Int64();
} }
break;
} }
else if (type2Name.compare("UInt") == 0) { else if (type2Name.compare("UInt") == 0) {
if (firstIsSigned) { if (firstIsSigned) {
...@@ -321,11 +314,9 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -321,11 +314,9 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return UInt32(); return UInt32();
} }
break;
} }
else if (type2Name.compare("Int") == 0) { else if (type2Name.compare("Int") == 0) {
return Int64(); return Int64();
break;
} }
case 7: case 7:
// Float // Float
...@@ -335,7 +326,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -335,7 +326,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// String is the only type that has priority over a float // String is the only type that has priority over a float
// This case occurs when type1 is a float // This case occurs when type1 is a float
return type1; return type1;
break;
} }
else if (type2Name.compare("UInt") == 0) { else if (type2Name.compare("UInt") == 0) {
return Float64(); return Float64();
...@@ -349,13 +339,11 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1, ...@@ -349,13 +339,11 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else { else {
return type2; return type2;
} }
break;
} }
case 8: case 8:
// String // String
// String has priority over everything // String has priority over everything
return String(); return String();
break;
default: default:
break; break;
} }
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <algorithm> #include <algorithm>
#ifdef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#include <XdmfError.hpp> #include <XdmfError.hpp>
#include <mpi.h> #include <mpi.h>
#ifdef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment