Trouble groking cython memoryviews ... how do I implement here? - cython

Two functions: one which creates a 32-million integer array and another which uses it for a lookup millions of times.
from cpython cimport array as c_array
from array import array
def get_lut(file_location):
cdef c_array.array lut
with open(file_location, "rb") as f:
lut = array("I", f.read())
return lut
def use_lut(int[:] lut):
// Do a whole bunch of lookups.
Compiling with the following command:
c:\Users\Michael\Documents\Poker>set DISTUTILS_USE_SDK=1
c:\Users\Michael\Documents\Poker>python setup.py build_ext -i --compiler=msvc
Produces the following output:
Compiling handeval.pyx because it changed.
Cythonizing handeval.pyx
warning: View.MemoryView:288:5: Cannot profile nogil function.
warning: View.MemoryView:763:5: Cannot profile nogil function.
warning: View.MemoryView:899:5: Cannot profile nogil function.
warning: View.MemoryView:1063:5: Cannot profile nogil function.
warning: View.MemoryView:1070:5: Cannot profile nogil function.
warning: View.MemoryView:1124:5: Cannot profile nogil function.
warning: View.MemoryView:1131:5: Cannot profile nogil function.
warning: View.MemoryView:1142:5: Cannot profile nogil function.
warning: View.MemoryView:1163:5: Cannot profile nogil function.
warning: View.MemoryView:1223:5: Cannot profile nogil function.
warning: View.MemoryView:1295:5: Cannot profile nogil function.
warning: View.MemoryView:1317:5: Cannot profile nogil function.
warning: View.MemoryView:1352:5: Cannot profile nogil function.
warning: View.MemoryView:1362:5: Cannot profile nogil function.
running build_ext
building 'handeval' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\cl.exe /c /nolo
go /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\Michael\Anaconda3\include -IC:\Users\Mic
hael\Anaconda3\include /Tchandeval.c /Fobuild\temp.win-amd64-3.4\Release\handeva
l.obj
handeval.c
handeval.c(2391) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'long',
possible loss of data
handeval.c(2420) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(2449) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(2478) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(2507) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(2536) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(2565) : warning C4244: '+=' : conversion from 'Py_ssize_t' to 'int',
possible loss of data
handeval.c(12955) : error C2275: 'PyGILState_STATE' : illegal use of this type a
s an expression
C:\Users\Michael\Anaconda3\include\pystate.h(191) : see declaration of '
PyGILState_STATE'
handeval.c(12955) : error C2146: syntax error : missing ';' before identifier '_
_pyx_gilstate_save'
handeval.c(12955) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13026) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13052) : error C2275: 'PyGILState_STATE' : illegal use of this type a
s an expression
C:\Users\Michael\Anaconda3\include\pystate.h(191) : see declaration of '
PyGILState_STATE'
handeval.c(13052) : error C2146: syntax error : missing ';' before identifier '_
_pyx_gilstate_save'
handeval.c(13052) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13125) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13152) : error C2275: 'PyGILState_STATE' : illegal use of this type a
s an expression
C:\Users\Michael\Anaconda3\include\pystate.h(191) : see declaration of '
PyGILState_STATE'
handeval.c(13152) : error C2146: syntax error : missing ';' before identifier '_
_pyx_gilstate_save'
handeval.c(13152) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13242) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13909) : error C2275: 'PyGILState_STATE' : illegal use of this type a
s an expression
C:\Users\Michael\Anaconda3\include\pystate.h(191) : see declaration of '
PyGILState_STATE'
handeval.c(13909) : error C2146: syntax error : missing ';' before identifier '_
_pyx_gilstate_save'
handeval.c(13909) : error C2065: '__pyx_gilstate_save' : undeclared identifier
handeval.c(13935) : error C2065: '__pyx_gilstate_save' : undeclared identifier
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\
amd64\\cl.exe' failed with exit status 2
Whereas removing the int[:] type declaration from the use_lut signature compiles fine.
What am I doing wrong here?

