Commit 19c56412 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Removing MPI optional dependency from XACC



Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 8ace584f
......@@ -15,8 +15,6 @@ The following third party libraries (TPLs) are used by XACC:
+------------------------+------------+-----------+
| Boost | Required | 1.59.0+ |
+------------------------+------------+-----------+
| MPI | Optional | N/A |
+------------------------+------------+-----------+
Note that you must have a C++11 compliant compiler.
For GCC, this means version 4.8.1+, for Clang, this means 3.3+.
......@@ -27,11 +25,8 @@ systems. Any of the following commands will work (showing with and without MPI):
.. code::
$ (macosx) brew install boost
$ (macosx) brew install boost-mpi
$ (fedora) dnf install boost-devel
$ (fedora) dnf install boost-mpich-devel
$ (fedora) dnf install boost-openmpi-devel
$ (ubuntu) apt-get install libboost-all-dev # will install openmpi
$ (ubuntu) apt-get install libboost-all-dev
Build XACC
-----------
......@@ -151,8 +146,7 @@ Now we can run
.. code::
$ (without MPI support) spack install xacc
$ (with MPI support) spack install xacc +mpi
$ spack install xacc
$ (with specified compiler) spack install xacc %gcc@7.2.0
Update your PATH to point to the XACC ``bin`` directory:
......
......@@ -17,20 +17,20 @@ include(tests)
include(CppMicroServicesConfig)
# We require MPI
find_package(MPI)
if (MPI_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_MPI")
#find_package(MPI)
#if (MPI_FOUND)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_MPI")
message(STATUS "FOUND MPI: ${MPI_CXX_INCLUDE_PATH} AND ${MPI_CXX_LIBRARIES}")
# message(STATUS "FOUND MPI: ${MPI_CXX_INCLUDE_PATH} AND ${MPI_CXX_LIBRARIES}")
# We require Boost with MPI
find_package(Boost COMPONENTS mpi system program_options filesystem chrono thread REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
else()
message(STATUS "MPI Not Found.")
# find_package(Boost COMPONENTS mpi system program_options filesystem chrono thread REQUIRED)
# include_directories(${MPI_CXX_INCLUDE_PATH})
#else()
# message(STATUS "MPI Not Found.")
# We require Boost without MPI
find_package(Boost COMPONENTS system program_options filesystem chrono thread REQUIRED)
endif()
find_package(Boost COMPONENTS system program_options filesystem chrono thread REQUIRED)
#endif()
include_directories(${XACC_INCLUDE_DIR})
include_directories(${XACC_ROOT}/tpls/rapidjson/include)
......
......@@ -10,20 +10,20 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XACC_ROOT}/cmake/Modules")
include(tests)
# We require MPI
find_package(MPI)
if (MPI_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_MPI")
#find_package(MPI)
#if (MPI_FOUND)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_MPI")
message(STATUS "FOUND MPI: ${MPI_CXX_INCLUDE_PATH} AND ${MPI_CXX_LIBRARIES}")
# message(STATUS "FOUND MPI: ${MPI_CXX_INCLUDE_PATH} AND ${MPI_CXX_LIBRARIES}")
# We require Boost with MPI
find_package(Boost COMPONENTS mpi system program_options filesystem chrono thread REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
else()
message(STATUS "MPI Not Found.")
# find_package(Boost COMPONENTS mpi system program_options filesystem chrono thread REQUIRED)
# include_directories(${MPI_CXX_INCLUDE_PATH})
#else()
#message(STATUS "MPI Not Found.")
# We require Boost without MPI
find_package(Boost COMPONENTS system program_options filesystem chrono thread REQUIRED)
endif()
find_package(Boost COMPONENTS system program_options filesystem chrono thread REQUIRED)
#endif()
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${XACC_ROOT}/tpls/spdlog)
......
......@@ -29,7 +29,6 @@
*
**********************************************************************************/
#include "XACC.hpp"
#include "MPIHolder.hpp"
namespace xacc {
......@@ -52,12 +51,6 @@ void Initialize() {
void Initialize(int argc, char** argv) {
// Create the MPIHolder instance
auto mpiHolder = MPIHolder::instance();
// Initialize MPI, if we've been built with MPI support
mpiHolder->initialize(argc, argv);
// Create the iniitial xacc-console
auto tmpInitConsole = spdlog::stdout_logger_mt("xacc-console");
......
/*
* MPIHolder.hpp
*
* Created on: Aug 11, 2017
* Author: aqw
*/
#ifndef XACC_UTILS_MPIHOLDER_HPP_
#define XACC_UTILS_MPIHOLDER_HPP_
#ifdef XACC_HAS_MPI
#include "Singleton.hpp"
#include <boost/mpi.hpp>
namespace xacc {
class MPIHolder : public Singleton<MPIHolder> {
protected:
std::shared_ptr<boost::mpi::environment> env;
std::shared_ptr<boost::mpi::communicator> communicator;
public:
void initialize(int argc, char** argv) {
env = std::make_shared<boost::mpi::environment>(argc, argv);
communicator = std::make_shared<boost::mpi::communicator>();
}
const int rank() {
return communicator->rank();
}
const int size() {
return communicator->size();
}
const boost::mpi::communicator& getCommunicator() {
return *communicator.get();
}
void barrier() {
communicator->barrier();
}
};
}
#else
namespace xacc {
class MPIHolder : public Singleton<MPIHolder> {
public:
void initialize(int argc, char** argv) {}
const int rank() {return 0;}
const int size() {return 1;}
const void getCommunicator() {}
void barrier() {}
};
}
#endif
#endif
Supports Markdown
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