NVIDIA / gpu-rest-engine

A REST API for Caffe using Docker and Go
BSD 3-Clause "New" or "Revised" License
421 stars 94 forks source link

caffe Multithread #32

Closed yyy03 closed 6 years ago

yyy03 commented 6 years ago

I notice you when i search the problem about the caffe multithread,i have two questions: 1、you add the caffe::set function in the common.cpp to make caffe availabed for multithread, so i want to ask does this way make your code go faster? i mean the multithread caffe is better than the normal caffe? 2、how about change the 'boost::thread_specific_ptr' to 'std::shared_ptr' to make the caffe multithread. look forward to you answers,thinks a lot!

flx42 commented 6 years ago

Sorry for the delay in answering!

you add the caffe::set function in the common.cpp to make caffe availabed for multithread, so i want to ask does this way make your code go faster? i mean the multithread caffe is better than the normal caffe?

This is to make caffe better for multi-threaded inference only, with the given additional requirement that there are way more threads than we want caffe instances to be created, thus a TLS variable is not what we want. Also see this comment: https://github.com/NVIDIA/gpu-rest-engine/blob/20601093a2da17405311d3f99fe6df95262f0350/caffe/classification.cpp#L248-L254