Initial MPI
This commit is contained in:
12
flake.lock
generated
12
flake.lock
generated
@@ -5,11 +5,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1689068808,
|
"lastModified": 1694529238,
|
||||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1690031011,
|
"lastModified": 1696193975,
|
||||||
"narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
|
"narHash": "sha256-mnQjUcYgp9Guu3RNVAB2Srr1TqKcPpRXmJf4LJk6KRY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "12303c652b881435065a98729eb7278313041e49",
|
"rev": "fdd898f8f79e8d2f99ed2ab6b3751811ef683242",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
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/Space.hpp"
|
||||||
#include "md/System.hpp"
|
#include "md/System.hpp"
|
||||||
|
|
||||||
|
#include <boost/mpi/communicator.hpp>
|
||||||
|
#include <boost/mpi/environment.hpp>
|
||||||
|
namespace mpi = boost::mpi;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "kk eae men" << std::endl;
|
std::cout << "kk eae men" << std::endl;
|
||||||
|
|
||||||
@@ -44,5 +48,11 @@ int main() {
|
|||||||
std::cout << "Getting neighboring cells of index 0" << std::endl;
|
std::cout << "Getting neighboring cells of index 0" << std::endl;
|
||||||
Cell neighboringCells = space.getNeighboringCells(0);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# Copyright (c) 2023 jun <https://git.firmwarejun.net/jun/MolecularDynamics2>
|
# Copyright (c) 2023 jun <https://git.firmwarejun.net/jun/MolecularDynamics2>
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.25.2)
|
||||||
|
|
||||||
project(md)
|
project(md)
|
||||||
|
|
||||||
add_library(md
|
add_library(md
|
||||||
@@ -7,4 +9,12 @@ add_library(md
|
|||||||
Atom.cpp
|
Atom.cpp
|
||||||
AtomsGenerator.cpp
|
AtomsGenerator.cpp
|
||||||
System.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})
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "Atom.hpp"
|
#include "Atom.hpp"
|
||||||
|
|
||||||
|
#include <boost/mpi/datatype.hpp>
|
||||||
|
|
||||||
class Space;
|
class Space;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,4 +128,6 @@ public:
|
|||||||
* @return Cell
|
* @return Cell
|
||||||
*/
|
*/
|
||||||
Cell getNeighboringCells(int x, int y, int z) const;
|
Cell getNeighboringCells(int x, int y, int z) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BOOST_IS_MPI_DATATYPE(Cell);
|
||||||
Reference in New Issue
Block a user