Build errors in latest linux-gcc version cntk-0af4fc14f8591f7ce508baaa8fb72215e4594743

Feb 9, 2015 at 7:58 PM
I get undefined reference errors in final link of gpu build:

building output for x86_64 with build type debug
g++-4.8 -g -o bin/x86_64.gpu.debug.mkl/cn.exe .build/x86_64.gpu.debug.mkl/MachineLearning/cn/NetworkDescriptionLanguage.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/cn.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/ComputationNode.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/ModelEditLanguage.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/PTaskGraphBuilder.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/SimpleNetworkBuilder.o .build/x86_64.gpu.debug.mkl/MachineLearning/cn/tests.o .build/x86_64.gpu.debug.mkl/MachineLearning/CNTKEval/CNTKEval.o .build/x86_64.gpu.debug.mkl/Math/Math/Matrix.o .build/x86_64.gpu.debug.mkl/Math/Math/GPUMatrix.o .build/x86_64.gpu.debug.mkl/Math/Math/GPUMatrixCUDAKernels.o .build/x86_64.gpu.debug.mkl/Math/Math/GPUSparseMatrix.o .build/x86_64.gpu.debug.mkl/Math/Math/GPUWatcher.o .build/x86_64.gpu.debug.mkl/Math/Math/CPUMatrix.o .build/x86_64.gpu.debug.mkl/Math/Math/CPUSparseMatrix.o .build/x86_64.gpu.debug.mkl/Common/fileutil.o .build/x86_64.gpu.debug.mkl/Common/DataWriter.o .build/x86_64.gpu.debug.mkl/Common/ConfigFile.o .build/x86_64.gpu.debug.mkl/Common/DataReader.o .build/x86_64.gpu.debug.mkl/Common/Eval.o .build/x86_64.gpu.debug.mkl/Common/File.o .build/x86_64.gpu.debug.mkl/Common/BestGpu.o .build/x86_64.gpu.debug.mkl/Common/TimerUtility.o -L/usr/local/cuda-6.5/lib64 -lcublas -lcudart -lcuda -lcurand -lcusparse -L/opt/intel/composer_xe_2015.1.133/compiler/lib/intel64 -L/opt/intel/composer_xe_2015.1.133/mkl/lib/intel64 -L/opt/intel/composer_xe_2015.1.133/compiler/lib/mic -L/opt/intel/composer_xe_2015.1.133/mkl/lib/mic -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lm -liomp5 -lpthread -fopenmp -ldl -fPIC
.build/x86_64.gpu.debug.mkl/Common/BestGpu.o: In function Microsoft::MSR::CNTK::BestGpu::~BestGpu()':
/home/hodges/CNTK_3/Common/BestGpu.cpp:293: undefined reference to
nvmlShutdown'
.build/x86_64.gpu.debug.mkl/Common/BestGpu.o: In function Microsoft::MSR::CNTK::BestGpu::GetNvmlData()':
/home/hodges/CNTK_3/Common/BestGpu.cpp:305: undefined reference to
nvmlInit_v2'
.build/x86_64.gpu.debug.mkl/Common/BestGpu.o: In function Microsoft::MSR::CNTK::BestGpu::QueryNvmlData()':
/home/hodges/CNTK_3/Common/BestGpu.cpp:483: undefined reference to
nvmlDeviceGetHandleByIndex_v2'
/home/hodges/CNTK_3/Common/BestGpu.cpp:491: undefined reference to nvmlDeviceGetPciInfo_v2'
/home/hodges/CNTK_3/Common/BestGpu.cpp:511: undefined reference to
nvmlDeviceGetMemoryInfo'
/home/hodges/CNTK_3/Common/BestGpu.cpp:519: undefined reference to nvmlDeviceGetUtilizationRates'
/home/hodges/CNTK_3/Common/BestGpu.cpp:537: undefined reference to
nvmlDeviceGetComputeRunningProcesses'
/home/hodges/CNTK_3/Common/BestGpu.cpp:544: undefined reference to nvmlDeviceGetComputeRunningProcesses'
/home/hodges/CNTK_3/Common/BestGpu.cpp:556: undefined reference to
nvmlSystemGetProcessName'
collect2: error: ld returned 1 exit status

