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

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)
option(XDMF_BUILD_DSM OFF)
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)
if (XDMF_WRAP_PYTHON)
mark_as_advanced(FORCE PYTHON_INCLUDE_MPI4PY_DIR)
......@@ -74,6 +81,12 @@ if(XDMF_WRAP_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
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})
else (XDMF_BUILD_DSM)
include_directories(${PYTHON_INCLUDE_DIRS})
......
......@@ -35,6 +35,16 @@ if(Boost_FOUND)
mark_as_advanced(FORCE Boost_INCLUDE_DIR)
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_hdf5_LIBRARY_DEBUG)
mark_as_advanced(CLEAR HDF5_hdf5_LIBRARY_RELEASE)
......@@ -51,16 +61,21 @@ if(HDF5_FOUND)
# FIXME: Would like to get this info from HDF5 so we don't have conflicting
# MPI versions
if(HDF5_IS_PARALLEL)
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)
if (NOT MPI_FOUND)
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)
endif (NOT MPI_FOUND)
endif(HDF5_IS_PARALLEL)
get_filename_component(HDF5_ROOT "${HDF5_INCLUDE_DIR}/../" REALPATH)
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_HDF5_BINARY_DIRS ${HDF5_BINARY_DIRS} PARENT_SCOPE)
set(XDMF_BINARIES ${XDMF_BINARIES} ${HDF5_BINARY_DIRS})
......
......@@ -238,7 +238,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// where there is a mixed type of Char and UChar
// The resulting type should be a Short
return Int16();
break;
}
case 3:
// Short
......@@ -249,7 +248,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// Char/UChar and Short
// In all of these cases the result shoule be a Short
return Int16();
break;
}
case 4:
// UShort
......@@ -258,7 +256,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// When mixing UShort with a signed type that has a lower precision
// the resulting type should be an int
return Int32();
break;
}
else if (type2Name.compare("UChar") == 0 ||
type2Name.compare("UShort") == 0) {
......@@ -270,7 +267,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return Int32();
}
break;
}
case 5:
// Int
......@@ -286,7 +282,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return Int64();
}
break;
}
if (type2Name.compare("Int") == 0) {
if (type2->getElementSize() == 4) {
......@@ -295,7 +290,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return Int64();
}
break;
}
case 6:
// UInt
......@@ -312,7 +306,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return Int64();
}
break;
}
else if (type2Name.compare("UInt") == 0) {
if (firstIsSigned) {
......@@ -321,11 +314,9 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return UInt32();
}
break;
}
else if (type2Name.compare("Int") == 0) {
return Int64();
break;
}
case 7:
// Float
......@@ -335,7 +326,6 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
// String is the only type that has priority over a float
// This case occurs when type1 is a float
return type1;
break;
}
else if (type2Name.compare("UInt") == 0) {
return Float64();
......@@ -349,13 +339,11 @@ XdmfArrayType::comparePrecision(shared_ptr<const XdmfArrayType> type1,
else {
return type2;
}
break;
}
case 8:
// String
// String has priority over everything
return String();
break;
default:
break;
}
......
......@@ -59,7 +59,7 @@
#include <stdlib.h>
#include <algorithm>
#ifdef _WIN32
#ifndef _WIN32
#include <unistd.h>
#endif
......
......@@ -57,7 +57,7 @@
#include <XdmfError.hpp>
#include <mpi.h>
#ifdef _WIN32
#ifndef _WIN32
#include <unistd.h>
#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