diff --git a/pytriqs/CMakeLists.txt b/pytriqs/CMakeLists.txt index 120be4d0..b16dca69 100644 --- a/pytriqs/CMakeLists.txt +++ b/pytriqs/CMakeLists.txt @@ -1,3 +1,10 @@ +option(Python_use_mpi4py "Use mpi4py instead of boost.mpi" OFF) +if (Python_use_mpi4py) + SET (TRIQS_PYTHON_MPI_USE_MPI4PY 1) +else() + SET(TRIQS_PYTHON_MPI_USE_MPI4PY 0) +endif() + # Create a temporary copy of the python modules so that we can run before installation with the test FILE(GLOB_RECURSE all_py_files RELATIVE ${CMAKE_SOURCE_DIR}/pytriqs *.py ) SET(py_copy_tar ${CMAKE_BINARY_DIR}/py_copy.tar) @@ -8,11 +15,12 @@ add_custom_target(py_copy ALL DEPENDS ${py_copy_tar}) find_package(CythonModuleMacro) SET(PYTHON_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ${CMAKE_CURRENT_BINARY_DIR}/version.py - ) + ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py + ${CMAKE_CURRENT_BINARY_DIR}/version.py + ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.py.in ${CMAKE_CURRENT_BINARY_DIR}/version.py) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utility/mpi.py.in ${CMAKE_CURRENT_BINARY_DIR}/utility/mpi.py) install (FILES ${PYTHON_SOURCES} DESTINATION ${TRIQS_PYTHON_LIB_DEST}) diff --git a/pytriqs/utility/CMakeLists.txt b/pytriqs/utility/CMakeLists.txt index f6da00ce..b0b83b4f 100644 --- a/pytriqs/utility/CMakeLists.txt +++ b/pytriqs/utility/CMakeLists.txt @@ -3,7 +3,9 @@ SET(PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/dichotomy.py ${CMAKE_CURRENT_SOURCE_DIR}/dist_on_nodes.py - ${CMAKE_CURRENT_SOURCE_DIR}/mpi.py + ${CMAKE_CURRENT_BINARY_DIR}/mpi.py + ${CMAKE_CURRENT_BINARY_DIR}/mpi_mpi4py.py + ${CMAKE_CURRENT_BINARY_DIR}/mpi_boost.py ${CMAKE_CURRENT_SOURCE_DIR}/redirect.py ) diff --git a/pytriqs/utility/mpi.py.in b/pytriqs/utility/mpi.py.in new file mode 100644 index 00000000..a94a7343 --- /dev/null +++ b/pytriqs/utility/mpi.py.in @@ -0,0 +1,25 @@ +################################################################################ +# +# TRIQS: a Toolbox for Research in Interacting Quantum Systems +# +# Copyright (C) 2013 by M. Ferrero, O. Parcollet +# +# TRIQS is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# TRIQS. If not, see . +# +################################################################################ + +if @TRIQS_PYTHON_MPI_USE_MPI4PY@ : + from mpi_mpi4py import * +else: + from mpi_boost import * diff --git a/pytriqs/utility/mpi.py b/pytriqs/utility/mpi_boost.py similarity index 100% rename from pytriqs/utility/mpi.py rename to pytriqs/utility/mpi_boost.py