nvcaffe build failure

following this guide

https://www.nvidia.in/object/caffe-installation-in.html

is useless.

lots of errors with "error: ‘loss’ cannot be used as a function’

make all -j12
NVCC src/caffe/layers/cudnn_dropout_layer.cu
NVCC src/caffe/layers/inner_product_layer.cu
NVCC src/caffe/layers/exp_layer.cu
NVCC src/caffe/layers/pooling_layer.cu
NVCC src/caffe/layers/l1_loss_layer.cu
NVCC src/caffe/layers/embed_layer.cu
NVCC src/caffe/layers/power_layer.cu
NVCC src/caffe/layers/lrn_layer.cu
NVCC src/caffe/layers/cudnn_relu_layer.cu
NVCC src/caffe/layers/softmax_loss_layer.cu
NVCC src/caffe/layers/normalize_layer.cu
NVCC src/caffe/layers/log_layer.cu
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/exp_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/exp_layer.o] Error 1
make: *** Waiting for unfinished jobs…
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/power_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/power_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/log_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/log_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/cudnn_dropout_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/cudnn_dropout_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/cudnn_relu_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/cudnn_relu_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/embed_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/embed_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/normalize_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/normalize_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/lrn_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/lrn_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/pooling_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/pooling_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/l1_loss_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/l1_loss_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/inner_product_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/inner_product_layer.o] Error 1
./include/caffe/layer.hpp: In member function ‘virtual float caffe::Layer<Ftype, Btype>::Forward(const std::vectorcaffe::Blob*&, const std::vectorcaffe::Blob*&)’:
./include/caffe/layer.hpp:565:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
./include/caffe/layer.hpp:575:16: error: ‘loss’ cannot be used as a function
if (this->loss(top_id) == 0.F) { continue; }
^
Makefile:623: recipe for target ‘.build_release/cuda/src/caffe/layers/softmax_loss_layer.o’ failed
make: *** [.build_release/cuda/src/caffe/layers/softmax_loss_layer.o] Error 1

I’ve moved on to using Nvidia-docker. Same performance.

I solved this problem using g+±5 instead of g+±7

The name of local variable cannot be the same of the name of function.

change as follows.

float loss = 0.F;
to
float lloss = 0.F;

change all “loss” to “lloss” the line 559,569,590,602,609 (nvcaffe v0.17.2)

Did you ever figure out a way to get around this problem?

I am just commenting out the section in layer.hpp that deals with it the loss function and seeing what happens. Still building with the make all command. Will let you know how it all turns out…

cudaeducation.com