Skip to content

CMake Error at dlib_generated_cuda_dlib.cu.o.cmake:266 #1039

Closed
@Azza71

Description

@Azza71

Hi,
Linux Ubuntu 16.04 + ROS Kinetic
I am attempting to install this facial recognition tool on my Nvidia Jetson TX2. When typing cmake --build dlib, it gives this error:

-- Using CMake version: 3.5.1
-- Compiling dlib version: 19.19.99
-- Found system copy of libpng: /usr/lib/aarch64-linux-gnu/libpng.so;/usr/lib/aarch64-linux-gnu/libz.so
-- Found system copy of libjpeg: /usr/lib/aarch64-linux-gnu/libjpeg.so
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Found LAPACK library
-- Found BLAS library
-- Looking for cuDNN install...
-- Found cuDNN: /usr/lib/aarch64-linux-gnu/libcudnn.so
-- Enabling CUDA support for dlib. DLIB WILL USE CUDA
-- C++11 activated.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nvidia/dlib/build
[ 1%] Building NVCC (Device) object dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o
/home/nvidia/dlib/dlib/cuda/cuda_dlib.cu(1691): error: calling a constexpr host function("log1p") from a device function("cuda_log1pexp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

1 error detected in the compilation of "/tmp/tmpxft_0000413e_00000000-6_cuda_dlib.cpp1.ii".
CMake Error at dlib_generated_cuda_dlib.cu.o.cmake:266 (message):
Error generating file
/home/nvidia/dlib/build/dlib/CMakeFiles/dlib.dir/cuda/./dlib_generated_cuda_dlib.cu.o

dlib/CMakeFiles/dlib.dir/build.make:570: recipe for target 'dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o' failed
make[2]: *** [dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'dlib/CMakeFiles/dlib.dir/all' failed
make[1]: *** [dlib/CMakeFiles/dlib.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Activity

alessiosavi

alessiosavi commented on Feb 2, 2020

@alessiosavi

Create a folder for host the source

mkdir -p /opt/SP/packages/
cd $_

Clone the repository

git clone https://github.com/davisking/dlib.git
cd dlib
git submodule init
git submodule update

Create a folder for build the software (cmake have to be installed)

mkdir build
cd $_

Now run cmake with the following options:

cmake  -D DLIB_USE_CUDA=1 -D USE_AVX_INSTRUCTIONS=1 ../

If everything is fine, you can see a similar output

NOTE: Install cuDNN, openblas and Intel MKL/BLAS/LAPACK if your system is compliant with them.

Link to Intel Performance Library: https://software.seek.intel.com/performance-libraries

Link to cuDNN: https://developer.nvidia.com/cudnn

Now you can compile the source with

cmake --build . --config Release

After these step, the source is compiled.

Now you can install the python API.

cd ../
python setup.py install

NOTE: The compilation this time will use all the available CPU, be sure that you have enough memory for compile.

Once completed, you can query your python packages for be sure that dlib is now installed:

pip freeze | grep dlib

For check if the installation was succesfully:

Open a terminal and run the following

>>> import dlib.cuda as cuda;
>>> print(cuda.get_num_devices());
1
>>> import dlib
>>> dlib.DLIB_USE_BLAS
True
>>> dlib.DLIB_USE_CUDA
True
>>> dlib.DLIB_USE_LAPACK
True

Source: https://stackoverflow.com/a/57592670/9361998

Azza71

Azza71 commented on Feb 4, 2020

@Azza71
Author

@alessiosavi

After compiling with cmake --build . --config Release, I get this error (it's the same as before):

Building NVCC (Device) object dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cusolver_dlibapi.cu.o
nvcc fatal : Could not open output file /opt/SP/packages/dlib/build/dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cusolver_dlibapi.cu.o.NVCC-depend
CMake Error at dlib_generated_cusolver_dlibapi.cu.o.cmake:207 (message):
Error generating
/opt/SP/packages/dlib/build/dlib/CMakeFiles/dlib.dir/cuda/./dlib_generated_cusolver_dlibapi.cu.o

dlib/CMakeFiles/dlib.dir/build.make:70: recipe for target 'dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cusolver_dlibapi.cu.o' failed
make[2]: *** [dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cusolver_dlibapi.cu.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'dlib/CMakeFiles/dlib.dir/all' failed
make[1]: *** [dlib/CMakeFiles/dlib.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

alessiosavi

alessiosavi commented on Feb 4, 2020

@alessiosavi

Have you run it as sudo?

alexander-chan

alexander-chan commented on Feb 21, 2020

@alexander-chan

@alessiosavi I experiencing the same issue as Azza71.
Using Ubuntu 18.04.4 bionic. CUDA 10.2. NVIDIA-SMI 440.33.01

I tried running

cmake --build . --config Release

and got this

[  1%] Building NVCC (Device) object dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o
/home/alex/Desktop/dlib/dlib/cuda/cuda_dlib.cu(1691): error: calling a constexpr __host__ function("log1p") from a __device__ function("cuda_log1pexp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

1 error detected in the compilation of "/tmp/tmpxft_0000635c_00000000-6_cuda_dlib.cpp1.ii".
CMake Error at dlib_generated_cuda_dlib.cu.o.Release.cmake:279 (message):
  Error generating file
  /home/alex/Desktop/dlib/build/dlib/CMakeFiles/dlib.dir/cuda/./dlib_generated_cuda_dlib.cu.o


dlib/CMakeFiles/dlib.dir/build.make:583: recipe for target 'dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o' failed
make[2]: *** [dlib/CMakeFiles/dlib.dir/cuda/dlib_generated_cuda_dlib.cu.o] Error 1
CMakeFiles/Makefile2:93: recipe for target 'dlib/CMakeFiles/dlib.dir/all' failed
make[1]: *** [dlib/CMakeFiles/dlib.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

I tried running sudo cmake --build . --config Release , but it says cmake not found when sudo is used as well. cmake is installed on my computer.

ATeryohin

ATeryohin commented on Feb 25, 2020

@ATeryohin

try this command for cmake: cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1 -DCUDA_NVCC_FLAGS="--expt-relaxed-constexpr"

rupesharora

rupesharora commented on Mar 28, 2020

@rupesharora

Instead of cmake yourself, you can use this command in your root directory of dlib
python3 setup.py install --set DLIB_USE_CUDA=1 --set USE_AVX_INSTRUCTIONS=1 --set CUDA_NVCC_FLAGS="--expt-relaxed-constexpr"

This will automatically create the build folder.

Note: Whatever arguments you want to pass in cmake, you can directly pass in setup.py file as well
For example cmake .. -DDLIB_USE_CUDA=1 similar way in setup.py will be python3 setup.py install --set DLIB_USE_CUDA=1

Azza71

Azza71 commented on Apr 17, 2020

@Azza71
Author

Thank you all for the help. The issue was fixed when I looked at this, the issue exists for both jetson nano and jetson TX2: https://medium.com/@ageitgey/build-a-hardware-based-face-recognition-system-for-150-with-the-nvidia-jetson-nano-and-python-a25cb8c891fd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexander-chan@rupesharora@alessiosavi@ATeryohin@Azza71

        Issue actions

          CMake Error at dlib_generated_cuda_dlib.cu.o.cmake:266 · Issue #1039 · ageitgey/face_recognition