dividiti / ck-caffe

Collective Knowledge workflow for Caffe to automate installation across diverse platforms and to collaboratively evaluate and optimize Caffe-based workloads across diverse hardware, software and data sets (compilers, libraries, tools, models, inputs):
http://cKnowledge.org
BSD 3-Clause "New" or "Revised" License
193 stars 40 forks source link

Caffe over OpenCL with clBLAS / CLBlast / ViennaCL #101

Closed kindloaf closed 7 years ago

kindloaf commented 7 years ago

Hi, It seems that there are 3 ways to use Caffe over OpenCL: (1) clBLAS (2) CLBlast (3) ViennaCL Is this correct? If yes, how can I be sure which one I was using when compiling and running the benchmarks? For example, is the configuration logged in the log file, or displayed in the ck environment?

psyhtest commented 7 years ago

@kindloaf

First, you need to find out which Caffe variant you installed. For example, on my machine I have only one variant built for android21-arm64:

$ ck show env --tags=lib,caffe
Env UID:         Target OS:      Bits: Name:                                 Version:      Tags:

cc5a35adbf43b8a5        linux-64    64 BVLC Caffe framework (opencl,clblast) trunk-8a80a89 64bits,bvlc,caffe,host-os-linux-64,lib,target-os-linux-64,v0,v0.0,vclblast,vopencl
17a825aef037ab15        linux-64    64 BVLC Caffe framework (cudnn)          trunk-8007349 64bits,bvlc,caffe,host-os-linux-64,lib,target-os-linux-64,v0,v0.8007349,vcuda,vcudnn,vmaster
4151d44fa8a64479        linux-64    64 BVLC Caffe framework (cpu)            trunk-8007349 64bits,bvlc,caffe,host-os-linux-64,lib,target-os-linux-64,v0,v0.8007349,vcpu,vmaster
d013a448284fc10f android21-arm64    64 BVLC Caffe framework (opencl,clblast) trunk-dc07695 64bits,bvlc,caffe,host-os-linux-64,lib,target-os-android21-arm64,v0,v0.0,vclblast,vopencl

In fact, the line for d013a448284fc10f already suggests that this variant was built with CLBlast (BVLC Caffe framework (opencl,clblast)) but you can verify this by looking up in its environment entry:

ck load env:d013a448284fc10f | grep CAFFE_INSTALL_DIR
      "CAFFE_INSTALL_DIR": "/home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64/install",

Moreover, you could have had several CLBlast versions (e.g. built from the development branch or a stable version e.g. 0.10.0). To find out which one exactly was used, look up the ck-install.sh file in the installation directory (e.g. home/anton/CK_TOOLS/lib-caffe-bvlc-opencl-clblast-trunk-android-ndk-4.9.x-android21-arm64 above).

It seems that there are 3 ways to use Caffe over OpenCL

Actually, more since you can also use libDNN (although I haven't tested this for a while)! For example, you can install the lib-caffe-bvlc-opencl-libdnn-clblast-universal package which uses libDNN for convolutional layers and CLBlast for fully-connected layers:

$ ck install package:lib-caffe-bvlc-opencl-libdnn-clblast-universal
kindloaf commented 7 years ago

Thanks for the help.

gfursin commented 7 years ago

BTW, also feel free to ask questions at the CK mailing list: