Skip to content

pip install lammps module#2186

Merged
wanghan-iapcm merged 39 commits intodeepmodeling:develfrom
njzjz:wheel-lmp
Dec 19, 2022
Merged

pip install lammps module#2186
wanghan-iapcm merged 39 commits intodeepmodeling:develfrom
njzjz:wheel-lmp

Conversation

@njzjz
Copy link
Member

@njzjz njzjz commented Dec 18, 2022

add lammps module to the wheel

In the next version, one can install DeePMD-kit using

pip install deepmd-kit[gpu,lmp]

Then one can use lmp to run the LAMMPS program with pair deepmd. This works for Linux and macOS, and requires libpython installed to load TF libraries. The LAMMPS Python package was prebuilt in my repo.

Build a Python package with LAMMPS module from the source

export DP_LAMMPS_VERSION=stable_23Jun2022_update2
export DP_variant=cuda
pip install -v .

But note that the same compilation condition (CXX ABI, MPI) should be used to build LAMMPS and its plugin.

Other fixes

  • rename op_abi module to deepmd_op to share the same name between Python and C++
  • fix macOS OP library suffix in api_cc: libdeepmd_op.dylib -> libdeepmd_op.so
  • fix Windows dlopen APIs in api_cc
  • fix compilation error on windows: an explicit specialization or instantiation of a function template cannot have any default arguments
  • avoid linking libdeepmd_lmp with the MPI library, which has been linked with the main LAMMPS

njzjz added 30 commits December 15, 2022 18:28
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
With deepmodeling#2180, now it only has 4 tasks to build wheels. But this task is
still so slow..

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
…pmodeling#2185)

In some machines, this is required for Python.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
…te cannot have any default arguments"

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2022

Codecov Report

Base: 74.95% // Head: 74.85% // Decreases project coverage by -0.09% ⚠️

Coverage data is based on head (9df7078) compared to base (19940da).
Patch coverage: 7.40% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2186      +/-   ##
==========================================
- Coverage   74.95%   74.85%   -0.10%     
==========================================
  Files         201      202       +1     
  Lines       19986    20011      +25     
  Branches     1433     1433              
==========================================
- Hits        14980    14979       -1     
- Misses       4104     4129      +25     
- Partials      902      903       +1     
Impacted Files Coverage Δ
deepmd/lmp.py 0.00% <0.00%> (ø)
source/api_cc/src/DeepPot.cc 67.11% <ø> (ø)
deepmd/env.py 70.79% <100.00%> (ø)
source/api_cc/src/common.cc 76.81% <100.00%> (ø)
source/lib/include/ComputeDescriptor.h 76.65% <0.00%> (-0.23%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wanghan-iapcm wanghan-iapcm merged commit f40c694 into deepmodeling:devel Dec 19, 2022
mingzhong15 pushed a commit to mingzhong15/deepmd-kit that referenced this pull request Jan 15, 2023
## add lammps module to the wheel

In the next version, one can install DeePMD-kit using

```sh
pip install deepmd-kit[gpu,lmp]
```

Then one can use `lmp` to run the LAMMPS program with `pair deepmd`.
This works for Linux and macOS, and requires `libpython` installed to
load TF libraries. The LAMMPS Python package was prebuilt in [my
repo](https://github.com/njzjz/lammps-wheel).

## Build a Python package with LAMMPS module from the source

```sh
export DP_LAMMPS_VERSION=stable_23Jun2022_update2
export DP_variant=cuda
pip install -v .
```
But note that the same compilation condition (CXX ABI, MPI) should be
used to build LAMMPS and its plugin.

## Other fixes
- rename `op_abi` module to `deepmd_op` to share the same name between
Python and C++
- fix macOS OP library suffix in api_cc: `libdeepmd_op.dylib` ->
`libdeepmd_op.so`
- fix Windows dlopen APIs in api_cc
- fix compilation error on windows: `an explicit specialization or
instantiation of a function template cannot have any default arguments`
- avoid linking libdeepmd_lmp with the MPI library, which has been
linked with the main LAMMPS

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
njzjz added a commit to njzjz/deepmd-kit that referenced this pull request Feb 3, 2023
Fix a bug in deepmodeling#2186: `dp_ipi` had the wrong paths in the installation directory.
Add a simple test to check these libraries and the executable are in the correct directory.
wanghan-iapcm pushed a commit that referenced this pull request Feb 5, 2023
Fix a bug in #2186: `dp_ipi` had the wrong paths in the installation
directory. Add a simple test to check these libraries and the executable
are in the correct directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants