Difference between revisions of "Using Caffe On The Lab Computers"

 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<pre>
+
[http://caffe.berkeleyvision.org/ Caffe], the deep learning framework, is supported on the CS department's [[:Category:Linux Clients|Linux clients]], but there are a few things to be aware of.
Using a reference CaffeNet model from a student's Jupyter notebook code, we have found there are several things one needs to be aware of for the Caffe installation on our CS Lab computers:
 
  
* You don't need to `import sys` and add things to `sys.path`.  You can
+
== Installation Location ==
  just `import caffe`.
 
  
  * You need to be running on one of the lab machines (ugrad1 through
+
Caffe is installed in <tt>/usr/local/caffe</tt> . That installation only includes the binaries and Python modulesNotably, it does not include the reference models or utility scripts.
  ugrad24; masters1 through masters16) in order to use GPU modeCaffe
 
  will run on our compute systems (ugradx, gradx, gradz), but only in CPU
 
  mode; you won't be able to do the GPU section of the notebook on those
 
  three systems.
 
  
* The systemwide installation *only* includes the Caffe binaries and
+
If you want to use the Caffe-distributed models, you'll need to clone the Caffe repository yourself and use the contents of the <tt>models</tt> directory:
  python modules.  It does not include the utility scripts and reference
 
  models.  You will need to download those yourself.
 
  
What you'll need to do is grab your own copy of the Caffe distribution in order
+
<pre>
to use their models:
+
git clone https://github.com/BVLC/caffe.git
 +
</pre>
  
    git clone https://github.com/BVLC/caffe.git
+
=== Python Module Location ===
  
Then, as the notebook indicates, run python from the examples directory:
+
The appropriate directory is already part of the system's Python path, so if you're using the Caffe Python module, you can just use <code>import caffe</code> without having to tell Python where to find that module.
  
    cd caffe/examples
+
== GPU Support ==
    python
 
  
The notebook's second input block should be as follows:
+
GPU acceleration (via CUDA) is supported on our lab machines (ugrad1 through ugrad24 on the ugraduate network; masters1 through masters16 on the grad/research network).
  
    caffe_root = '../' # this file should be run from {caffe_root}/examples (otherwise change this line)
+
GPU acceleration is '''not''' supported on our compute systems (ugradx, ugradz, gradx, and gradz); on those systems, you will only be able to use Caffe in CPU mode.
    import caffe
 
  
Everything else should work as expected.
+
== Supported Python Versions ==
  
</pre>
+
Caffe will only work with Python 2.7.  That's the default version on our systems, so if you're just running <code>python</code>, you should be fine.  If you run <code>python3</code>, the Caffe module will not be available.  (Caffe uses Google's protocol buffers to store its data and, as of May 2016, we unfortunately don't support the protobuf module for Python 3.)
  
[[Category:Software]]
+
[[Category:Software Available On The CS Linux Clients]]

Latest revision as of 13:26, 13 April 2020

Caffe, the deep learning framework, is supported on the CS department's Linux clients, but there are a few things to be aware of.

Installation Location

Caffe is installed in /usr/local/caffe . That installation only includes the binaries and Python modules. Notably, it does not include the reference models or utility scripts.

If you want to use the Caffe-distributed models, you'll need to clone the Caffe repository yourself and use the contents of the models directory:

git clone https://github.com/BVLC/caffe.git

Python Module Location

The appropriate directory is already part of the system's Python path, so if you're using the Caffe Python module, you can just use import caffe without having to tell Python where to find that module.

GPU Support

GPU acceleration (via CUDA) is supported on our lab machines (ugrad1 through ugrad24 on the ugraduate network; masters1 through masters16 on the grad/research network).

GPU acceleration is not supported on our compute systems (ugradx, ugradz, gradx, and gradz); on those systems, you will only be able to use Caffe in CPU mode.

Supported Python Versions

Caffe will only work with Python 2.7. That's the default version on our systems, so if you're just running python, you should be fine. If you run python3, the Caffe module will not be available. (Caffe uses Google's protocol buffers to store its data and, as of May 2016, we unfortunately don't support the protobuf module for Python 3.)