adepierre / caffe-char-rnn

Multi-layer Recurrent Neural Networks (with LSTM) for character-level language models in Caffe
26 stars 7 forks source link

Cannot build code #2

Open sssss465 opened 6 years ago

sssss465 commented 6 years ago

Hi, when I try to build the code I get this error

`$ make [ 25%] Building CXX object CMakeFiles/caffe_char_rnn.dir/src/Trainer.cpp.o In file included from /usr/include/c++/5/atomic:38:0, from /home/andrewh/caffe/include/caffe/common.hpp:30, from /home/andrewh/caffe/include/caffe/blob.hpp:11, from /home/andrewh/caffe/include/caffe/caffe.hpp:7, from /home/andrewh/caffe-char-rnn/include/Trainer.h:3, from /home/andrewh/caffe-char-rnn/src/Trainer.cpp:1: /usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

error This file requires compiler and library support \

^ In file included from /home/andrewh/caffe/include/caffe/common.hpp:48:0, from /home/andrewh/caffe/include/caffe/blob.hpp:11, from /home/andrewh/caffe/include/caffe/caffe.hpp:7, from /home/andrewh/caffe-char-rnn/include/Trainer.h:3, from /home/andrewh/caffe-char-rnn/src/Trainer.cpp:1: /home/andrewh/caffe/include/caffe/util/device_alternate.hpp:10:20: fatal error: nvml.h: No such file or directory compilation terminated. CMakeFiles/caffe_char_rnn.dir/build.make:62: recipe for target 'CMakeFiles/caffe_char_rnn.dir/src/Trainer.cpp.o' failed make[2]: [CMakeFiles/caffe_char_rnn.dir/src/Trainer.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/caffe_char_rnn.dir/all' failed make[1]: [CMakeFiles/caffe_char_rnn.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2`

adepierre commented 6 years ago

Hi,

Hmmm, reading your error, I think you should try with enabling C++11 for your compiler.

sssss465 commented 6 years ago

The C++11 error went away after I added it to Cmakelists. However, it is still complaining i am missing nvml.h

adepierre commented 6 years ago

NVML is not part of this code, it's from Cuda. You should check your installation of Caffe and/or Cuda

sssss465 commented 6 years ago

I built caffe from source using make and added the include folder to my PATH. After adding the cuda include folder to my path it still does not work. What were the steps you took to get the repository to work?

adepierre commented 6 years ago

I just follow these steps

  1. Compiling Caffe with CUDA enable
  2. Use CMake to build this project

I've never had any trouble with nvml.h. It seems to be a bug with CUDA rathen than with this code. Make sure everything is working with your installation of Caffe before trying to link it to this project.

Maybe you could first try to compile Caffe without the GPU support to see if everything works correctly.

sssss465 commented 6 years ago

I have tried the python api and the tests that come with caffe, and both work. I am using nvcaffe

adepierre commented 6 years ago

I've never used nvcaffe. It's probably the source of the problem. I think that nvcaffe only requires the nvidia driver, and not the CUDA toolkit.

This repo is built to work with BVLC Caffe, wich needs the CUDA toolkit to be installed. So if it's an option for you, you could just switch to BVLC Caffe. If it's not possible, I'm affraid you won't be able to use this code directly. Maybe just installing CUDA toolkit (which includes the nvlm.h file) could be enough.

sssss465 commented 6 years ago

when I run cmake on a fresh install, I get this error.

CMake Warning at CMakeLists.txt:9 (find_package): By not providing "FindCaffe.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Caffe", but CMake did not find one.

Could not find a package configuration file provided by "Caffe" with any of the following names:

CaffeConfig.cmake
caffe-config.cmake

Add the installation prefix of "Caffe" to CMAKE_PREFIX_PATH or set "Caffe_DIR" to a directory containing one of the above files. If "Caffe" provides a separate development package or SDK, be sure it has been installed.

I have caffe installed in a folder in my home folder

adepierre commented 6 years ago

Did you try to set Caffe_DIR to the path of your install folder (to help him to locate CaffeConfig.cmake) ?

For me it's my/caffe/install/path/share/Caffe/