{"id":3641,"date":"2018-09-14T10:59:39","date_gmt":"2018-09-14T16:59:39","guid":{"rendered":"http:\/\/benincosa.com\/?p=3641"},"modified":"2018-09-17T13:45:41","modified_gmt":"2018-09-17T19:45:41","slug":"hands-on-with-nvidia-p6-and-ucs-b200-m5","status":"publish","type":"post","link":"https:\/\/benincosa.com\/?p=3641","title":{"rendered":"Hands on with NVIDIA P6 and UCS B200 M5"},"content":{"rendered":"<p>Just got access to a new UCS B200 M5 blade!\u00a0 My goal is to create a tensorflow lab on it.\u00a0 Let&#8217;s get cracking!<\/p>\n<p>It was installed with CentOS 7.5<\/p>\n<p>cat \/etc\/redhat-release<\/p>\n<pre class=\"lang:sh decode:true \">cat \/etc\/redhat-release\r\nCentOS Linux release 7.5.1804 (Core)<\/pre>\n<p>Let&#8217;s make sure there is indeed a GPU:<\/p>\n<pre class=\"lang:sh decode:true \">lspci\r\n...\r\nd8:00.0 3D controller: NVIDIA Corporation GP104GL [Tesla P6] (rev a1)<\/pre>\n<p>Ok, now we need to get some drivers. We go to NVIDIA&#8217;s page, fill out the form and get some drivers for RHEL7.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3642\" src=\"http:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-14-at-9.19.15-AM-300x111.png\" alt=\"\" width=\"300\" height=\"111\" srcset=\"https:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-14-at-9.19.15-AM-300x111.png 300w, https:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-14-at-9.19.15-AM.png 724w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>While waiting for downloads, we make it so we can sudo without a password. Run sudo visudo and edit these lines:<\/p>\n<pre class=\"lang:sh decode:true \">## Allows people in group wheel to run all commands\r\n#%wheel ALL=(ALL)       ALL\r\n\r\n## Same thing without a password\r\n%wheel  ALL=(ALL)       NOPASSWD: ALL<\/pre>\n<p>Now let&#8217;s install the VNC server and some other packages we&#8217;ll need.\u00a0 This will give us development tools and a remote desktop<\/p>\n<pre class=\"lang:sh decode:true\">sudo yum install tigervnc-server\r\nsudo yum -y groupinstall \"GNOME Desktop\" \"Development Tools\"\r\nsudo yum -y install kernel-devel\r\nvncserver<\/pre>\n<p>Now let&#8217;s attach to it&#8230; hmm.\u00a0 we can&#8217;t.\u00a0 Is selinux running?<\/p>\n<pre class=\"lang:sh decode:true \">getenforce\r\nEnforcing<\/pre>\n<p>yep.\u00a0 Let&#8217;s turn that off for now.\u00a0 We don&#8217;t need this.\u00a0 Use sudo to modify \/etc\/sysconfig\/selinux<\/p>\n<pre class=\"lang:sh decode:true \"># This file controls the state of SELinux on the system.\r\n# SELINUX= can take one of these three values:\r\n#     enforcing - SELinux security policy is enforced.\r\n#     permissive - SELinux prints warnings instead of enforcing.\r\n#     disabled - No SELinux policy is loaded.\r\nSELINUX=disabled\r\n# SELINUXTYPE= can take one of three two values:\r\n#     targeted - Targeted processes are protected,\r\n#     minimum - Modification of targeted policy. Only selected processes are protected.\r\n#     mls - Multi Level Security protection.\r\nSELINUXTYPE=targeted<\/pre>\n<p>Have to reboot.\u00a0 But first let&#8217;s install the driver:<\/p>\n<p>edit \/etc\/default\/grub to disable the nouvea driver.<\/p>\n<pre class=\"lang:sh decode:true \">GRUB_TIMEOUT=5\r\nGRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' \/etc\/system-release)\"\r\nGRUB_DEFAULT=saved\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"console\"\r\nGRUB_CMDLINE_LINUX=\"crashkernel=auto rd.lvm.lv=centos\/root rd.lvm.lv=centos\/swap rhgb quiet rd.driver.blacklist=nouveau nouveau.modeset=0\"\r\nGRUB_DISABLE_RECOVERY=\"true\"<\/pre>\n<p>load the new grub file<\/p>\n<pre class=\"lang:sh decode:true \">sudo grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/pre>\n<p>Add the nouvea driver to the blacklist by appending to (or creating in my case)\u00a0<code>\/etc\/modprobe.d\/blacklist.conf<\/code><\/p>\n<pre class=\"lang:sh decode:true\">blacklist nouveau<\/pre>\n<p>Back up the old stuff and make the new initrd<\/p>\n<pre class=\"lang:sh decode:true\">sudo mv \/boot\/initramfs-$(uname -r).img \/boot\/initramfs-$(uname -r)-nouveau.img\r\nsudo dracut \/boot\/initramfs-$(uname -r).img $(uname -r)\r\n<\/pre>\n<p>Now we reboot.<\/p>\n<pre class=\"lang:sh decode:true\">chmod 755 NVIDIA-Linux*\r\nsudo .\/NVIDIA-Linux-x86_64-396.44run\r\nsudo shutdown -r now<\/pre>\n<p>I installed the the 32 bit compatible libraries because diskspace is cheap and time is short.<\/p>\n<h2>CUDA Libraries<\/h2>\n<p>We want tensorflow with the CUDA libraries.\u00a0 It makes tensorflow fast!\u00a0 We get it by navigating to their page.\u00a0 I downloaded the runtime one.<\/p>\n<pre class=\"lang:sh decode:true \">wget --no-check-certificate https:\/\/developer.nvidia.com\/compute\/cuda\/9.2\/Prod2\/local_installers\/cuda_9.2.148_396.37_linux<\/pre>\n<pre class=\"lang:sh decode:true\">chmod 755 cuda_9.2.148_396.37_linux\r\nsudo .\/cuda_9.2.148_396.37_linux<\/pre>\n<p>I answer the questions as follows:<\/p>\n<pre class=\"lang:sh decode:true\">Do you accept the previously read EULA?\r\naccept\/decline\/quit: accept\r\n\r\nInstall NVIDIA Accelerated Graphics Driver for Linux-x86_64 396.37?\r\n(y)es\/(n)o\/(q)uit: n\r\n\r\nInstall the CUDA 9.2 Toolkit?\r\n(y)es\/(n)o\/(q)uit: y\r\n\r\nEnter Toolkit Location\r\n [ default is \/usr\/local\/cuda-9.2 ]:\r\n\r\nDo you want to install a symbolic link at \/usr\/local\/cuda?\r\n(y)es\/(n)o\/(q)uit: y\r\n\r\nInstall the CUDA 9.2 Samples?\r\n(y)es\/(n)o\/(q)uit: y\r\n\r\nEnter CUDA Samples Location\r\n [ default is \/home\/tsadministrator ]:<\/pre>\n<p>Since all went well you will see the following output<\/p>\n<pre class=\"lang:sh decode:true \">===========\r\n= Summary =\r\n===========\r\n\r\nDriver:   Not Selected\r\nToolkit:  Installed in \/usr\/local\/cuda-9.2\r\nSamples:  Installed in \/home\/tsadministrator, but missing recommended libraries\r\n\r\nPlease make sure that\r\n -   PATH includes \/usr\/local\/cuda-9.2\/bin\r\n -   LD_LIBRARY_PATH includes \/usr\/local\/cuda-9.2\/lib64, or, add \/usr\/local\/cuda-9.2\/lib64 to \/etc\/ld.so.conf and run ldconfig as root\r\n\r\nTo uninstall the CUDA Toolkit, run the uninstall script in \/usr\/local\/cuda-9.2\/bin\r\n\r\nPlease see CUDA_Installation_Guide_Linux.pdf in \/usr\/local\/cuda-9.2\/doc\/pdf for detailed information on setting up CUDA.\r\n\r\n***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.2 functionality to work.\r\nTo install the driver using this installer, run the following command, replacing &lt;CudaInstaller&gt; with the name of this run file:\r\n    sudo &lt;CudaInstaller&gt;.run -silent -driver\r\n\r\nLogfile is \/tmp\/cuda_install_23222.log<\/pre>\n<p>(or at least something similar)<\/p>\n<p>Now lets get the environment setup.\u00a0 Append to ~\/.bash_profile<\/p>\n<pre class=\"lang:sh decode:true \">export PATH=\/usr\/local\/cuda-9.2\/bin${PATH:+:${PATH}}\r\nexport LD_LIBRARY_PATH=\/usr\/local\/cuda-9.2\/lib64\\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}<\/pre>\n<p>(I&#8217;m using 9.2 as this is the version of cuda I&#8217;ve installed, it may be different when you install so change as updates come available.)<\/p>\n<h2>cuDNN Library<\/h2>\n<p>To download the cuDNN libraries you need to have an NVIDIA developer account.\u00a0 You&#8217;ll have to login to the <a href=\"https:\/\/developer.nvidia.com\/rdp\/cudnn-download\">download site<\/a> and download the Linux version<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3646\" src=\"http:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-17-at-9.52.30-AM-300x147.png\" alt=\"\" width=\"300\" height=\"147\" srcset=\"https:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-17-at-9.52.30-AM-300x147.png 300w, https:\/\/benincosa.com\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-17-at-9.52.30-AM.png 764w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Here we are cuDNN v 7.2.1 with CUDA 9.2 as that is the library we used.<\/p>\n<pre class=\"lang:sh decode:true \">tar -zxvf cudnn-9.2-linux-x64-v7.2.1.38.tgz\r\nsudo cp cuda\/include\/cudnn.h \/usr\/local\/cuda\/include\r\nsudo cp cuda\/lib64\/libcudnn* \/usr\/local\/cuda\/lib64\r\nsudo chmod a+r \/usr\/local\/cuda\/include\/cudnn.h \/usr\/local\/cuda\/lib64\/libcudnn*\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>Installing Tensorflow<\/h2>\n<p>Install pip<\/p>\n<pre class=\"lang:sh decode:true\">yum install epel-release<\/pre>\n<pre class=\"\">yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel python-jinja2<\/pre>\n<p>Now we can install tensorflow:<\/p>\n<pre class=\"lang:sh decode:true\">yum remove python-enum34\r\npip install --upgrade pip\r\npip uninstall dnspython\r\npip instll dnspython==1.15.0\r\npip install tensorflow-gpu ipython<\/pre>\n<p>&nbsp;<\/p>\n<h2>References<\/h2>\n<p><a href=\"https:\/\/www.nvidia.com\/en-us\/data-center\/gpu-accelerated-applications\/tensorflow\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.nvidia.com\/en-us\/data-center\/gpu-accelerated-applications\/tensorflow\/<\/a><\/p>\n<p><a href=\"http:\/\/developer.download.nvidia.com\/compute\/cuda\/6_5\/rel\/docs\/CUDA_Getting_Started_Linux.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/developer.download.nvidia.com\/compute\/cuda\/6_5\/rel\/docs\/CUDA_Getting_Started_Linux.pdf<\/a><\/p>\n<p><a href=\"https:\/\/blog.sicara.com\/tensorflow-gpu-opencv-jupyter-docker-10705b6cd1d\">https:\/\/blog.sicara.com\/tensorflow-gpu-opencv-jupyter-docker-10705b6cd1d<\/a><\/p>\n<p><a href=\"https:\/\/gist.github.com\/lyastro\/26e0cd8245bcf64914857dd5e8445724\">https:\/\/gist.github.com\/lyastro\/26e0cd8245bcf64914857dd5e8445724<\/a><\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"s3UjezqdYT\"><p><a href=\"https:\/\/www.advancedclustering.com\/act_kb\/installing-nvidia-drivers-rhel-centos-7\/\">Installing NVIDIA Drivers on RHEL or CentOS 7<\/a><\/p><\/blockquote>\n<p><iframe title=\"&#8220;Installing NVIDIA Drivers on RHEL or CentOS 7&#8221; &#8212; Advanced Clustering Technologies\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"https:\/\/www.advancedclustering.com\/act_kb\/installing-nvidia-drivers-rhel-centos-7\/embed\/#?secret=s3UjezqdYT\" data-secret=\"s3UjezqdYT\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just got access to a new UCS B200 M5 blade!\u00a0 My goal is to create a tensorflow lab on it.\u00a0 Let&#8217;s get cracking! It was installed with CentOS 7.5 cat \/etc\/redhat-release cat \/etc\/redhat-release CentOS Linux release 7.5.1804 (Core) Let&#8217;s make sure there is indeed a GPU: lspci &#8230; d8:00.0 3D controller: NVIDIA Corporation GP104GL [Tesla&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3641"}],"collection":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3641"}],"version-history":[{"count":5,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3641\/revisions"}],"predecessor-version":[{"id":3653,"href":"https:\/\/benincosa.com\/index.php?rest_route=\/wp\/v2\/posts\/3641\/revisions\/3653"}],"wp:attachment":[{"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benincosa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}