RDMAAdapter::~RDMAAdapter() { StopInternalThread(); CHECK(!ibv_destroy_cq(cq_)) << "Failed to destroy CQ"; CHECK(!ibv_destroy_comp_channel(channel_)) << "Failed to destroy channel"; CHECK(!ibv_dealloc_pd(pd_)) << "Failed to deallocate PD"; CHECK(!ibv_close_device(context_)) << "Failed to release context"; }
template<typename Dtype> TransformingFastHDF5InputLayer<Dtype>:: ~TransformingFastHDF5InputLayer() { StopInternalThread(); for (int i = 0; i < tmp_.size(); i++) delete tmp_[i]; for (int i = 0; i < PREFETCH_COUNT; i++) for (int j = 0; j < prefetch_[i].blobs_.size(); j++) for (int k = 0; k < prefetch_[i].blobs_[j].size(); k++) delete prefetch_[i].blobs_[j][k]; }
void InternalThread::StartInternalThread() { // TODO switch to failing once Caffe prefetch thread is persistent. // Threads should not be started and stopped repeatedly. // CHECK(!is_started()); StopInternalThread(); #ifndef CPU_ONLY CUDA_CHECK(cudaGetDevice(&device_)); #endif mode_ = Caffe::mode(); rand_seed_ = caffe_rng_rand(); solver_count_ = Caffe::solver_count(); root_solver_ = Caffe::root_solver(); try { thread_.reset(new boost::thread(&InternalThread::entry, this)); } catch (std::exception& e) { CHECK(false) << e.what(); } }
InternalThread::~InternalThread() { StopInternalThread(); }