Initial MPI
This commit is contained in:
12
flake.lock
generated
12
flake.lock
generated
@@ -5,11 +5,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,11 +20,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1690031011,
|
||||
"narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
|
||||
"lastModified": 1696193975,
|
||||
"narHash": "sha256-mnQjUcYgp9Guu3RNVAB2Srr1TqKcPpRXmJf4LJk6KRY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "12303c652b881435065a98729eb7278313041e49",
|
||||
"rev": "fdd898f8f79e8d2f99ed2ab6b3751811ef683242",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [ gcc cmake clang gnuplot llvmPackages.openmp bc ];
|
||||
packages = with pkgs; [ gcc cmake clang gnuplot llvmPackages.openmp bc boost openmpi ];
|
||||
};
|
||||
});
|
||||
}
|
||||
10
src/main.cpp
10
src/main.cpp
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -8,3 +10,11 @@ add_library(md
|
||||
AtomsGenerator.cpp
|
||||
System.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})
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "Atom.hpp"
|
||||
|
||||
#include <boost/mpi/datatype.hpp>
|
||||
|
||||
class Space;
|
||||
|
||||
/**
|
||||
@@ -127,3 +129,5 @@ public:
|
||||
*/
|
||||
Cell getNeighboringCells(int x, int y, int z) const;
|
||||
};
|
||||
|
||||
BOOST_IS_MPI_DATATYPE(Cell);
|
||||
Reference in New Issue
Block a user