MCPcopy Create free account
hub / github.com/BVLC/caffe / InternalThreadEntry

Method InternalThreadEntry

src/caffe/layers/base_data_layer.cpp:79–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78template <typename Dtype>
79void BasePrefetchingDataLayer<Dtype>::InternalThreadEntry() {
80#ifndef CPU_ONLY
81 cudaStream_t stream;
82 if (Caffe::mode() == Caffe::GPU) {
83 CUDA_CHECK(cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking));
84 }
85#endif
86
87 try {
88 while (!must_stop()) {
89 Batch<Dtype>* batch = prefetch_free_.pop();
90 load_batch(batch);
91#ifndef CPU_ONLY
92 if (Caffe::mode() == Caffe::GPU) {
93 batch->data_.data().get()->async_gpu_push(stream);
94 if (this->output_labels_) {
95 batch->label_.data().get()->async_gpu_push(stream);
96 }
97 CUDA_CHECK(cudaStreamSynchronize(stream));
98 }
99#endif
100 prefetch_full_.push(batch);
101 }
102 } catch (boost::thread_interrupted&) {
103 // Interrupted exception is expected on shutdown
104 }
105#ifndef CPU_ONLY
106 if (Caffe::mode() == Caffe::GPU) {
107 CUDA_CHECK(cudaStreamDestroy(stream));
108 }
109#endif
110}
111
112template <typename Dtype>
113void BasePrefetchingDataLayer<Dtype>::Forward_cpu(

Callers

nothing calls this directly

Calls 5

popMethod · 0.80
async_gpu_pushMethod · 0.80
dataMethod · 0.80
pushMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected