HPMC User Guide v 1.00
© 2026 Bassem W. Jamaleddine


4-6

   GPU Programming with CAFFE


HPMC calculators have CAFFE = Convolutional Architecture for Fast Feature Embedding already installed on them.
Caffe is a deep learning framework developed at University of California, Berkeley. It is written in C++, with a Python interface. It is open source, under a BSD license.

Caffe supports many different types of deep learning architectures geared towards image classification and image segmentation. It supports CNN, RCNN, LSTM and fully-connected neural network designs. Caffe supports GPU- and CPU-based acceleration computational kernel libraries such as Nvidia cuDNN and Intel Xeon Phi MIC coprocessor.

Installing CAFFFE is straight forward: download the distribution into a directory, and build it from there:

#  export LD_LIBRARY_PATH=:/usr/lib/nvidia:/opt/lib64:/opt/lib:/usr/local/cuda/lib64:/usr/lib64/atlas

#  make all

#  ls -l .build_release/lib/libcaffe.so

#  make test

#  make runtest



The following shows the testing of thousands of functions of CAFFE installed on the HPMC.
.build_release/tools/caffe
caffe: command line brew
usage: caffe <command> <args>

commands:
  train           train or finetune a model
  test            score a model
  device_query    show GPU diagnostic information
  time            benchmark model execution time

  Flags from tools/caffe.cpp:
    -gpu (Run in GPU mode on given device ID.) type: int32 default: -1
    -iterations (The number of iterations to run.) type: int32 default: 50
    -model (The model definition protocol buffer text file..) type: string
      default: ""
    -snapshot (Optional; the snapshot solver state to resume training.)
      type: string default: ""
    -solver (The solver definition protocol buffer text file.) type: string
      default: ""
    -weights (Optional; the pretrained weights to initialize finetuning. Cannot
      be set simultaneously with snapshot.) type: string default: ""
.build_release/test/test_all.testbin 0 --gtest_shuffle 
Cuda number of devices: 1
Setting to use device 0
Current device id: 0
Note: Randomizing tests' orders with a seed of 43660 .
[==========] Running 1080 tests from 190 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from ThresholdLayerTest/2, where TypeParam = caffe::FloatGPU
[ RUN      ] ThresholdLayerTest/2.Test2
[       OK ] ThresholdLayerTest/2.Test2 (233 ms)
[ RUN      ] ThresholdLayerTest/2.Test
[       OK ] ThresholdLayerTest/2.Test (0 ms)
[ RUN      ] ThresholdLayerTest/2.TestSetup
[       OK ] ThresholdLayerTest/2.TestSetup (0 ms)
[----------] 3 tests from ThresholdLayerTest/2 (233 ms total)

[----------] 4 tests from ImageDataLayerTest/1, where TypeParam = caffe::DoubleCPU
[ RUN      ] ImageDataLayerTest/1.TestResize
[       OK ] ImageDataLayerTest/1.TestResize (111 ms)
[ RUN      ] ImageDataLayerTest/1.TestRead
[       OK ] ImageDataLayerTest/1.TestRead (169 ms)
[ RUN      ] ImageDataLayerTest/1.TestShuffle
[       OK ] ImageDataLayerTest/1.TestShuffle (187 ms)
[ RUN      ] ImageDataLayerTest/1.TestReshape
[       OK ] ImageDataLayerTest/1.TestReshape (50 ms)
[----------] 4 tests from ImageDataLayerTest/1 (518 ms total)

... (truncated)  (truncated)  (truncated)


