Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/infer_water/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ project(infer_water)
# find DeePMD-kit
find_package(DeePMD REQUIRED)

# helper that generates graph.pb from the bundled test model
add_executable(convert_model convert_model.c)
# link DeePMD-kit C API
target_link_libraries(convert_model PRIVATE DeePMD::deepmd_c)

# C++ example
add_executable(infer_water_cc infer_water.cpp)
# link DeePMD-kit C++ API
Expand Down
23 changes: 23 additions & 0 deletions examples/infer_water/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,26 @@ Build the project using
cmake -DCMAKE_PREFIX_PATH=$deepmd_root .
make
```

Building only compiles the executables; it does not create the model file.
The inference programs load a frozen model `graph.pb` from the current
directory, so generate it first by running the `convert_model` helper, which
converts the bundled test model `../../source/tests/infer/deeppot.pbtxt` into
`graph.pb`:

```sh
./convert_model
```

Run `convert_model` from this directory so the relative path to the bundled
model resolves. It requires `$deepmd_root` to be built with the TensorFlow
backend, because `graph.pb` is a TensorFlow frozen model.

Then run any of the inference examples:

```sh
./infer_water_cc
./infer_water_c
./infer_water_hpp
./infer_water_nlist
```
Loading