{"id":404,"date":"2020-04-16T11:48:47","date_gmt":"2020-04-16T11:48:47","guid":{"rendered":"https:\/\/carson.fenimorefamily.com\/?p=404"},"modified":"2020-04-16T11:49:13","modified_gmt":"2020-04-16T11:49:13","slug":"how-i-set-up-dlib","status":"publish","type":"post","link":"https:\/\/carson.fenimorefamily.com\/?p=404","title":{"rendered":"How I Set Up DLIB"},"content":{"rendered":"\n<p>It is fairly easy to check out and build dlib. Getting it to work in a performance-optimized manner &#8211; python bindings included -takes a little more work.<\/p>\n\n\n\n<p>Per the dlib github one can build the bindings by simply issuing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python setup.py install<\/code><\/pre>\n\n\n\n<p>First problem I found is that the setup process decided to latch on to an old version of CUDA.  That was my bad &#8211; fixed by moving my PATH variable to point to the new cuda&#8217;s bin dir.<\/p>\n\n\n\n<p>Second problem is that during compilation I saw the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Invoking CMake build: 'cmake --build . --config Release -- -j12'\n&#91;  1%] Building NVCC (Device) object dlib_build\/CMakeFiles\/dlib.dir\/cuda\/dlib_generated_cusolver_dlibapi.cu.o\n&#91;  2%] Building NVCC (Device) object dlib_build\/CMakeFiles\/dlib.dir\/cuda\/dlib_generated_cuda_dlib.cu.o\n\/home\/carson\/code\/2020\/facenet\/dlib\/dlib\/cuda\/cuda_dlib.cu(1762): 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.\n<\/code><\/pre>\n\n\n\n<p>As it suggests this is resolved by passing in a flag to the compiler. To do this modify the setup.py line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python setup.py install --set USE_AVX_INSTRUCTIONS=1 --set DLIB_USE_CUDA=1 --set CUDA_NVCC_FLAGS=\"--expt-relaxed-constexpr\"\n<\/code><\/pre>\n\n\n\n<p>Everything went just peachy from there except when I attempted to use dlib from within python I got an error (something like):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dlib 19.19.99 is missing cblas_dtrsm symbol<\/code><\/pre>\n\n\n\n<p>After which i tried importing face_recognition and got a segfault.<\/p>\n\n\n\n<p>I fixed this by install openblas-devel, then re-ran the setup.py script as above.  Magically this fixed everything.<\/p>\n\n\n\n<p>Again, not bad &#8211; dlib seems cool &#8211; just normal troubleshooting stuff.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is fairly easy to check out and build dlib. Getting it to work in a performance-optimized manner &#8211; python bindings included -takes a little more work. Per the dlib github one can build the bindings by simply issuing: First problem I found is that the setup process decided to latch on to an old &hellip; <a href=\"https:\/\/carson.fenimorefamily.com\/?p=404\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How I Set Up DLIB<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-deep-learning"],"_links":{"self":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404"}],"version-history":[{"count":1,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/404\/revisions"}],"predecessor-version":[{"id":405,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/404\/revisions\/405"}],"wp:attachment":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}