dnouri / cuda-convnet

My fork of Alex Krizhevsky's cuda-convnet from 2013 where I added dropout, among other features.
http://code.google.com/p/cuda-convnet/
254 stars 147 forks source link

various syntax errors while trying to make #22

Open saminpayro opened 6 years ago

saminpayro commented 6 years ago

Hi, I'm trying to make the project on Ubuntu 16.04. First I run cmake -DBLAS_LIBRARIES=/OpenBLAS/libopenblas.so -DBLAS_INCLUDE_DIRS=/data/samin/OpenBLAS .

Because it asks me to initialize BLAS_INCLUDE_DIRS. Then when I try make I get several syntax errors like these:

/data/samin/cuda-convnet/include/common/matrix.h:308:1: error: expected declaration before ‘}’ token };

/data/samin/OpenBLAS/common.h:168:15: error: expected ‘}’ before numeric constant

define ZERO 0.e0f

what's the issue? Here is the complete log: [ 4%] Building CXX object src/common/CMakeFiles/common.dir/matrix.cpp.o In file included from /data/samin/OpenBLAS/cblas.h:5:0, from /data/samin/cuda-convnet/include/common/matrix.h:86, from /data/samin/cuda-convnet/src/common/matrix.cpp:27: /data/samin/OpenBLAS/common.h:168:15: error: expected identifier before numeric constant

define ZERO 0.e0f

           ^

/data/samin/cuda-convnet/include/common/matrix.h:133:50: note: in expansion of macro ‘ZERO’ TANH, RECIPROCAL, SQUARE, ABS, EXP, LOG, ZERO, ONE, LOGISTIC1, LOGISTIC2, SIGN ^ /data/samin/OpenBLAS/common.h:168:15: error: expected ‘}’ before numeric constant

define ZERO 0.e0f

           ^

/data/samin/cuda-convnet/include/common/matrix.h:133:50: note: in expansion of macro ‘ZERO’ TANH, RECIPROCAL, SQUARE, ABS, EXP, LOG, ZERO, ONE, LOGISTIC1, LOGISTIC2, SIGN ^ /data/samin/OpenBLAS/common.h:168:15: error: expected unqualified-id before numeric constant

define ZERO 0.e0f

           ^

/data/samin/cuda-convnet/include/common/matrix.h:133:50: note: in expansion of macro ‘ZERO’ TANH, RECIPROCAL, SQUARE, ABS, EXP, LOG, ZERO, ONE, LOGISTIC1, LOGISTIC2, SIGN ^ In file included from /data/samin/cuda-convnet/src/common/matrix.cpp:27:0: /data/samin/cuda-convnet/include/common/matrix.h:135:12: error: expected unqualified-id before ‘)’ token Matrix(); ^ /data/samin/cuda-convnet/include/common/matrix.h:136:12: error: expected unqualified-id before ‘long’ Matrix(long int numRows, long int numCols); ^ /data/samin/cuda-convnet/include/common/matrix.h:136:12: error: expected ‘)’ before ‘long’ /data/samin/cuda-convnet/include/common/matrix.h:140:12: error: expected unqualified-id before ‘const’ Matrix(const Matrix &like); ^ /data/samin/cuda-convnet/include/common/matrix.h:140:12: error: expected ‘)’ before ‘const’ In file included from /data/samin/cuda-convnet/include/common/matrix.h:30:0, from /data/samin/cuda-convnet/src/common/matrix.cpp:27: /data/samin/cuda-convnet/include/common/matrix_funcs.h:37:15: error: expected unqualified-id before ‘float’

define MTYPE float

           ^

/data/samin/cuda-convnet/include/common/matrix.h:141:12: note: in expansion of macro ‘MTYPE’ Matrix(MTYPE* data, long int numRows, long int numCols); ^ /data/samin/cuda-convnet/include/common/matrix_funcs.h:37:15: error: expected ‘)’ before ‘float’

define MTYPE float

           ^

