Skip to content

Commit 68f6b80

Browse files
committed
Add some comments.
1 parent ee5df62 commit 68f6b80

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

paddle/capi/examples/model_inference/multi_thread/main_gpu.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
pthread_mutex_t mutex;
1111

12+
/*
13+
* @brief It is an simple inference example that runs multi-threads on a GPU.
14+
* Each thread holds it own local gradient_machine but shares the same
15+
* parameters.
16+
* If you want to run on different GPUs, you need to launch
17+
* multi-processes or set trainer_count > 1.
18+
*/
1219
void* thread_main(void* gm_ptr) {
1320
// Initialize the thread environment of Paddle.
1421
CHECK(paddle_init_thread());
@@ -29,7 +36,7 @@ void* thread_main(void* gm_ptr) {
2936
paddle_real* cpu_input = (paddle_real*)malloc(784 * sizeof(paddle_real));
3037
paddle_real* cpu_output = (paddle_real*)malloc(10 * sizeof(paddle_real));
3138
for (int iter = 0; iter < NUM_ITER; ++iter) {
32-
// There is only one input of this network.
39+
// There is only one input layer of this network.
3340
CHECK(paddle_arguments_resize(in_args, 1));
3441
CHECK(paddle_arguments_set_value(in_args, 0, mat));
3542

paddle/capi/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PD_API paddle_error paddle_init(int argc, char** argv);
2929
/**
3030
* Initialize the thread environment of Paddle.
3131
* @note it is requisite for GPU runs but optional for CPU runs.
32+
* For GPU runs, all threads will run on the same GPU devices.
3233
*/
3334
PD_API paddle_error paddle_init_thread();
3435

0 commit comments

Comments
 (0)