c++ Predict with Caffe without CUDA ?

373 views
Skip to first unread message

mprl

unread,
May 9, 2016, 11:11:51 AM5/9/16
to Caffe Users
Hello,

I'm trying to make a single prediction in c++ with Caffe.
I found this code but it cannot compile. Indeed, as i don't intend to use my GPU, i didn't install CUDA.
But CUDA seems to be indispensable in the inclusions.

Here is the message i get when i try to compile :

In file included from main.cpp:9:
In file included from include/caffe/caffe.hpp:7:
In file included from include/caffe/blob.hpp:8:
In file included from include/caffe/common.hpp:19:
include/caffe/util/device_alternate.hpp:34:10: fatal error: 'cublas_v2.h' file not found
#include <cublas_v2.h>
         ^
1 error generated.

How can i make it work without installing CUDA ? The problem is the inclusions in the device_alternate header :

#include <cublas_v2.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <curand.h>
#include <driver_types.h> // cuda driver types


Thanks,

SRQ

unread,
May 10, 2016, 3:40:00 AM5/10/16
to Caffe Users
Ok, did you compile caffe in CPU only mode correctly? If yes, what command are you exactly entering to classify an image? You have to use the binary generated after compilation and not the cpp file directly.

mprl

unread,
May 10, 2016, 5:04:10 AM5/10/16
to Caffe Users
I wanted to write my own cpp to fit perfectly to the context of the application.
But yes, use directly the classification.bin do the job.
Thanks

Jan

unread,
May 10, 2016, 5:38:14 AM5/10/16
to Caffe Users
As long as you compile caffe in CPU-only mode, and then use the files generated/copied by "make distribute", you should be able to use the caffe C++ API without CUDA or anything GPU related.

Jan
Reply all
Reply to author
Forward
0 new messages