Rate This Document
Findability
Accuracy
Completeness
Readability

Installation Verification

Minimum Startup Example

The following example is used to verify that the application can include the Paddle Inference header file, link the inference dynamic library, and enable the GPU inference configuration.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
cat > paddle_infer_min.cc <<'CPP'
#include <iostream>
#include "paddle_inference_api.h"

int main() {
  paddle_infer::Config config;
  config.EnableUseGpu(100, 0);
  std::cout << "paddle_inference_gpu_config=ok" << std::endl;
  return 0;
} 
CPP  

g++ -std=c++17 paddle_infer_min.cc \
  -I${PADDLE_INFERENCE_DIR}/paddle/include \
  -L${PADDLE_INFERENCE_DIR}/paddle/lib \
  -lpaddle_inference \
  -Wl,-rpath,${PADDLE_INFERENCE_DIR}/paddle/lib \
  -o paddle_infer_min

./paddle_infer_min

Expected Result

1
paddle_inference_gpu_config=ok