{"id":462,"date":"2020-07-25T20:19:21","date_gmt":"2020-07-25T10:19:21","guid":{"rendered":"https:\/\/www.samontab.com\/web\/?p=462"},"modified":"2020-07-25T20:19:21","modified_gmt":"2020-07-25T10:19:21","slug":"minimal-install-of-openvino-2020-4-in-kubuntu-20-04-lts-for-c-inference-on-cpu","status":"publish","type":"post","link":"https:\/\/www.samontab.com\/web\/2020\/07\/minimal-install-of-openvino-2020-4-in-kubuntu-20-04-lts-for-c-inference-on-cpu\/","title":{"rendered":"Minimal install of OpenVINO 2020.4 in Kubuntu 20.04 LTS for C++ inference on CPU"},"content":{"rendered":"\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The official installer of <a href=\"https:\/\/software.intel.com\/content\/www\/us\/en\/develop\/articles\/openvino-relnotes.html\">OpenVINO 2020.4 requires Ubuntu 18.04 LTS<\/a>, but since Kubuntu 20.04 LTS is already out I wanted to use that instead. Here&#8217;s what you need to do to get a minimal install for C++ inference on the CPU.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First make sure you have everything up to date:<\/p>\n<\/div><\/div>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo apt-get update\nsudo apt-get upgrade\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll need git installed to get the source code. Also, python3 comes already pre-installed with 20.04 but not python, so we&#8217;re going to assign any python calls to python3.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo apt-get install git python-is-python3\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Now get the OpenVINO source code into your home directory (or wherever you prefer). Don&#8217;t download the zip file directly from github as there are some 3rd party dependencies that need to get downloaded as well. That&#8217;s the <strong>&#8211;recursive<\/strong> part of the following command. The specific <strong>&#8211;branch<\/strong> we&#8217;re using is the same as the official installer uses, <strong>releases\/2020\/4<\/strong>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncd ~\ngit clone --recursive --branch releases\/2020\/4 https:\/\/github.com\/openvinotoolkit\/openvino.git\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Install the dependencies by running the included script:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n~\/openvino\/install_dependencies.sh\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Before continuing you need to change some of the files you just downloaded. I&#8217;m using <em>xdg-open<\/em> which will invoke your preferred application but you can use whatever you prefer instead like vi, nano, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First open up the <strong>gna_helper.cpp<\/strong> file. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxdg-open ~\/openvino\/inference-engine\/src\/gna_plugin\/gna_helper.cpp\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Update the code for these functions as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvoid profilerRtcStart(intel_gna_profiler_rtc *p) {\n    if (nullptr == p) return;\n    clearTimeB(p-&gt;passed);\n    clearTimeB(p-&gt;stop);\n    \/\/ftime(&amp;amp;p-&gt;start);\n    timespec start;\n    clock_gettime(CLOCK_REALTIME, &amp;amp;start);\n    p-&gt;start.time = start.tv_sec;\n    p-&gt;start.millitm = start.tv_nsec\/1000000;\n}\n\nvoid profilerRtcStop(intel_gna_profiler_rtc *p) {\n    if (nullptr == p) return;\n    \/\/ftime(&amp;amp;p-&gt;stop);\n    timespec stop;\n    clock_gettime(CLOCK_REALTIME, &amp;amp;stop);\n    p-&gt;stop.time = stop.tv_sec;\n    p-&gt;stop.millitm = stop.tv_nsec\/1000000;\n}\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Now open the <strong>execution_engine.cpp<\/strong> file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxdg-open ~\/openvino\/inference-engine\/thirdparty\/ade\/sources\/ade\/source\/execution_engine.cpp\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In line 141, simply update this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/return std::move(ret);\nreturn ret;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Now you&#8217;re ready to build it.  And this will take a long time.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>ENABLE_MKL_DNN=ON<\/strong> means we want the <strong>CPU plugin<\/strong><\/li><li><strong>ENABLE_CLDNN=OFF<\/strong> means we don&#8217;t want the <strong>GPU plugin<\/strong><\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncd ~\/openvino\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release -DENABLE_MKL_DNN=ON -DENABLE_CLDNN=OFF -DENABLE_OPENCV=OFF -DENABLE_PYTHON=OFF ..\nmake -j4\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You should now be able to run the compiled applications, for example to get information about your device you can run the following:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n~\/openvino\/bin\/intel64\/Release\/hello_query_device\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">It should output detailed information about your device. Check out the <a href=\"https:\/\/github.com\/openvinotoolkit\/open_model_zoo\">Intel Model Zoo<\/a> for models and samples that you can use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The official installer of OpenVINO 2020.4 requires Ubuntu 18.04 LTS, but since Kubuntu 20.04 LTS is already out I wanted to use that instead. Here&#8217;s what you need to do to get a minimal install for C++ inference on the CPU. First make sure you have everything up to date: You&#8217;ll need git installed to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,24,4],"tags":[28,27,26,25],"class_list":["post-462","post","type-post","status-publish","format-standard","hentry","category-open-source","category-openvino","category-programming","tag-cpu","tag-inference","tag-kubuntu","tag-openvino"],"_links":{"self":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/comments?post=462"}],"version-history":[{"count":0,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/posts\/462\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/media?parent=462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/categories?post=462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samontab.com\/web\/wp-json\/wp\/v2\/tags?post=462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}