NVIDIA / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
672 stars 263 forks source link

set_mode(Caffe::GPU) failed in version 0.16 #451

Closed jellyDL closed 6 years ago

jellyDL commented 6 years ago

complie caffe as dynamic lib(-lcaffe), using setmode(Caffe::GPU) before calling the dynamic lib, found the mode(GPU/CPU) can not be set in the dynamic library。 I guess it caused by "static thread_local unique_ptr threadinstance" , Is there a good solution?

cudnn:6021 cuda 8000 cuda driver 9000

drnikolaev commented 6 years ago

Hi @xiaoxiongguilai Do you link using ldd or load so dynamically? In upcoming release please do this in your main()

  vector<int> gpus;
  get_gpus(&gpus);  // fill it with ids like 0,1,2,3
  caffe::GPUMemory::Scope gpu_memory_scope(gpus);
  Caffe::set_mode(Caffe::GPU);