{"id":549,"date":"2018-05-12T21:56:13","date_gmt":"2018-05-12T12:56:13","guid":{"rendered":"https:\/\/www.alprovs.com\/wordpress\/?p=549"},"modified":"2021-08-19T08:57:54","modified_gmt":"2021-08-18T23:57:54","slug":"centos7ver7-5%e3%81%abtensorflowver1-8-0%e5%b0%8e%e5%85%a5","status":"publish","type":"post","link":"https:\/\/www.alprovs.com\/wordpress\/?p=549","title":{"rendered":"CentOS7(Ver:7.5)\u306bTensorFlow(Ver:1.8.0)\u5c0e\u5165"},"content":{"rendered":"<p>\u6a5f\u68b0\u5b66\u7fd2\u3092\u8a66\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044TensorFlow\u3092\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u305f\u304c\u5c11\u3057\u30cf\u30de\u3063\u305f\u305f\u3081\u3001\u8a18\u9332\u3057\u3066\u304a\u304f<br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f3<br \/>\nCentOS\uff1a7.5<br \/>\nTensorFlow\uff1a1.8.0<br \/>\nCUDA\uff1a 9.1<br \/>\ncuDNN\uff1a7.1.3<\/p>\n<p>\u6700\u521d\u6b21\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u3066\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u305f\u304c\u3001CUDA\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c9.0\u3058\u3083\u306a\u3044\u3068\u52d5\u4f5c\u3057\u306a\u3044\u305f\u3081\u3001\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3063\u305f\u3002<\/p>\n<p><a href=\"https:\/\/qiita.com\/harrynezumi\/items\/8e373a0563b92f3fc033\" target=\"_blank\" rel=\"noopener noreferrer\">CentOS7\u306bTensorFlow\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<p>\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u306b\u53c2\u8003\u306b\u3057\u305f\u306e\u306f\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.tensorflow.org\/install\/install_sources\" target=\"_blank\" rel=\"noopener noreferrer\">Installing TensorFlow from Sources<\/a><\/p>\n<p>\u5b9f\u969b\u306b\u5c0e\u5165\u3057\u305f\u969b\u306e\u624b\u9806<\/p>\n<ol>\n<li>Git\u304b\u3089tensorflow\u3092\u5f97\u308b<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ git clone https:\/\/github.com\/tensorflow\/tensorflow<\/code>\n<\/li>\n<li>Bazel\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<br \/>\n\u901a\u5e38\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u3067\u306fBazel\u306f\u5c0e\u5165\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3046<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ wget https:\/\/copr.fedorainfracloud.org\/coprs\/vbatts\/bazel\/repo\/epel-7\/vbatts-bazel-epel-7.repo\r\n$ sudo mv vbatts-bazel-epel-7.repo \/etc\/yum.repos.d\/\r\n$ sudo yum install bazel<\/pre>\n<\/li>\n<li>\u624b\u98061\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3001\u8a2d\u5b9a\u3059\u308b\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ cd tensorflow\r\n$ .\/configure\r\nWARNING: Running Bazel server needs to be killed, because the startup options are different.\r\nYou have bazel 0.13.0- (@non-git) installed.\r\nPlease specify the location of python. [Default is \/home\/{User}\/.pyenv\/versions\/anaconda3-5.1.0\/envs\/tensorflow\/bin\/python]: \r\n\r\n\r\nFound possible Python library paths:\r\n  \/home\/yuya\/.pyenv\/versions\/anaconda3-5.1.0\/envs\/tensorflow\/lib\/python3.6\/site-packages\r\nPlease input the desired Python library path to use.  Default is [\/home\/{User}\/.pyenv\/versions\/anaconda3-5.1.0\/envs\/tensorflow\/lib\/python3.6\/site-packages]\r\n\r\nDo you wish to build TensorFlow with jemalloc as malloc support? [Y\/n]: \r\njemalloc as malloc support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with Google Cloud Platform support? [Y\/n]: n\r\nNo Google Cloud Platform support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with Hadoop File System support? [Y\/n]: n\r\nNo Hadoop File System support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with Amazon S3 File System support? [Y\/n]: n\r\nNo Amazon S3 File System support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with Apache Kafka Platform support? [Y\/n]: n\r\nNo Apache Kafka Platform support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with XLA JIT support? [y\/N]: \r\nNo XLA JIT support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with GDR support? [y\/N]: \r\nNo GDR support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with VERBS support? [y\/N]: \r\nNo VERBS support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with OpenCL SYCL support? [y\/N]: \r\nNo OpenCL SYCL support will be enabled for TensorFlow.\r\n\r\nDo you wish to build TensorFlow with CUDA support? [y\/N]: y\r\nCUDA support will be enabled for TensorFlow.\r\n\r\nPlease specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 9.0]: 9.1\r\n\r\n\r\nPlease specify the location where CUDA 9.1 toolkit is installed. Refer to README.md for more details. [Default is \/usr\/local\/cuda]: \r\n\r\n\r\nPlease specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7.0]: 7.1.3\r\n\r\n\r\nPlease specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is \/usr\/local\/cuda]:\r\n\r\n\r\nDo you wish to build TensorFlow with TensorRT support? [y\/N]: \r\nNo TensorRT support will be enabled for TensorFlow.\r\n\r\nPlease specify the NCCL version you want to use. [Leave empty to default to NCCL 1.3]: \r\n\r\n\r\nPlease specify a list of comma-separated Cuda compute capabilities you want to build with.\r\nYou can find the compute capability of your device at: https:\/\/developer.nvidia.com\/cuda-gpus.\r\nPlease note that each additional compute capability significantly increases your build time and binary size. [Default is: 6.1]\r\n\r\n\r\nDo you want to use clang as CUDA compiler? [y\/N]: \r\nnvcc will be used as CUDA compiler.\r\n\r\nPlease specify which gcc should be used by nvcc as the host compiler. [Default is \/usr\/bin\/gcc]: \r\n\r\n\r\nDo you wish to build TensorFlow with MPI support? [y\/N]: \r\nNo MPI support will be enabled for TensorFlow.\r\n\r\nPlease specify optimization flags to use during compilation when bazel option \"--config=opt\" is specified [Default is -march=native]: \r\n\r\n\r\nWould you like to interactively configure .\/WORKSPACE for Android builds? [y\/N]: \r\nNot configuring the WORKSPACE for Android builds.\r\n\r\nPreconfigured Bazel build configs. You can use any of the below by adding \"--config=&lt;&gt;\" to your build command. See tools\/bazel.rc for more details.\r\n        --config=mkl            # Build with MKL support.\r\n        --config=monolithic     # Config for mostly static monolithic build.\r\nConfiguration finished<\/pre>\n<\/li>\n<li>\u30d3\u30eb\u30c9\u5b9f\u65bd<br \/>\n\u6b21\u306e\u3088\u3046\u306b\u30ea\u30f3\u30af\u3092\u8cbc\u3089\u306a\u3044\u3068\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u306e\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ sudo ln -s \/usr\/local\/cuda\/include\/crt\/math_functions.hpp \/usr\/local\/cuda\/include\/math_functions.hpp<\/code><br \/>\n\u30d3\u30eb\u30c9\u958b\u59cb<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ bazel build --config=mkl --config=monolithic --config=cuda \/\/tensorflow\/tools\/pip_package:build_pip_package\r\n\r\n(...\u7701\u7565...\u00a0)\r\n\r\n.\/tensorflow\/core\/kernels\/cwise_ops.h(199): warning: __device__ annotation on a defaulted function(\"scalar_right\") is ignored\r\n\r\nTarget \/\/tensorflow\/tools\/pip_package:build_pip_package up-to-date:\r\nbazel-bin\/tensorflow\/tools\/pip_package\/build_pip_package\r\nINFO: Elapsed time: 2151.254s, Critical Path: 168.00s\r\nINFO: 5277 processes, local.\r\nINFO: Build completed successfully, 5387 total actions<\/pre>\n<\/li>\n<li>\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u4f5c\u6210<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ bazel-bin\/tensorflow\/tools\/pip_package\/build_pip_package \/tmp\/tensorflow_pkg<\/code>\n<\/li>\n<li>\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ pip install \/tmp\/tensorflow_pkg\/tensorflow-1.8.0-cp36-cp36m-linux_x86_64.whl<\/code>\n<\/li>\n<li>\u6b63\u5e38\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305f\u304b\u78ba\u8a8d\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ python\r\nPython 3.6.4 |Anaconda, Inc.| (default, Mar 13 2018, 01:15:57) \r\n[GCC 7.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n&gt;&gt;&gt; import tensorflow as tf\r\n&gt;&gt;&gt; hello = tf.constant('Hello, TensorFlow!')\r\n2018-05-12 21:22:39.196485: E tensorflow\/core\/framework\/op_kernel.cc:1242] OpKernel ('op: \"_MklConv2DWithBiasBackpropBias\" device_type: \"CPU\" constraint { name: \"T\" allowed_values { list { type: DT_FLOAT } } } label: \"MklOp\"') for unknown op: _MklConv2DWithBiasBackpropBias\r\n&gt;&gt;&gt; sess = tf.Session()\r\n2018-05-12 21:22:39.199427: I tensorflow\/core\/platform\/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA\r\n2018-05-12 21:22:39.371104: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:1349] Found device 0 with properties: \r\nname: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.911\r\npciBusID: 0000:02:00.0\r\ntotalMemory: 7.92GiB freeMemory: 6.96GiB\r\n2018-05-12 21:22:39.371163: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:1428] Adding visible gpu devices: 0\r\n2018-05-12 21:22:39.614577: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:916] Device interconnect StreamExecutor with strength 1 edge matrix:\r\n2018-05-12 21:22:39.614618: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:922]      0 \r\n2018-05-12 21:22:39.614628: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:935] 0:   N \r\n2018-05-12 21:22:39.614806: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:1046] Created TensorFlow device (\/job:localhost\/replica:0\/task:0\/device:GPU:0 with 6721 MB memory) -&gt; physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:02:00.0, compute capability: 6.1)\r\n2018-05-12 21:22:39.690978: I tensorflow\/core\/common_runtime\/process_util.cc:64] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.\r\n&gt;&gt;&gt; print(sess.run(hello))\r\nb'Hello, TensorFlow!'<\/pre>\n<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6a5f\u68b0\u5b66\u7fd2\u3092\u8a66\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044TensorFlow\u3092\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u305f\u304c\u5c11\u3057\u30cf\u30de\u3063\u305f\u305f\u3081\u3001\u8a18\u9332\u3057\u3066\u304a\u304f \u30d0\u30fc\u30b8\u30e7\u30f3 CentOS\uff1a7.5 TensorFlow\uff1a1.8.0 CUDA\uff1a 9.1 cuDNN\uff1a7.1.3 \u6700\u521d\u6b21\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10],"tags":[],"class_list":["post-549","post","type-post","status-publish","format-standard","hentry","category-linux","category-10"],"_links":{"self":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=549"}],"version-history":[{"count":4,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":807,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions\/807"}],"wp:attachment":[{"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alprovs.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}