Skip to content

Commit

Permalink
Merge pull request #27 from YutackPark/main
Browse files Browse the repository at this point in the history
refactor, docs: Raises error for wrong force calculation in parallel version.
  • Loading branch information
YutackPark authored Mar 8, 2024
2 parents e8c860d + a68762c commit 6555200
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ The project provides parallel molecular dynamics simulations using graph neural

The installation and usage of SEVENNet are split into two parts: training (handled by PyTorch) and molecular dynamics (handled by [`LAMMPS`](https://github.com/lammps/lammps)). The model, once trained with PyTorch, is deployed using TorchScript and is later used to run molecular dynamics simulations via LAMMPS.

## Known issues

* The pressure of the parallel version in LAMMPS is not supported yet.
* When using parallel MD, if the simulation cell is too small (one of cell dimension < cutoff radius), the calculated force is incorrect.

However, the second issue rarely matters since you can not fully utilize a GPU in this condition. In this case, using only a single GPU gives almost the same speed as multiple GPUs.
Even though, we're looking for the solution.

## Requirements for Training

Expand Down Expand Up @@ -198,6 +191,11 @@ mpirun -np {# of MPI rank to use} {path to lammps binary} -in {lammps input scri

If a CUDA-aware OpenMPI is not found (it detects automatically in the code), `e3gnn/parallel` will not utilize GPUs even if they are available. You can check whether `OpenMPI` is found or not from the standard output of the `LAMMPS` simulation. Ideally, one GPU per MPI process is expected. If the available GPUs are fewer than the MPI processes, the simulation may run inefficiently or fail. You can select specific GPUs by setting the `CUDA_VISIBLE_DEVICES` environment variable.

## Future Work

* Implementation of pressure output in parallel MD simulations.
* Development of supprt for a tiled communication style (also known as recursive coordinate bisection, RCB) in LAMMPS.

## Citation
If you use SevenNet, please cite (1) parallel GNN-IP MD simulation by SevenNet or its pre-trained model SevenNet-0, (2) underlying GNN-IP architecture NequIP

Expand Down
1 change: 1 addition & 0 deletions pair_e3gnn/comm_brick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ void CommBrick::forward_comm(PairE3GNNParallel *pair)
buf_send_ = reinterpret_cast<float*>(buf_send);
buf_recv_ = reinterpret_cast<float*>(buf_recv);
}
if (nswap > 6) error->all(FLERR,"PairE3GNNParallel: Cell size is too small. Please use a single GPU or replicate the cell.");

for (iswap = 0; iswap < nswap; iswap++) {
if(sendproc[iswap] == me) continue;
Expand Down
5 changes: 4 additions & 1 deletion pair_e3gnn/pair_e3gnn_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ void PairE3GNNParallel::compute(int eflag, int vflag) {
if (Rij < cutoff_square) {
// if given j is not local atom and inside cutoff
if (tag_to_graph_idx[jtag] == -1) {
// if j is ghost atom inside cutoff but first seen
tag_to_graph_idx[jtag] = graph_indexer;
graph_index_to_i[graph_indexer] = j;
node_type_ghost.push_back(map[jtype]);
Expand Down Expand Up @@ -642,7 +643,9 @@ void PairE3GNNParallel::init_style() {
neighbor->add_request(this, NeighConst::REQ_FULL);
}

double PairE3GNNParallel::init_one(int i, int j) { return cutoff; }
double PairE3GNNParallel::init_one(int i, int j) {
return cutoff;
}

void PairE3GNNParallel::comm_preprocess() {
assert(!comm_preprocess_done);
Expand Down

0 comments on commit 6555200

Please sign in to comment.