用cuda编译dlib [英] compile dlib with cuda
问题描述
我正在尝试使用cuda编译dlib。我从这个GitHub链接
创建一个用于托管源的文件夹
mkdir -p / opt / SP / packages /
cd $ _
克隆存储库
git克隆https://github.com/davisking/dlib.git
cd dlib
git子模块初始化
git子模块更新
创建一个文件夹来构建软件(必须安装cmake)
mkdir build
cd $ _
现在使用以下选项运行cmake:
cmake -D DLIB_USE_CUDA = 1 -D USE_AVX_INSTRUCTIONS = 1 ../
注意:安装 cuDNN ,openblas和 Intel MKL / BLAS / LAPACK
链接到英特尔性能库: https://software.seek.intel.com/performance-libraries
与cuDNN的链接: https://developer.nvidia.com/cudnn
现在您可以使用
cmake --build编译源代码。 --config释放
在这些步骤之后,将编译源。
现在您可以安装python API。
cd ../
python设置。 py install
注意:这次编译将使用所有可用的CPU,请确保您有足够的CPU
完成后,您可以查询python软件包以确保已安装dlib:
检查安装是否成功:
>>>将dlib.cuda导入为cuda;
>>打印(cuda.get_num_devices());
1
>> import dlib
>> dlib.DLIB_USE_BLAS
真
>>> dlib.DLIB_USE_CUDA
真
>>> dlib.DLIB_USE_LAPACK
真
I am trying to compile dlib with cuda. I clone the repository from this GitHub link https://github.com/davisking/dlib and then tried to run
python setup.py install --yes USE_AVX_INSTRUCTIONS
But I receive an error. Can anyone help me to solve it?
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:
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
这篇关于用cuda编译dlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!