/data/samin/cuda-convnet/include/common/matrix.h:141:12: note: in expansion of macro ‘MTYPE’ Matrix(MTYPE* data, long int numRows, long int numCols); ^ /data/samin/cuda-convnet/include/common/matrix_funcs.h:37:15: error: expected unqualified-id before ‘float’

define MTYPE float

           ^

/data/samin/cuda-convnet/include/common/matrix.h:142:12: note: in expansion of macro ‘MTYPE’ Matrix(MTYPE* data, long int numRows, long int numCols, bool transpose); ^ /data/samin/cuda-convnet/include/common/matrix_funcs.h:37:15: error: expected ‘)’ before ‘float’

define MTYPE float

           ^

/data/samin/cuda-convnet/include/common/matrix.h:142:12: note: in expansion of macro ‘MTYPE’ Matrix(MTYPE data, long int numRows, long int numCols, bool transpose); ^ In file included from /data/samin/cuda-convnet/src/common/matrix.cpp:27:0: /data/samin/cuda-convnet/include/common/matrix.h:143:14: error: expected constructor, destructor, or type conversion before ‘;’ token ~Matrix(); ^ /data/samin/cuda-convnet/include/common/matrix.h:145:51: error: non-member function ‘float& getCell(long int, long int)’ cannot have cv-qualifier inline MTYPE& getCell(long int i, long int j) const { ^ In file included from /data/samin/OpenBLAS/common_stackalloc.h:31:0, from /data/samin/OpenBLAS/common.h:793, from /data/samin/OpenBLAS/cblas.h:5, from /data/samin/cuda-convnet/include/common/matrix.h:86, from /data/samin/cuda-convnet/src/common/matrix.cpp:27: /data/samin/cuda-convnet/include/common/matrix.h: In function ‘float& getCell(long int, long int)’: /data/samin/cuda-convnet/include/common/matrix.h:146:30: error: ‘_numRows’ was not declared in this scope assert(i >= 0 && i < _numRows); ^ /data/samin/cuda-convnet/include/common/matrix.h:147:30: error: ‘_numCols’ was not declared in this scope assert(j >= 0 && j < _numCols); ^ In file included from /data/samin/cuda-convnet/src/common/matrix.cpp:27:0: /data/samin/cuda-convnet/include/common/matrix.h:148:13: error: ‘_trans’ was not declared in this scope if (_trans == CblasTrans) { ^ /data/samin/cuda-convnet/include/common/matrix.h:149:20: error: ‘_data’ was not declared in this scope return _data[j _numRows + i]; ^ /data/samin/cuda-convnet/include/common/matrix.h:151:16: error: ‘_data’ was not declared in this scope return _data[i _numCols + j]; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:154:47: error: non-member function ‘float& operator()(long int, long int)’ cannot have cv-qualifier MTYPE& operator()(long int i, long int j) const { ^ /data/samin/cuda-convnet/include/common/matrix.h:154:47: error: ‘float& operator()(long int, long int)’ must be a nonstatic member function /data/samin/cuda-convnet/include/common/matrix.h:158:29: error: non-member function ‘float getData()’ cannot have cv-qualifier inline MTYPE getData() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘float getData()’: /data/samin/cuda-convnet/include/common/matrix.h:159:16: error: ‘_data’ was not declared in this scope return _data; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:162:26: error: non-member function ‘bool isView()’ cannot have cv-qualifier inline bool isView() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘bool isView()’: /data/samin/cuda-convnet/include/common/matrix.h:163:17: error: ‘_ownsData’ was not declared in this scope return !_ownsData; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:166:34: error: non-member function ‘long int getNumRows()’ cannot have cv-qualifier inline long int getNumRows() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getNumRows()’: /data/samin/cuda-convnet/include/common/matrix.h:167:16: error: ‘_numRows’ was not declared in this scope return _numRows; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:170:34: error: non-member function ‘long int getNumCols()’ cannot have cv-qualifier inline long int getNumCols() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getNumCols()’: /data/samin/cuda-convnet/include/common/matrix.h:171:16: error: ‘_numCols’ was not declared in this scope return _numCols; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:174:39: error: non-member function ‘long int getNumDataBytes()’ cannot have cv-qualifier inline long int getNumDataBytes() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getNumDataBytes()’: /data/samin/cuda-convnet/include/common/matrix.h:175:16: error: ‘_numElements’ was not declared in this scope return _numElements * sizeof(MTYPE); ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:178:38: error: non-member function ‘long int getNumElements()’ cannot have cv-qualifier inline long int getNumElements() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getNumElements()’: /data/samin/cuda-convnet/include/common/matrix.h:179:16: error: ‘_numElements’ was not declared in this scope return _numElements; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:182:37: error: non-member function ‘long int getLeadingDim()’ cannot have cv-qualifier inline long int getLeadingDim() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getLeadingDim()’: /data/samin/cuda-convnet/include/common/matrix.h:183:16: error: ‘_trans’ was not declared in this scope return _trans == CblasTrans ? _numRows : _numCols; ^ /data/samin/cuda-convnet/include/common/matrix.h:183:39: error: ‘_numRows’ was not declared in this scope return _trans == CblasTrans ? _numRows : _numCols; ^ /data/samin/cuda-convnet/include/common/matrix.h:183:50: error: ‘_numCols’ was not declared in this scope return _trans == CblasTrans ? _numRows : _numCols; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:186:39: error: non-member function ‘long int getFollowingDim()’ cannot have cv-qualifier inline long int getFollowingDim() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘long int getFollowingDim()’: /data/samin/cuda-convnet/include/common/matrix.h:187:16: error: ‘_trans’ was not declared in this scope return _trans == CblasTrans ? _numCols : _numRows; ^ /data/samin/cuda-convnet/include/common/matrix.h:187:39: error: ‘_numCols’ was not declared in this scope return _trans == CblasTrans ? _numCols : _numRows; ^ /data/samin/cuda-convnet/include/common/matrix.h:187:50: error: ‘_numRows’ was not declared in this scope return _trans == CblasTrans ? _numCols : _numRows; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:190:43: error: non-member function ‘CBLAS_TRANSPOSE getBLASTrans()’ cannot have cv-qualifier inline CBLAS_TRANSPOSE getBLASTrans() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘CBLAS_TRANSPOSE getBLASTrans()’: /data/samin/cuda-convnet/include/common/matrix.h:191:16: error: ‘_trans’ was not declared in this scope return _trans; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:194:45: error: non-member function ‘bool isSameDims(const Matrix&)’ cannot have cv-qualifier inline bool isSameDims(const Matrix& a) const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘bool isSameDims(const Matrix&)’: /data/samin/cuda-convnet/include/common/matrix.h:195:18: error: ‘const class Matrix’ has no member named ‘getNumRows’ return a.getNumRows() == getNumRows() && a.getNumCols() == getNumCols(); ^ /data/samin/cuda-convnet/include/common/matrix.h:195:52: error: ‘const class Matrix’ has no member named ‘getNumCols’ return a.getNumRows() == getNumRows() && a.getNumCols() == getNumCols(); ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:198:27: error: non-member function ‘bool isTrans()’ cannot have cv-qualifier inline bool isTrans() const { ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘bool isTrans()’: /data/samin/cuda-convnet/include/common/matrix.h:199:16: error: ‘_trans’ was not declared in this scope return _trans == CblasTrans; ^ /data/samin/cuda-convnet/include/common/matrix.h: In function ‘void setTrans(bool)’: /data/samin/cuda-convnet/include/common/matrix.h:210:9: error: ‘_trans’ was not declared in this scope _trans = trans ? CblasTrans : CblasNoTrans; ^ /data/samin/cuda-convnet/include/common/matrix.h: At global scope: /data/samin/cuda-convnet/include/common/matrix.h:213:16: error: variable or field ‘apply’ declared void void apply(FUNCTION f); ^ /data/samin/cuda-convnet/include/common/matrix.h:213:16: error: ‘FUNCTION’ was not declared in this scope /data/samin/cuda-convnet/include/common/matrix.h:216:59: error: non-member function ‘void subtractFromScalar(float, Matrix&)’ cannot have cv-qualifier void subtractFromScalar(MTYPE scalar, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:220:57: error: non-member function ‘void biggerThanScalar(float, Matrix&)’ cannot have cv-qualifier void biggerThanScalar(MTYPE scalar, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:221:58: error: non-member function ‘void smallerThanScalar(float, Matrix&)’ cannot have cv-qualifier void smallerThanScalar(MTYPE scalar, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:222:53: error: non-member function ‘void equalsScalar(float, Matrix&)’ cannot have cv-qualifier void equalsScalar(MTYPE scalar, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:224:48: error: non-member function ‘void biggerThan(Matrix&, Matrix&)’ cannot have cv-qualifier void biggerThan(Matrix& a, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:226:49: error: non-member function ‘void smallerThan(Matrix&, Matrix&)’ cannot have cv-qualifier void smallerThan(Matrix& a, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:228:45: error: non-member function ‘void minWith(Matrix&, Matrix&)’ cannot have cv-qualifier void minWith(Matrix &a, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:230:45: error: non-member function ‘void maxWith(Matrix&, Matrix&)’ cannot have cv-qualifier void maxWith(Matrix &a, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:232:44: error: non-member function ‘void equals(Matrix&, Matrix&)’ cannot have cv-qualifier void equals(Matrix& a, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:234:47: error: non-member function ‘void notEquals(Matrix&, Matrix&)’ cannot have cv-qualifier void notEquals(Matrix& a, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:248:50: error: non-member function ‘void addScalar(float, Matrix&)’ cannot have cv-qualifier void addScalar(MTYPE scalar, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:250:54: error: non-member function ‘void maxWithScalar(float, Matrix&)’ cannot have cv-qualifier void maxWithScalar(MTYPE scalar, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:252:54: error: non-member function ‘void minWithScalar(float, Matrix&)’ cannot have cv-qualifier void minWithScalar(MTYPE scalar, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:259:91: error: non-member function ‘Matrix& slice(long int, long int, long int, long int)’ cannot have cv-qualifier Matrix& slice(long int startRow, long int endRow, long int startCol, long int endCol) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:260:104: error: non-member function ‘void slice(long int, long int, long int, long int, Matrix&)’ cannot have cv-qualifier void slice(long int startRow, long int endRow, long int startCol, long int endCol, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:261:59: error: non-member function ‘Matrix& sliceRows(long int, long int)’ cannot have cv-qualifier Matrix& sliceRows(long int startRow, long int endRow) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:262:72: error: non-member function ‘void sliceRows(long int, long int, Matrix&)’ cannot have cv-qualifier void sliceRows(long int startRow, long int endRow, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:263:59: error: non-member function ‘Matrix& sliceCols(long int, long int)’ cannot have cv-qualifier Matrix& sliceCols(long int startCol, long int endCol) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:264:72: error: non-member function ‘void sliceCols(long int, long int, Matrix&)’ cannot have cv-qualifier void sliceCols(long int startCol, long int endCol, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:266:53: error: non-member function ‘void rightMult(const Matrix&, Matrix&)’ cannot have cv-qualifier void rightMult(const Matrix &b, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:268:68: error: non-member function ‘void rightMult(const Matrix&, float, Matrix&)’ cannot have cv-qualifier void rightMult(const Matrix &b, MTYPE scaleAB, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:272:55: error: non-member function ‘void eltWiseMult(const Matrix&, Matrix&)’ cannot have cv-qualifier void eltWiseMult(const Matrix& a, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:274:57: error: non-member function ‘void eltWiseDivide(const Matrix&, Matrix&)’ cannot have cv-qualifier void eltWiseDivide(const Matrix& a, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:275:25: error: non-member function ‘Matrix& transpose()’ cannot have cv-qualifier Matrix& transpose() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:276:34: error: non-member function ‘Matrix& transpose(bool)’ cannot have cv-qualifier Matrix& transpose(bool hard) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:277:52: error: non-member function ‘Matrix& tile(long int, long int)’ cannot have cv-qualifier Matrix& tile(long int timesY, long int timesX) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:278:65: error: non-member function ‘void tile(long int, long int, Matrix&)’ cannot have cv-qualifier void tile(long int timesY, long int timesX, Matrix& target) const; ^ In file included from /data/samin/cuda-convnet/src/common/matrix.cpp:27:0: /data/samin/cuda-convnet/include/common/matrix.h:279:159: error: non-member function ‘void copy(Matrix&, long int, long int, long int, long int, long int, long int)’ cannot have cv-qualifier void copy(Matrix &dest, long int srcStartRow, long int srcEndRow, long int srcStartCol, long int srcEndCol, long int destStartRow, long int destStartCol) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:280:20: error: non-member function ‘Matrix& copy()’ cannot have cv-qualifier Matrix& copy() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:281:31: error: non-member function ‘void copy(Matrix&)’ cannot have cv-qualifier void copy(Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:282:32: error: non-member function ‘Matrix& sum(long int)’ cannot have cv-qualifier Matrix& sum(long int axis) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:283:45: error: non-member function ‘void sum(long int, Matrix&)’ cannot have cv-qualifier void sum(long int axis, Matrix &target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:284:17: error: non-member function ‘float sum()’ cannot have cv-qualifier MTYPE sum() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:285:17: error: non-member function ‘float max()’ cannot have cv-qualifier MTYPE max() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:286:32: error: non-member function ‘Matrix& max(long int)’ cannot have cv-qualifier Matrix& max(long int axis) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:287:45: error: non-member function ‘void max(long int, Matrix&)’ cannot have cv-qualifier void max(long int axis, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:288:17: error: non-member function ‘float min()’ cannot have cv-qualifier MTYPE min() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:289:32: error: non-member function ‘Matrix& min(long int)’ cannot have cv-qualifier Matrix& min(long int axis) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:290:45: error: non-member function ‘void min(long int, Matrix&)’ cannot have cv-qualifier void min(long int axis, Matrix& target) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:291:18: error: non-member function ‘float norm()’ cannot have cv-qualifier MTYPE norm() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:292:19: error: non-member function ‘float norm2()’ cannot have cv-qualifier MTYPE norm2() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:297:39: error: non-member function ‘void printShape(const char)’ cannot have cv-qualifier void printShape(const char name) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:298:19: error: non-member function ‘bool hasNan()’ cannot have cv-qualifier bool hasNan() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:299:19: error: non-member function ‘bool hasInf()’ cannot have cv-qualifier bool hasInf() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:309:18: error: non-member function ‘void print()’ cannot have cv-qualifier void print() const; ^ /data/samin/cuda-convnet/include/common/matrix.h:310:82: error: non-member function ‘void print(long int, long int, long int, long int)’ cannot have cv-qualifier void print(long int startRow,long int rows, long int startCol,long int cols) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:311:46: error: non-member function ‘void print(long int, long int)’ cannot have cv-qualifier void print(long int rows, long int cols) const; ^ /data/samin/cuda-convnet/include/common/matrix.h:312:1: error: expected declaration before ‘}’ token }; ^ src/common/CMakeFiles/common.dir/build.make:62: recipe for target 'src/common/CMakeFiles/common.dir/matrix.cpp.o' failed make[2]: [src/common/CMakeFiles/common.dir/matrix.cpp.o] Error 1 CMakeFiles/Makefile2:156: recipe for target 'src/common/CMakeFiles/common.dir/all' failed make[1]: [src/common/CMakeFiles/common.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2