make: *** [bin/x86_64.gpu.debug.mkl/cn.exe] Error 1

In cpu build I get the following errors in compiling NoGPU.cpp:

creating .build/x86_64.cpu.release.mkl/Math/Math/NoGPU.o for x86_64 with build type release
g++ -c Math/Math/NoGPU.cpp -o .build/x86_64.cpu.release.mkl/Math/Math/NoGPU.o -O4 -msse3 -std=c++0x -std=c++11 -DCPUONLY -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -DUSE_MKL -fopenmp -fpermissive -fPIC -I Common/Include -I Math/Math -I MachineLearning/cn -I /opt/intel/composer_xe_2015.1.133/mkl/include -MD -MP -MF .build/x86_64.cpu.release.mkl/Math/Math/NoGPU.d
Math/Math/NoGPU.cpp:70:40: error: redefinition of ‘ElemType* Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::BufferPointer() const’
 template<class ElemType> ElemType* GPUSparseMatrix<ElemType>::BufferPointer() const
                                    ^
In file included from Math/Math/NoGPU.cpp:13:0:
Math/Math/GPUSparseMatrix.h:105:26: error: ‘ElemType* Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::BufferPointer() const’ previously declared here
     inline ElemType* BufferPointer() const { return m_pArray; }
                      ^
Math/Math/NoGPU.cpp:75:192: warning: default argument given for parameter 5 of ‘void Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::Resize(size_t, size_t, size_t, Microsoft::MSR::CNTK::MatrixFormat, bool)’ [-fpermissive]
 template<class ElemType> void GPUSparseMatrix<ElemType>::Resize(const size_t numRows, const size_t numCols, const size_t numNZ, const MatrixFormat matrixFormat, const bool growOnly = true) {}//matrix format will affect the size to allocate
                                                                                                                                                                                            ^
In file included from Math/Math/NoGPU.cpp:13:0:
Math/Math/GPUSparseMatrix.h:119:14: warning: after previous specification in ‘void Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::Resize(size_t, size_t, size_t, Microsoft::MSR::CNTK::MatrixFormat, bool)’ [-fpermissive]
     void Resize(const size_t numRows, const size_t numCols, const size_t numNZElemToReserve, const MatrixFormat matrixFormat, const bool growOnly = true); //matrix format will affect the size to allocate
          ^
Math/Math/NoGPU.cpp:76:159: warning: default argument given for parameter 4 of ‘void Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::Resize(size_t, size_t, size_t, bool)’ [-fpermissive]
 template<class ElemType> void GPUSparseMatrix<ElemType>::Resize(const size_t numRows, const size_t numCols, const size_t numNZ, const bool growOnly = true) {}
                                                                                                                                                           ^
In file included from Math/Math/NoGPU.cpp:13:0:
Math/Math/GPUSparseMatrix.h:120:14: warning: after previous specification in ‘void Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::Resize(size_t, size_t, size_t, bool)’ [-fpermissive]
     void Resize(const size_t numRows, const size_t numCols, const size_t numNZElemToReserve, const bool growOnly = true);
          ^
Math/Math/NoGPU.cpp:354:118: warning: cannot declare member function ‘static void Microsoft::MSR::CNTK::GPUSparseMatrix<ElemType>::CopyBuffer(OutType*, const InType*, size_t)’ to have static linkage [-fpermissive]
 static void GPUSparseMatrix<ElemType>::CopyBuffer(OutType * outBuffer, const InType * inBuffer, const size_t size){}
                                                                                                                  ^
make: *** [.build/x86_64.cpu.release.mkl/Math/Math/NoGPU.o] Error 1
Richard
Feb 20, 2015 at 8:40 PM
Sorry, I didn't noticed this thread.
I already fixed the CPU issue but I cannot repeat the error on GPU.

Let me do some double check.

thanks,

Yu
May 23, 2015 at 4:03 PM
Hi

I had similar problem in cpu build with Makefile.cpp, where
I got errors in compiling NoGPU.cpp.

How to solve this problems?

-Sakti-
May 24, 2015 at 4:55 AM
Hi,

I can compile it fine. Could you send me your compile log and also your Makefile (yzhang87@mit.edu)?

thanks,
Yu