Skip to content

Commit

Permalink
set pt dir to LD_LIBRARY_PATH
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Jun 21, 2024
1 parent 2e91ce8 commit ced2562
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions deepmd/tf/lmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from importlib import (
import_module,
)
from importlib.util import (
find_spec,
)
from pathlib import (
Path,
)
Expand Down Expand Up @@ -77,6 +80,11 @@ def get_library_path(module: str, filename: str) -> List[str]:

tf_dir = tf.sysconfig.get_lib()
op_dir = str(SHARED_LIB_DIR)
pt_spec = find_spec("torch")
if pt_spec is not None:
pt_dir = pt_spec.submodule_search_locations[0]
else:
pt_dir = None


cuda_library_paths = []
Expand Down Expand Up @@ -106,6 +114,7 @@ def get_library_path(module: str, filename: str) -> List[str]:
[
os.environ.get(lib_env),
tf_dir,
pt_dir,
os.path.join(tf_dir, "python"),
op_dir,
]
Expand Down

0 comments on commit ced2562

Please sign in to comment.