Initial MPI

This commit is contained in:
2023-10-29 20:50:54 -03:00
parent abedae2247
commit c032d066f0
5 changed files with 33 additions and 9 deletions

View File

@@ -16,6 +16,10 @@
#include "md/Space.hpp"
#include "md/System.hpp"
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/environment.hpp>
namespace mpi = boost::mpi;
int main() {
std::cout << "kk eae men" << std::endl;
@@ -44,5 +48,11 @@ int main() {
std::cout << "Getting neighboring cells of index 0" << std::endl;
Cell neighboringCells = space.getNeighboringCells(0);
mpi::environment env;
mpi::communicator world;
std::cout << "Hello, world! I am process " << world.rank() << " of " << world.size() << "."
<< std::endl;
return 0;
}

View File

@@ -1,5 +1,7 @@
# Copyright (c) 2023 jun <https://git.firmwarejun.net/jun/MolecularDynamics2>
cmake_minimum_required(VERSION 3.25.2)
project(md)
add_library(md
@@ -7,4 +9,12 @@ add_library(md
Atom.cpp
AtomsGenerator.cpp
System.cpp
Space.cpp)
Space.cpp)
find_package(MPI REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
target_link_libraries(md ${MPI_CXX_LIBRARIES})
find_package(Boost REQUIRED COMPONENTS mpi)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(md ${Boost_LIBRARIES})

View File

@@ -15,6 +15,8 @@
#include "Atom.hpp"
#include <boost/mpi/datatype.hpp>
class Space;
/**
@@ -126,4 +128,6 @@ public:
* @return Cell
*/
Cell getNeighboringCells(int x, int y, int z) const;
};
};
BOOST_IS_MPI_DATATYPE(Cell);