Legorock / cnn_ocl_fpga

ConvNet project using OpenCL on Xilinx FPGA
3 stars 4 forks source link

common.mk #1

Open Zicx opened 7 years ago

Zicx commented 7 years ago

Hi, when I try to make the sdaccel.mk file,I found the common.mk didn't exist.I wrote the tcl scripts,but my gcc didn't support c++11.I want to know whether the file common.mk inlcude the compile and emulation process?THX!

Legorock commented 7 years ago

Hi, I am using makefile workflow and my sdaccel.mk file is little modified according to my directory structure. Therefore, sdaccel.mk probably searches common.mk in a different place. If you check sdaccel.mk, at the last line there is "include ../../common/common.mk". you can modify it according to your needs.

If you don't have c++11 support of any kind, you might have troubles compiling the project. Because I used some features that are added with c++11. Since my compiler is g++ 4.6.3, I don't have full c++11 available either. You can try to compile and modify according to errors.

Cheers,

Zicx commented 7 years ago

Legorock, I have solved this problem. I changed the latest SDx and used the makefile workflow. But it include the mnist_reader_less.hpp in the cpp file cnn_runall, I downloaded the mnist which include mnist_reader.hpp, mnist_reader_common.hpp,mnist_reader_less.hpp and mnist_utils.hpp. When I run the cpu emulation,the error as following: root@--xilinx:/home/cqu/SDx2016.4/SDx/2016.4/examples/cnntest/cnn_single_opt# make -f sdaccel.mk run_cpu_em make SDA_FLOW=cpu_emu run_em -f sdaccel.mk make[1]: Entering directory /home/cqu/SDx2016.4/SDx/2016.4/examples/cnntest/cnn_single_opt' g++ -g -std=c++0x -Wall -DFPGA_DEVICE -DC_KERNEL -I/runtime/include/1_2 -I.. -DTARGET_DEVICE=\"xilinx:adm-pcie-7v3:1ddr:3.0\" -I/home/cqu/SDx2016.4/SDx/2016.4/runtime/include/1_2 -c cnn_runall.cpp -o cnn_runall.o In file included from cnn_runall.cpp:15:0: mnist/mnist_reader_less.hpp: In function ‘std::vector<T> mnist::read_training_labels()’: mnist/mnist_reader_less.hpp:143:78: error: no matching function for call to ‘read_mnist_label_file(const char [30])’ mnist/mnist_reader_less.hpp:143:78: note: candidate is: mnist/mnist_reader_less.hpp:86:20: note: template<class Label> std::vector<T> mnist::read_mnist_label_file(const string&) mnist/mnist_reader_less.hpp: In function ‘std::vector<T> mnist::read_test_labels()’: mnist/mnist_reader_less.hpp:155:77: error: no matching function for call to ‘read_mnist_label_file(const char [29])’ mnist/mnist_reader_less.hpp:155:77: note: candidate is: mnist/mnist_reader_less.hpp:86:20: note: template<class Label> std::vector<T> mnist::read_mnist_label_file(const string&) cnn_runall.cpp: In constructor ‘cnn_runall::cnn_runall(xcl_world&, const char*, bool)’: cnn_runall.cpp:114:5: error: ‘mnist_path’ is not a member of ‘mnist’ In file included from cnn_runall.cpp:15:0: mnist/mnist_reader_less.hpp: In function ‘std::vector<std::vector<Pixel> > mnist::read_training_images() [with Pixel = unsigned char, Label = unsigned char]’: mnist/mnist_reader_less.hpp:169:5: instantiated from ‘mnist::MNIST_dataset<Pixel, Label> mnist::read_dataset() [with Pixel = unsigned char, Label = unsigned char]’ cnn_runall.cpp:116:42: instantiated from here mnist/mnist_reader_less.hpp:119:98: error: no matching function for call to ‘read_mnist_image_file(const char [30])’ mnist/mnist_reader_less.hpp:119:98: note: candidate is: mnist/mnist_reader_less.hpp:49:33: note: template<class Pixel, class Label> std::vector<std::vector<Pixel> > mnist::read_mnist_image_file(const string&) mnist/mnist_reader_less.hpp: In function ‘std::vector<std::vector<Pixel> > mnist::read_test_images() [with Pixel = unsigned char, Label = unsigned char]’: mnist/mnist_reader_less.hpp:172:5: instantiated from ‘mnist::MNIST_dataset<Pixel, Label> mnist::read_dataset() [with Pixel = unsigned char, Label = unsigned char]’ cnn_runall.cpp:116:42: instantiated from here mnist/mnist_reader_less.hpp:131:97: error: no matching function for call to ‘read_mnist_image_file(const char [29])’ mnist/mnist_reader_less.hpp:131:97: note: candidate is: mnist/mnist_reader_less.hpp:49:33: note: template<class Pixel, class Label> std::vector<std::vector<Pixel> > mnist::read_mnist_image_file(const string&) mnist/mnist_reader_less.hpp: In function ‘std::vector<std::vector<Pixel> > mnist::read_training_images() [with Pixel = unsigned char, Label = unsigned char]’: mnist/mnist_reader_less.hpp:120:1: warning: control reaches end of non-void function [-Wreturn-type] mnist/mnist_reader_less.hpp: In function ‘std::vector<T> mnist::read_training_labels() [with Label = unsigned char]’: mnist/mnist_reader_less.hpp:144:1: warning: control reaches end of non-void function [-Wreturn-type] mnist/mnist_reader_less.hpp: In function ‘std::vector<std::vector<Pixel> > mnist::read_test_images() [with Pixel = unsigned char, Label = unsigned char]’: mnist/mnist_reader_less.hpp:132:1: warning: control reaches end of non-void function [-Wreturn-type] mnist/mnist_reader_less.hpp: In function ‘std::vector<T> mnist::read_test_labels() [with Label = unsigned char]’: mnist/mnist_reader_less.hpp:156:1: warning: control reaches end of non-void function [-Wreturn-type] make[1]: *** [cnn_runall.o] Error 1 make[1]: Leaving directory/home/cqu/SDx2016.4/SDx/2016.4/examples/cnntest/cnn_single_opt' make: *** [run_cpu_em] Error 2

Did you use the same mnist_reader_less.hpp file?

Legorock commented 7 years ago

I don't know where you include "mnist_reader_less.hpp" (I am not the original author of header file) but there is a missing #include <string> in the beginning of that header. That would be my guess, because compiler couldn't find std::string, hence try to interpret the function arguments as const char array. If you want modify the header file and add #include <string>.

Zicx commented 7 years ago

The mnist_reader_less.hpp I used included head file "string". But in the project , I couldn't find the lenet model (csv) your trained. And as shown in error, mnist_path is not a member of mnist. The head file "mnist_reader_less.hpp" I used has something wrong ?