Caffe(OpenCL) Error: ordered comparison between pointer and zero ('int32_t *' (aka 'int *') and 'int')
rajhlinux opened this issue · comments
Issue summary
I get the following error:
/home/user/caffe/src/caffe/backend/device.cpp:280:50: error: ordered comparison between pointer and zero ('int32_t *' (aka 'int *') and 'int')
if (*lock_id < buffer_flags_.size() && lock_id > 0) {
Here is the Full Error displayed from terminal:
https://pastebin.com/VWFXNumJ
Here is the Cmake Error Log:
https://pastebin.com/fEeDFcBX
Steps to produce:
(Note: I am not building with python, do not need it since I am trying to build Caffe so that it can be used by another project called "OpenPose", also I program in C/C++)
How I config and generate with cmake:
cmake \
-D ViennaCL_INCLUDE_DIR=../ViennaCL-1.7.1 \
-D OPENCL_INCLUDE_DIRS=../ViennaCL-1.7.1/CL/ \
-D OPENCL_LIBRARIES=/usr/local/lib/libMesaOpenCL.so.1 \
-D CMAKE_BUILD_TYPE=Release \
-D CPU_ONLY=false \
-D BUILD_python=False \
-D BUILD_python_layer=False \
-D USE_OPENCL=ON \
-D BLAS=open ..
Here is the cmake config and generate info:
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is Clang 13.0.0
-- The CXX compiler identification is Clang 13.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at cmake/Misc.cmake:32 (set):
implicitly converting 'BOOLEAN' to 'STRING' type.
Call Stack (most recent call first):
CMakeLists.txt:47 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/usr/local/share/cmake/Modules/FindBoost.cmake:1513 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake/Modules/FindBoost.cmake:2124 (_Boost_MISSING_DEPENDENCIES)
cmake/Dependencies.cmake:8 (find_package)
CMakeLists.txt:171 (include)
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/usr/local/share/cmake/Modules/FindBoost.cmake:1513 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake/Modules/FindBoost.cmake:2124 (_Boost_MISSING_DEPENDENCIES)
cmake/Dependencies.cmake:8 (find_package)
CMakeLists.txt:171 (include)
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/usr/local/share/cmake/Modules/FindBoost.cmake:1513 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake/Modules/FindBoost.cmake:2124 (_Boost_MISSING_DEPENDENCIES)
cmake/Dependencies.cmake:8 (find_package)
CMakeLists.txt:171 (include)
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/usr/local/share/cmake/Modules/FindBoost.cmake:1513 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake/Modules/FindBoost.cmake:2124 (_Boost_MISSING_DEPENDENCIES)
cmake/Dependencies.cmake:8 (find_package)
CMakeLists.txt:171 (include)
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
/usr/local/share/cmake/Modules/FindBoost.cmake:1513 (_Boost_COMPONENT_DEPENDENCIES)
/usr/local/share/cmake/Modules/FindBoost.cmake:2124 (_Boost_MISSING_DEPENDENCIES)
cmake/Dependencies.cmake:8 (find_package)
CMakeLists.txt:171 (include)
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Boost: /usr/local/include (found suitable version "1.80.0", minimum required is "1.54") found components: system thread filesystem chrono atomic
-- Found GFlags: /usr/local/include
-- Found gflags (include: /usr/local/include, library: /usr/local/lib/libgflags.so)
-- Found Glog: /usr/local/include
-- Found glog (include: /usr/local/include, library: /usr/local/lib/libglog.so)
CMake Warning (dev) at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PROTOBUF)
does not match the name of the calling package (Protobuf). This can lead
to problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/Modules/FindProtobuf.cmake:227 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/ProtoBuf.cmake:9 (find_package)
cmake/Dependencies.cmake:48 (include)
CMakeLists.txt:171 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PROTOBUF: /usr/local/lib/libprotobuf.so
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- Found HDF5: hdf5-shared;hdf5_cpp-shared (found version "1.12.2") found components: HL
-- Found LMDB: /usr/local/include
-- Found lmdb (include: /usr/local/include, library: /usr/local/lib/liblmdb.so)
-- Found LevelDB: /usr/local/include
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.so)
CMake Warning (dev) at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (SQLITE3)
does not match the name of the calling package (SQLite). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/Modules/FindSQLite.cmake:26 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/Dependencies.cmake:99 (find_package)
CMakeLists.txt:171 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found SQLITE3: /usr/local/lib/libsqlite3.so
-- Found Snappy: /usr/local/include
-- Found Snappy (include: /usr/local/include, library: /usr/local/lib/libsnappy.so)
-- Found ViennaCL include: /home/user/caffe/ViennaCL-1.7.1
-- Found OpenCL: /usr/local/lib/libMesaOpenCL.so.1
-- Found OpenCL include: /home/user/caffe/ViennaCL-1.7.1/CL
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/usr/local/lib/cmake/opencv4)
-- Found OpenBLAS libraries: /usr/local/lib/libopenblas.so
-- Found OpenBLAS include: /usr/local/include
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
Using native target
CMake Deprecation Warning at android/CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Python interface is disabled or not all required dependencies found. Building without it...
-- Found Git: /usr/local/bin/git (found version "2.37.1")
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0
-- Git : 1.0-6267-g3f2b97e9-dirty
-- System : FreeBSD
-- C++ compiler : /usr/bin/c++
-- Release CXX flags : -O3 -DNDEBUG -fPIC -Wall -std=c++11 -DCMAKE_BUILD -march=native -Wno-sign-compare -Wno-uninitialized
-- Debug CXX flags : -g -fPIC -Wall -std=c++11 -DCMAKE_BUILD -march=native -Wno-sign-compare -Wno-uninitialized
-- Build type : Release
--
-- BUILD_SHARED_LIBS : ON
-- BUILD_python : False
-- BUILD_matlab : OFF
-- BUILD_docs : ON
-- CPU_ONLY : false
-- USE_OPENCV : ON
-- USE_FFT : OFF
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- USE_NCCL : OFF
-- ALLOW_LMDB_NOLOCK : OFF
-- USE_HDF5 : ON
--
-- Dependencies:
-- BLAS : Yes (open)
-- Boost : Yes (ver. 1.80)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. ..)
-- lmdb : Yes (ver. 0.9.29)
-- LevelDB : Yes (ver. 1.23)
-- Snappy : Yes (ver. 1.1.9)
-- OpenCV : Yes (ver. 4.6.0)
-- CUDA : No
--
-- Documentaion:
-- Doxygen : No
-- config_file :
--
-- Install:
-- Install path : /home/user/caffe/build/install
--
-- Configuring done
CMake Warning (dev) in src/caffe/CMakeLists.txt:
Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
interface. Run "cmake --help-policy CMP0022" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Target "caffe" has an INTERFACE_LINK_LIBRARIES property which differs from
its LINK_INTERFACE_LIBRARIES properties.
INTERFACE_LINK_LIBRARIES:
caffeproto;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_thread.so;-lpthread;/usr/local/lib/libboost_filesystem.so;/usr/local/lib/libboost_chrono.so;/usr/local/lib/libboost_atomic.so;/usr/local/lib/libglog.so;/usr/local/lib/libgflags.so;$<$<NOT:$<CONFIG:DEBUG>>:/usr/local/lib/libprotobuf.so>;$<$<CONFIG:DEBUG>:/usr/local/lib/libprotobuf.so>;-lpthread;hdf5-shared;hdf5_cpp-shared;hdf5_hl-shared;hdf5_hl_cpp-shared;/usr/local/lib/liblmdb.so;/usr/local/lib/libleveldb.so;/usr/local/lib/libsqlite3.so;/usr/local/lib/libMesaOpenCL.so.1;opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs;/usr/local/lib/libopenblas.so
LINK_INTERFACE_LIBRARIES:
caffeproto;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_thread.so;-lpthread;/usr/local/lib/libboost_filesystem.so;/usr/local/lib/libboost_chrono.so;/usr/local/lib/libboost_atomic.so;/usr/local/lib/libglog.so;/usr/local/lib/libgflags.so;/usr/local/lib/libprotobuf.so;-lpthread;hdf5-shared;hdf5_cpp-shared;hdf5_hl-shared;hdf5_hl_cpp-shared;/usr/local/lib/liblmdb.so;/usr/local/lib/libleveldb.so;/usr/local/lib/libsqlite3.so;/usr/local/lib/libMesaOpenCL.so.1;opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs;/usr/local/lib/libopenblas.so
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
How I compile/build:
make all -j 7
System configuration
- Operating system: FreeBSD 13.1 AMD 64
- Compiler: Clang 13
- CUDA version (if applicable): None Using AMD GPU (MESA Clover OpenCL)
- CUDNN version (if applicable): None using AMD GPU (MESA Clover OpenCL)
- BLAS: openBLas
- Python version (if using pycaffe): None
- MATLAB version (if using matcaffe): None
Thanks for any advice.
Alright, was able to fix this problem by doing the following below:
Access to edit the file at line 280:
/home/user/caffe/src/caffe/backend/device.cpp
Change and edit:
if (*lock_id < buffer_flags_.size() && lock_id > 0)
To the correct code:
if (*lock_id < buffer_flags_.size() && lock_id != nullptr)
Save and exit.