Related

ebtables.c:61:3: error: implicit declaration of function 'xt_compat_calc_jump' [-Werror=implicit-function-declaration]

I am getting the following exception while building the recovery for a lineageos project and need some help diagnosing and resolving the issue
Device tree:= https://github.com/darran-kelinske-fivestars/android_device_lenovo_tb8504f/tree/lineage-15.1
Vendor tree:= https://github.com/darran-kelinske-fivestars/android_vendor_lenovo_tb8504f/tree/lineage-15.1
Kernel source:= https://github.com/darran-kelinske-fivestars/android_kernel_lenovo_tb8504f/tree/lineage-15.1
ROM Source:= https://github.com/LineageOS/android
Command: source build/envsetup.sh && breakfast tb8504f && repo sync --force-sync -q -j6 && mka recoveryimage -j6 | tee recovery.log
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: In function 'ebt_standard_compat_from_user':
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:61:3: error: implicit declaration of function 'xt_compat_calc_jump' [-Werror=implicit-function-declaration]
v += xt_compat_calc_jump(NFPROTO_BRIDGE, v);
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c: At top level:
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:76:15: error: variable 'ebt_standard_target' has initializer but incomplete type
static struct xt_target ebt_standard_target = {
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: error: unknown field 'name' specified in initializer
.name = "standard",
^
../../../../../../kernel/lenovo/msm8917/net/bridge/netfilter/ebtables.c:77:2: warning: excess elements in struct initializer
error, forbidden warning: ebtables.c:77
CC net/core/gen_estimator.o
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:257: recipe for target 'net/bridge/netfilter/ebtables.o' failed
make[4]: *** [net/bridge/netfilter/ebtables.o] Error 1
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge/netfilter' failed
make[3]: *** [net/bridge/netfilter] Error 2
/home/lineageos/kernel/lenovo/msm8917/scripts/Makefile.build:402: recipe for target 'net/bridge' failed
make[2]: *** [net/bridge] Error 2
make[2]: *** Waiting for unfinished jobs....
Full log:
https://pastebin.com/v2ZsfRuc
I resolved this issue by replacing the source in the include directory of this project with the include directory of another project.
I replaced the source with the source from this directory:
https://github.com/HighwayStar/android_kernel_lenovo_tb8704/tree/tab4-8plus-LA.UM.5.6.r1-0/include

/build/include\caffe/proto/caffe.pb.h(4356): error : expected an identifier while compiling Caffe on windows

I am trying to port Caffe-SSD to Windows. I moved all the new files (layers and whatnot) to the Caffe's latest windows branch and used the Caffe_SSD caffe.proto file and initiated the compilation process.
It seemed everything is in place but after several minutes of compilation it fails with these errors :
"C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj" (default target) (3) ->
(CustomBuild target) ->
C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/include\caffe/proto/caffe.pb.h(4356): error : expected an ident
ifier [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/include\caffe/proto/caffe.pb.h(14835): error : expected an iden
tifier [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
414 Warning(s)
2 Error(s)
Time Elapsed 00:08:49.15
ERROR: Build failed
Why am I getting this error? I used the very same caffe.proto from the ssd branch and therefore everything needs to be fine! where is the problem?
This is the configuration by the way :
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd>scripts\build_win.cmd
The system cannot find the drive specified.
The system cannot find the drive specified.
INFO: ============================================================
INFO: Summary:
INFO: ============================================================
INFO: MSVC_VERSION = 14
INFO: WITH_NINJA = 0
INFO: CMAKE_GENERATOR = "Visual Studio 14 2015 Win64"
INFO: CPU_ONLY = 0
INFO: CUDA_ARCH_NAME = Auto
INFO: CMAKE_CONFIG = Release
INFO: USE_NCCL = 0
INFO: CMAKE_BUILD_SHARED_LIBS = 0
INFO: PYTHON_VERSION = 3
INFO: BUILD_PYTHON = 1
INFO: BUILD_PYTHON_LAYER = 1
INFO: BUILD_MATLAB = 0
INFO: PYTHON_EXE = "python"
INFO: RUN_TESTS = 0
INFO: RUN_LINT = 0
INFO: RUN_INSTALL = 1
INFO: ============================================================
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/Master/Anaconda3/envs/anaconda35/python.exe (found suitable version "3.5.3", minimum required is "2.7")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found GFlags: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found gflags (include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: gflags_shared)
-- Found Glog: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found glog (include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: glog)
-- Found Protobuf: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/bin/protoc.exe (found version "3.1.0")
-- Found PROTOBUF Compiler: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/bin/protoc.exe
-- Found LMDB: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found lmdb (include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: lmdb)
-- Found LevelDB: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found LevelDB (include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: leveldb)
-- Found ZLIB: optimized;C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/lib/caffezlib.lib;debug;C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/lib/caffezlibd.lib (found version "1.2.8")
-- Found Snappy: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found Snappy (include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include, library: snappy_static;optimized;C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/lib/caffezlib.lib;debug;C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/lib/caffezlibd.lib)
-- CUDA detected: 8.0
-- Found cuDNN: ver. 6.0.20 found (include: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/cuda60/cuda/include, library: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/cuda60/cuda/lib/x64/cudnn.lib)
-- Added CUDA NVCC flags for: sm_61
-- OpenCV found (C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries)
-- Found OpenBLAS libraries: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/lib/libopenblas.dll.a
-- Found OpenBLAS include: C:/Users/Master/.caffe/dependencies/libraries_v140_x64_py35_1.1.0/libraries/include
-- Found PythonLibs: C:/Users/Master/Anaconda3/envs/anaconda35/libs/python35.lib (found suitable version "3.5.3", minimum required is "2.7")
-- Found NumPy: C:/Users/Master/Anaconda3/envs/anaconda35/lib/site-packages/numpy/core/include (found suitable version "1.13.1", minimum required is "1.7.1")
-- NumPy ver. 1.13.1 found (include: C:/Users/Master/Anaconda3/envs/anaconda35/lib/site-packages/numpy/core/include)
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- python
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.10.1.windows.1")
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0
-- Git : unknown
-- System : Windows
-- C++ compiler : C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Release CXX flags : /MD /O2 /Ob2 /DNDEBUG /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- Debug CXX flags : /MDd /Zi /Ob0 /Od /RTC1 /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- Build type : Release
--
-- BUILD_SHARED_LIBS : 0
-- BUILD_python : 1
-- BUILD_matlab : 0
-- BUILD_docs :
-- CPU_ONLY : 0
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- USE_NCCL : 0
-- ALLOW_LMDB_NOLOCK : OFF
--
-- Dependencies:
-- BLAS : Yes (Open)
-- Boost : Yes (ver. 1.61)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.1.0)
-- lmdb : Yes (ver. 0.9.70)
-- LevelDB : Yes (ver. 1.18)
-- Snappy : Yes (ver. 1.1.1)
-- OpenCV : Yes (ver. 3.1.0)
-- CUDA : Yes (ver. 8.0)
--
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_61
-- cuDNN : Yes (ver. 6.0.20)
--
-- Python:
-- Interpreter : C:/Users/Master/Anaconda3/envs/anaconda35/python.exe (ver. 3.5.3)
-- Libraries : C:/Users/Master/Anaconda3/envs/anaconda35/libs/python35.lib (ver 3.5.3)
-- NumPy : C:/Users/Master/Anaconda3/envs/anaconda35/lib/site-packages/numpy/core/include (ver 1.13.1)
--
-- Install:
-- Install path : C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/install
--
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 9/16/2017 10:12:06 PM.
Project "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ALL_BUILD.vcxproj" on node 1 (default targets).
Project "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ALL_BUILD.vcxproj" (1) is building "C:\Users\Master\Desk
top\Caffe\caffe-windows-ssd\build\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "x64\Release\ZERO_CHECK\".
Creating directory "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
Creating "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
Checking Build System
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/CMakeFiles/generate.stamp
is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/src/gtest/CMakeFiles/gene
rate.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/src/caffe/CMakeFiles/gene
rate.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/src/caffe/test/CMakeFiles
/generate.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/tools/CMakeFiles/generate
.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/examples/CMakeFiles/gener
ate.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/python/CMakeFiles/generat
e.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/matlab/CMakeFiles/generat
e.stamp is up-to-date.
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/docs/CMakeFiles/generate.
stamp is up-to-date.
FinalizeBuildStatus:
Deleting file "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
Touching "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ZERO_CHECK.vcxproj" (default targets).
Project "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ALL_BUILD.vcxproj" (1) is building "C:\Users\Master\Desk
top\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj" (3) on node 1 (default targets).
Project "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj" (3) is building "C:\Users\Maste
r\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffeproto.vcxproj" (4) on node 1 (default targets).
PrepareForBuild:
Creating directory "caffeproto.dir\Release\".
Creating directory "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\lib\Release\".
Creating directory "caffeproto.dir\Release\caffeproto.tlog\".
InitializeBuildStatus:
Creating "caffeproto.dir\Release\caffeproto.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ComputeCustomBuildOutput:
Creating directory "C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\include\caffe\proto\".
CustomBuild:
Building Custom Rule C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/src/caffe/CMakeLists.txt
CMake does not need to re-run because C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/build/src/caffe/CMakeFiles/gene
rate.stamp is up-to-date.
Running C++/Python protocol buffer compiler on C:/Users/Master/Desktop/Caffe/caffe-windows-ssd/src/caffe/proto/caffe.
proto
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I"C:\Users\Master\Desktop\Caffe\caffe
-windows-ssd\build\include" /I"C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build" /IC:\Users\Master\.caffe\depend
encies\libraries_v140_x64_py35_1.1.0\libraries\include /nologo /W3 /WX- /O2 /Ob2 /D WIN32 /D _WINDOWS /D NDEBUG /D CA
FFE_VERSION=1.0.0 /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:
inline /GR /Fo"caffeproto.dir\Release\\" /Fd"caffeproto.dir\Release\caffeproto.pdb" /Gd /TP /errorReport:queue "C:\Us
ers\Master\Desktop\Caffe\caffe-windows-ssd\build\include\caffe\proto\caffe.pb.cc"
caffe.pb.cc
This is the content of caffe.pb.h line 4356:
// nested types ----------------------------------------------------
typedef ParamSpec_DimCheckMode DimCheckMode;
static const DimCheckMode STRICT =
ParamSpec_DimCheckMode_STRICT;
static const DimCheckMode PERMISSIVE =
ParamSpec_DimCheckMode_PERMISSIVE;
static inline bool DimCheckMode_IsValid(int value) {
return ParamSpec_DimCheckMode_IsValid(value);
}
static const DimCheckMode DimCheckMode_MIN =
ParamSpec_DimCheckMode_DimCheckMode_MIN;
static const DimCheckMode DimCheckMode_MAX =
ParamSpec_DimCheckMode_DimCheckMode_MAX;
static const int DimCheckMode_ARRAYSIZE =
ParamSpec_DimCheckMode_DimCheckMode_ARRAYSIZE;
static inline const ::google::protobuf::EnumDescriptor*
DimCheckMode_descriptor() {
return ParamSpec_DimCheckMode_descriptor();
}
static inline const ::std::string& DimCheckMode_Name(DimCheckMode value) {
return ParamSpec_DimCheckMode_Name(value);
}
static inline bool DimCheckMode_Parse(const ::std::string& name,
DimCheckMode* value) {
return ParamSpec_DimCheckMode_Parse(name, value);
}
and the line 14835:
typedef V1LayerParameter_DimCheckMode DimCheckMode;
static const DimCheckMode STRICT =
V1LayerParameter_DimCheckMode_STRICT;
static const DimCheckMode PERMISSIVE =
V1LayerParameter_DimCheckMode_PERMISSIVE;
static inline bool DimCheckMode_IsValid(int value) {
return V1LayerParameter_DimCheckMode_IsValid(value);
}
static const DimCheckMode DimCheckMode_MIN =
V1LayerParameter_DimCheckMode_DimCheckMode_MIN;
static const DimCheckMode DimCheckMode_MAX =
V1LayerParameter_DimCheckMode_DimCheckMode_MAX;
static const int DimCheckMode_ARRAYSIZE =
V1LayerParameter_DimCheckMode_DimCheckMode_ARRAYSIZE;
static inline const ::google::protobuf::EnumDescriptor*
DimCheckMode_descriptor() {
return V1LayerParameter_DimCheckMode_descriptor();
}
static inline const ::std::string& DimCheckMode_Name(DimCheckMode value) {
return V1LayerParameter_DimCheckMode_Name(value);
}
static inline bool DimCheckMode_Parse(const ::std::string& name,
DimCheckMode* value) {
return V1LayerParameter_DimCheckMode_Parse(name, value);
}
In case, full compilation log is needed, the complete log is here
This is the content of caffe.proto which I have used (copied from linux ssd)
Caffe.proto From caffe_ssd_linux
Caffe.proto From caffe-windows
Update 2:
replacing STRICT with _STRICT and PERMISSIVE with _PERMISSIVE resulted in these errors :
"C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj" (default target) (3) ->
(ClCompile target) ->
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(59): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::AnnotatedDataLayer<fl
oat>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(60): error C2039: 'data_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>
>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(60): error C2228: left of '.Reshape' must have class/struct/union [C:\Users\Master\D
esktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(104): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::AnnotatedDataLayer<f
loat>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(105): error C2039: 'label_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtyp
e>>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(105): error C2228: left of '.Reshape' must have class/struct/union [C:\Users\Master\
Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(157): error C2039: 'DistortImage': is not a member of 'caffe::DataTransformer<Dtype>
' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(161): error C2039: 'ExpandImage': is not a member of 'caffe::DataTransformer<Dtype>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(168): error C2039: 'ExpandImage': is not a member of 'caffe::DataTransformer<Dtype>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(183): error C2039: 'CropImage': is not a member of 'caffe::DataTransformer<Dtype>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(229): error C2661: 'caffe::DataTransformer<Dtype>::Transform': no overloaded functio
n takes 3 arguments [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(59): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::AnnotatedDataLayer<do
uble>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(60): error C2039: 'data_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>
>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(104): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::AnnotatedDataLayer<d
ouble>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(105): error C2039: 'label_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtyp
e>>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(157): error C2039: 'DistortImage': is not a member of 'caffe::DataTransformer<Dtype>
' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(161): error C2039: 'ExpandImage': is not a member of 'caffe::DataTransformer<Dtype>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(168): error C2039: 'ExpandImage': is not a member of 'caffe::DataTransformer<Dtype>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(183): error C2039: 'CropImage': is not a member of 'caffe::DataTransformer<Dtype>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\annotated_data_layer.cpp(229): error C2661: 'caffe::DataTransformer<Dtype>::Transform': no overloaded functio
n takes 3 arguments [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\detection_output_layer.cpp(65): error C3861: 'MapLabelToName': identifier not found [C:\Users\Master\Desktop\
Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\detection_output_layer.cpp(67): error C3861: 'MapLabelToDisplayName': identifier not found [C:\Users\Master\D
esktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\detection_output_layer.cpp(462): error C2039: 'TransformInv': is not a member of 'caffe::DataTransformer<Dtyp
e>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\detection_output_layer.cpp(462): error C2039: 'TransformInv': is not a member of 'caffe::DataTransformer<Dtyp
e>' [C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\infogain_loss_layer.cpp(18): error C2039: 'axis': is not a member of 'caffe::InfogainLossParameter' [C:\Users
\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\infogain_loss_layer.cpp(57): error C2039: 'axis': is not a member of 'caffe::InfogainLossParameter' [C:\Users
\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(243): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(243): error C3861: 'GetNormalizer': identifier not found [C:\Users\Master\Desktop\Caf
fe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(249): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(249): error C3861: 'GetNormalizer': identifier not found [C:\Users\Master\Desktop\Caf
fe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(281): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(281): error C3861: 'GetNormalizer': identifier not found [C:\Users\Master\Desktop\Caf
fe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(322): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(322): error C3861: 'GetNormalizer': identifier not found [C:\Users\Master\Desktop\Caf
fe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(243): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(249): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(281): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\multibox_loss_layer.cpp(322): error C2039: 'GetNormalizer': is not a member of 'caffe::LossLayer<Dtype>' [C:\
Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(70): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::VideoDataLayer<float>' [C
:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(71): error C2039: 'data_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(71): error C2228: left of '.Reshape' must have class/struct/union [C:\Users\Master\Deskt
op\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(80): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::VideoDataLayer<float>' [C
:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(81): error C2039: 'label_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(81): error C2228: left of '.Reshape' must have class/struct/union [C:\Users\Master\Deskt
op\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(70): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::VideoDataLayer<double>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(71): error C2039: 'data_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(80): error C2039: 'PREFETCH_COUNT': is not a member of 'caffe::VideoDataLayer<double>' [
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\src\caffe\layers\video_data_layer.cpp(81): error C2039: 'label_': is not a member of 'boost::shared_ptr<caffe::Batch<Dtype>>'
[C:\Users\Master\Desktop\Caffe\caffe-windows-ssd\build\src\caffe\caffe.vcxproj]
1618 Warning(s)
48 Error(s)
Time Elapsed 00:12:50.35
ERROR: Build failed
I was having the issues that you had in Update 2 and with a bit of luck and googling I was able to solve them. So here it goes for the ones suffering from them,
I found this thread on GitHub which says,
PREFETCH_COUNT should be changed to prefetch_.size() in every troubling cpp file under <CAFFE_DIR>\caffe\src\caffe\layers. In your case they should be annotated_data_layer.cpp and video_data_layer.cpp.
this->prefetch_[i]. should be changed to this->prefetch_[i]-> in every troubling cpp file under <CAFFE_DIR>\caffe\src\caffe\layers. In your case they should be annotated_data_layer.cpp and video_data_layer.cpp. This will solve errors related to label_': is not a member, data_': is not a member and left of '.Reshape' must have class/struct/union
For infogain_loss_layer.cpp(18): error C2039: 'axis': is not a member of caffe::InfogainLossParameter error, you need to add axis to InfogainLossParameter message in caffe.proto file. In my case last used id was 1, so I added it as optional int32 axis = 2; Now InfogainLossParameter message is like below,
message InfogainLossParameter {
// Specify the infogain matrix source.
optional string source = 1;
optional int32 axis = 2;
}
Sadly, I don't think this will solve all your issues, the ones related to DataTransformer will remain but I hope it will help someone to fix some of them without spending as much time as I did.

element id containing $ character throws exception. How to escape it?

let my expression be --- #popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate
It gives the error:
Uncaught Error: Syntax error, unrecognized expression: #popovertagapplicator-container-m_mid-$cAAAm-ZIq209hIFeJe1a7xI2uY-mP-private.
Is there any way to escape $ sign?
This may help you
<h1>#popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate</h1>
<script> $('h1').text( $('h1').text().replace(/\$/g, '') ); </script>
when i try to : this.$el.find('#popovertagapplicator-container-m_mid-cAAAm-ZIq209hIFeJe1a7xI2uY-mP-pr$ivate')
it gives me : Uncaught Error: Syntax error, unrecognized expression when expression

Error in building itk with GDCM git repository

I build ITK with gdcm official release for windows. But its not having some of file that I'm using in further coding. So I have to use git version of gdcm cause its having those which I needed but following error encountered when I am trying to build ITK with ITK_USE_SYSTEM_GDCM and using gdcm git version to build gdcm bin.
>------ Build started: Project: ITKIOGDCM, Configuration: Debug Win32 ------
80>Compiling...
80>itkGDCMImageIO.cxx
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMImageIO.cxx(41) : fatal error C1083: Cannot open include file: 'gdcmImageHelper.h': No such file or directory
80>itkGDCMSeriesFileNames.cxx
80>D:\ITK\src\Modules\IO\GDCM\include\itkGDCMSeriesFileNames.h(154) : error C2664: 'void gdcm::SerieHelper::AddRestriction(const gdcm::TagKey &)' : cannot convert parameter 1 from 'const std::string' to 'const gdcm::TagKey &'
80> Reason: cannot convert from 'const std::string' to 'const gdcm::TagKey'
80> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(29) : error C2248: 'gdcm::SerieHelper::SerieHelper' : cannot access protected member declared in class 'gdcm::SerieHelper'
80> D:\GDCM\gdcm\src\gdcmSerieHelper.h(198) : see declaration of 'gdcm::SerieHelper::SerieHelper'
80> D:\GDCM\gdcm\src\gdcmSerieHelper.h(64) : see declaration of 'gdcm::SerieHelper'
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(160) : error C2027: use of undefined type 'gdcm::File'
80> D:\GDCM\gdcm\src\gdcmSerieHelper.h(34) : see declaration of 'gdcm::File'
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(160) : error C2227: left of '->IsReadable' must point to class/struct/union/generic type
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(163) : error C2027: use of undefined type 'gdcm::File'
80> D:\GDCM\gdcm\src\gdcmSerieHelper.h(34) : see declaration of 'gdcm::File'
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(163) : error C2227: left of '->GetFileName' must point to class/struct/union/generic type
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(166) : error C2027: use of undefined type 'gdcm::File'
80> D:\GDCM\gdcm\src\gdcmSerieHelper.h(34) : see declaration of 'gdcm::File'
80>..\..\..\..\..\src\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx(166) : error C2227: left of '->GetFileName' must point to class/struct/union/generic type
80>itkGDCMImageIOFactory.cxx
80>Generating Code...
80>Build log was saved at "file://d:\ITK\binGDCM\Modules\IO\GDCM\src\ITKIOGDCM.dir\Debug\BuildLog.htm"
80>ITKIOGDCM - 9 error(s), 0 warning(s)
Please help.
You are mixing the very old and deprecated GDCM 1.x with GDCM 2.x. They are actually API incompatible.

Weird error compiling code that calls Surface low-level CUDA API

This minimal example:
int main()
{
struct surfaceReference* surfaceReferencePointer;
cudaGetSurfaceReference(&surfaceReferencePointer, "surfaceReference");
}
Fails when it is compiled like this:
nvcc -g -arch=sm_20 -o foo.out foo.cu
Showing the following error message:
foo.cu(4): warning: argument of type "surfaceReference **" is incompatible with parameter of type "const surfaceReference **"
foo.cu(4): warning: argument of type "surfaceReference **" is incompatible with parameter of type "const surfaceReference **"
foo.cu: In function ‘int main()’:
foo.cu:4: error: invalid conversion from ‘surfaceReference**’ to ‘const surfaceReference**’
foo.cu:4: error: initializing argument 1 of ‘cudaError_t cudaGetSurfaceReference(const surfaceReference**, const char*)’
I cannot understand what I am doing wrong. I am compiling on a Linux Ubuntu 64-bit machine, using CUDA 3.2.
The struct surfaceReference* pointer should be defined as const:
int main()
{
const struct surfaceReference* surfaceReferencePointer;
cudaGetSurfaceReference(&surfaceReferencePointer, "surfaceReference");
}
Kudos to codymanix, who provided the right answer in the comments.