Skip to content

Commit

Permalink
apply deepmodeling/deepmd-kit#3025 to fix plugin loading issues
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz committed Dec 2, 2023
1 parent 4f62717 commit 1e4a2b2
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 33 deletions.
70 changes: 70 additions & 0 deletions recipe/3025.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
From 8ccec49ac29b484ea25ab7159baed7d9a3d9dfdb Mon Sep 17 00:00:00 2001
From: Jinzhe Zeng <[email protected]>
Date: Sat, 2 Dec 2023 18:20:53 -0500
Subject: [PATCH 1/2] set rpath for symlink and macos

Signed-off-by: Jinzhe Zeng <[email protected]>
---
source/lmp/plugin/CMakeLists.txt | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/source/lmp/plugin/CMakeLists.txt b/source/lmp/plugin/CMakeLists.txt
index bfc225341..e6dc0fc99 100644
--- a/source/lmp/plugin/CMakeLists.txt
+++ b/source/lmp/plugin/CMakeLists.txt
@@ -96,10 +96,13 @@ if(DEFINED LAMMPS_SOURCE_ROOT OR DEFINED LAMMPS_VERSION)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(${libname} PROPERTIES LINK_FLAGS
- "-Wl,-undefined,dynamic_lookup")
+ "-Wl,-undefined,dynamic_lookup"
+ INSTALL_RPATH
+ "@loader_path:${TensorFlow_LIBRARY_PATH}:@loader_path/.."
+ )
else()
set_target_properties(
- ${libname} PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH}"
+ ${libname} PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH};$ORIGIN/.."
LINK_FLAGS "-rdynamic")
endif()
target_compile_definitions(

From d0281e58a11eae6d55f5024ddfe4acd2083fff55 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Sat, 2 Dec 2023 23:23:44 +0000
Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
source/lmp/plugin/CMakeLists.txt | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/source/lmp/plugin/CMakeLists.txt b/source/lmp/plugin/CMakeLists.txt
index e6dc0fc99..41aa41f7f 100644
--- a/source/lmp/plugin/CMakeLists.txt
+++ b/source/lmp/plugin/CMakeLists.txt
@@ -95,15 +95,16 @@ if(DEFINED LAMMPS_SOURCE_ROOT OR DEFINED LAMMPS_VERSION)
${libname} PRIVATE ${LAMMPS_SOURCE_ROOT}/src/EXTRA-FIX) # for ttm
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
- set_target_properties(${libname} PROPERTIES LINK_FLAGS
- "-Wl,-undefined,dynamic_lookup"
- INSTALL_RPATH
- "@loader_path:${TensorFlow_LIBRARY_PATH}:@loader_path/.."
- )
+ set_target_properties(
+ ${libname}
+ PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup"
+ INSTALL_RPATH
+ "@loader_path:${TensorFlow_LIBRARY_PATH}:@loader_path/..")
else()
set_target_properties(
- ${libname} PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH};$ORIGIN/.."
- LINK_FLAGS "-rdynamic")
+ ${libname}
+ PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH};$ORIGIN/.."
+ LINK_FLAGS "-rdynamic")
endif()
target_compile_definitions(
${libname}
27 changes: 0 additions & 27 deletions recipe/in_plugin.lammps

This file was deleted.

12 changes: 6 additions & 6 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ package:
source:
- url: https://github.com/deepmodeling/{{ name }}/archive/v{{ version }}.tar.gz
sha256: 25be126de336630493732b09d3b779b89cc916345b22dfb869cc4f3a3ba6dcde
patches:
- 3025.patch
- url: https://github.com/lammps/lammps/archive/{{ lammps_version }}.tar.gz
sha256: 48dc8b0b0583689e80ea2052275acbc3e3fce89707ac557e120db5564257f7df
folder: lammps

build:
number: 3
number: 4
string: cuda{{ cuda_compiler_version | replace('.', '') }}py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version != "None"]
string: cpu_py{{ CONDA_PY }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda_compiler_version == "None"]
skip: true # [win]
Expand Down Expand Up @@ -50,7 +52,7 @@ requirements:
- tensorflow
- numpy
- scipy
- dargs >=0.3.5
- dargs >=0.4.1
- pyyaml
- {{ mpi }}
- python-hostlist >=1.21
Expand All @@ -65,8 +67,7 @@ test:
files:
- water_se_a.json
- water.lmp
- in.lammps # [linux and mpi == 'mpich']
- in_plugin.lammps # [osx and mpi == 'mpich']
- in.lammps # [mpi == 'mpich']
source_files:
- examples/water/data
imports:
Expand All @@ -83,8 +84,7 @@ test:
- mv examples/water/data/data_0 ./data
- dp train water_se_a.json
- dp freeze -o frozen_model.pb
- mpiexec -n 1 lmp_mpi -in in.lammps # [linux and mpi == 'mpich']
- mpiexec -n 1 lmp_mpi -in in_plugin.lammps # [osx and mpi == 'mpich']
- mpiexec -n 1 lmp_mpi -in in.lammps # [mpi == 'mpich']

about:
home: https://github.com/deepmodeling/deepmd-kit
Expand Down

0 comments on commit 1e4a2b2

Please sign in to comment.