[----------] 18 tests from RandomNumberGeneratorTest/1, where TypeParam = double
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussian
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussian (1 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniform
[       OK ] RandomNumberGeneratorTest/1.TestRngUniform (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngBernoulli
[       OK ] RandomNumberGeneratorTest/1.TestRngBernoulli (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngBernoulliTimesBernoulli
[       OK ] RandomNumberGeneratorTest/1.TestRngBernoulliTimesBernoulli (1 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussianTimesBernoulli
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussianTimesBernoulli (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussian2GPU
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussian2GPU (5 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniformTimesUniform
[       OK ] RandomNumberGeneratorTest/1.TestRngUniformTimesUniform (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussian2
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussian2 (1 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniform2
[       OK ] RandomNumberGeneratorTest/1.TestRngUniform2 (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussianGPU
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussianGPU (5 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussianTimesGaussian
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussianTimesGaussian (1 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniformGPU
[       OK ] RandomNumberGeneratorTest/1.TestRngUniformGPU (5 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniformIntGPU
[       OK ] RandomNumberGeneratorTest/1.TestRngUniformIntGPU (4 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngGaussianTimesGaussianGPU
[       OK ] RandomNumberGeneratorTest/1.TestRngGaussianTimesGaussianGPU (5 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniform2GPU
[       OK ] RandomNumberGeneratorTest/1.TestRngUniform2GPU (4 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniformTimesUniformGPU
[       OK ] RandomNumberGeneratorTest/1.TestRngUniformTimesUniformGPU (5 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngBernoulli2
[       OK ] RandomNumberGeneratorTest/1.TestRngBernoulli2 (0 ms)
[ RUN      ] RandomNumberGeneratorTest/1.TestRngUniformTimesBernoulli
[       OK ] RandomNumberGeneratorTest/1.TestRngUniformTimesBernoulli (0 ms)
[----------] 18 tests from RandomNumberGeneratorTest/1 (37 ms total)

... (truncated)

[----------] 4 tests from AdaGradSolverTest/1, where TypeParam = caffe::DoubleCPU
[ RUN      ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateWithWeightDecay
[       OK ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateWithWeightDecay (7 ms)
[ RUN      ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateWithEverything
[       OK ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateWithEverything (40 ms)
[ RUN      ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdate
[       OK ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdate (7 ms)
[ RUN      ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateLROneTenth
[       OK ] AdaGradSolverTest/1.TestAdaGradLeastSquaresUpdateLROneTenth (8 ms)
[----------] 4 tests from AdaGradSolverTest/1 (62 ms total)

[----------] 3 tests from ThresholdLayerTest/1, where TypeParam = caffe::DoubleCPU
[ RUN      ] ThresholdLayerTest/1.Test2
[       OK ] ThresholdLayerTest/1.Test2 (0 ms)
[ RUN      ] ThresholdLayerTest/1.Test
[       OK ] ThresholdLayerTest/1.Test (0 ms)
[ RUN      ] ThresholdLayerTest/1.TestSetup
[       OK ] ThresholdLayerTest/1.TestSetup (0 ms)
[----------] 3 tests from ThresholdLayerTest/1 (0 ms total)

[----------] Global test environment tear-down
[==========] 1080 tests from 190 test cases ran. (131752 ms total)
[  PASSED  ] 1080 tests.

  YOU HAVE 2 DISABLED TESTS



Citation:

@article{jia2014caffe,
  Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, 
            Jeff and Karayev, Sergey and Long, Jonathan and Girshick, 
            Ross and Guadarrama, Sergio and Darrell, Trevor},
  Journal = {arXiv preprint arXiv:1408.5093},
  Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
  Year = {2014}
}


Hint on installing CAFFE. The build object has links to snappy cblas atlas. The following is a list of package that you need to build caffe.

  yum install protobuf-compiler
  yum install protobuf-devel
  yum install boost boost-build boost-devel 
  yum install gflags gflags-devel
  yum install glog glog-devel
  yum install hdf5*
  yum install opencv*
  yum install leveldb leveldb-devel
  yum install lmdb*
  yum install snappy-devel
  yum install snappy-player

  yum install atlascpp atlascpp-devel
  yum install atlas-sse3 atlas-sse3-devel
  yum install blas-static blas64 blas64-devel blas64-static


Before building CAFFE make sure to have the following symbolic links:
     ln -s /usr/lib64/atlas/libatlas.so.3.0 /usr/lib64/libatlas.so
     ln -s /usr/lib64/atlas/libcblas.so.3.0 /usr/lib64/libcblas.so
     ln -s /usr/lib64/atlas/libclapack.so.3.0 /usr/lib64/libclapack.so
     ln -s /usr/lib64/atlas/libf77blas.so.3.0 /usr/lib64/libf77blas.so
     ln -s /usr/lib64/atlas/liblapack.so.3.0 /usr/lib64/liblapack.so
     ln -s /usr/lib64/atlas/libptcblas.so.3.0 /usr/lib64/libptcblas.so
     ln -s /usr/lib64/atlas/libptf77blas.so.3.0 /usr/lib64/libptf77blas.so