{"id":262,"date":"2023-08-03T10:55:43","date_gmt":"2023-08-03T02:55:43","guid":{"rendered":"https:\/\/boostup.cf\/?p=262"},"modified":"2024-04-01T15:52:29","modified_gmt":"2024-04-01T07:52:29","slug":"linux%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/189505.xyz\/?p=262","title":{"rendered":"Linux\u5de5\u5177"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" area-label=\"ez-toc-toggle-icon-1\"><label for=\"item-69e0623eaf621\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-69e0623eaf621\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/189505.xyz\/?p=262\/#%E5%A4%84%E7%90%86%E6%97%A5%E5%BF%97%EF%BC%8C%E6%B1%82%E5%92%8C%EF%BC%8C%E4%BB%BB%E6%84%8F%E7%B2%BE%E5%BA%A6\" title=\"\n\u5904\u7406\u65e5\u5fd7\uff0c\u6c42\u548c\uff0c\u4efb\u610f\u7cbe\u5ea6 \n\">\n\u5904\u7406\u65e5\u5fd7\uff0c\u6c42\u548c\uff0c\u4efb\u610f\u7cbe\u5ea6 \n<\/a><ul class='ez-toc-list-level-2'><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/189505.xyz\/?p=262\/#%E4%BB%BB%E6%84%8F%E7%B2%BE%E5%BA%A6%E5%81%9A%E6%B3%95\" title=\"\n\u4efb\u610f\u7cbe\u5ea6\u505a\u6cd5 \n\">\n\u4efb\u610f\u7cbe\u5ea6\u505a\u6cd5 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/189505.xyz\/?p=262\/#%E5%A6%82%E6%9E%9C%E6%B2%A1%E6%9C%89%E8%B6%85%E8%BF%87awk%E8%A1%A8%E7%A4%BA%E8%8C%83%E5%9B%B4\" title=\"\n\u5982\u679c\u6ca1\u6709\u8d85\u8fc7awk\u8868\u793a\u8303\u56f4 \n\">\n\u5982\u679c\u6ca1\u6709\u8d85\u8fc7awk\u8868\u793a\u8303\u56f4 \n<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/189505.xyz\/?p=262\/#nvidia-smi%E7%BB%93%E6%9E%9C%E6%B1%87%E6%80%BB%E6%B1%82%E5%92%8C\" title=\"\nnvidia-smi\u7ed3\u679c\u6c47\u603b\u6c42\u548c \n\">\nnvidia-smi\u7ed3\u679c\u6c47\u603b\u6c42\u548c \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/189505.xyz\/?p=262\/#%E6%9B%B4%E5%A5%BD%E7%9A%84smi\" title=\"\n\u66f4\u597d\u7684smi \n\">\n\u66f4\u597d\u7684smi \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/189505.xyz\/?p=262\/#nvidia_gpu_%E9%94%81%E9%A2%91\" title=\"\nnvidia gpu \u9501\u9891 \n\">\nnvidia gpu \u9501\u9891 \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/189505.xyz\/?p=262\/#nvidia_gpu_%E7%9B%91%E6%8E%A7%E9%A2%91%E7%8E%87\" title=\"\nnvidia gpu \u76d1\u63a7\u9891\u7387 \n\">\nnvidia gpu \u76d1\u63a7\u9891\u7387 \n<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E5%A4%84%E7%90%86%E6%97%A5%E5%BF%97%EF%BC%8C%E6%B1%82%E5%92%8C%EF%BC%8C%E4%BB%BB%E6%84%8F%E7%B2%BE%E5%BA%A6\"><\/span>\n\u5904\u7406\u65e5\u5fd7\uff0c\u6c42\u548c\uff0c\u4efb\u610f\u7cbe\u5ea6<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre>\n\u65e5\u5fd7\u6587\u4ef6\u6837\u4f8b\uff1a\nI0802 21:03:05.976434 15241 embedding_merger.cc:804, FillTensorWithRawSignEmbeddingsExp] open_dirty_mask is:0, memset_dur(ms):0.000137, func_dur(ms):0.006606, memset\/func(ration):0.0207387, pre_flat_tensor.num_bytes:512, in MiB:0.000488281\nI0802 21:03:05.976545 15269 embedding_merger.cc:804, FillTensorWithRawSignEmbeddingsExp] open_dirty_mask is:0, memset_dur(ms):8.2e-05, func_dur(ms):0.00523, memset\/func(ration):0.0156788, pre_flat_tensor.num_bytes:512, in MiB:0.000488281\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BB%BB%E6%84%8F%E7%B2%BE%E5%BA%A6%E5%81%9A%E6%B3%95\"><\/span>\n\u4efb\u610f\u7cbe\u5ea6\u505a\u6cd5<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre>\n\u7531\u4e8e\u5b58\u57288.2e-05\u8fd9\u6837\u7684\u79d1\u5b66\u8ba1\u7b97\uff0c\u9700\u8981\u7528awk -F'e' 'BEGIN{OFMT=\"%10.10f\"} {print $1*(10^$2)}'\u628a\u79d1\u5b66\u8ba1\u7b97\u8f6c\u6362\u6210\u666e\u901a\u7684\u6d6e\u70b9\u6570\ncat log\/rat.txt  | cut -d, -f3  | cut -d':' -f2  | awk -F'e' 'BEGIN{OFMT=\"%10.10f\"} {print $1*(10^$2)}' | paste -sd+ | bc -l\ncut -d\u7684\u65b9\u6cd5\u6765\u81ea\uff1a\nhttps:\/\/stackoverflow.com\/questions\/21277631\/awk-sum-of-large-integers\nscientific number to float number:\nhttps:\/\/stackoverflow.com\/questions\/13826237\/convert-scientific-notation-to-decimal-in-bash\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"%E5%A6%82%E6%9E%9C%E6%B2%A1%E6%9C%89%E8%B6%85%E8%BF%87awk%E8%A1%A8%E7%A4%BA%E8%8C%83%E5%9B%B4\"><\/span>\n\u5982\u679c\u6ca1\u6709\u8d85\u8fc7awk\u8868\u793a\u8303\u56f4<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre>\ncat log\/rat.txt  | awk -F, '{print $3 $4}' | sed 's\/:\/ \/g' | awk '{sum1+=$2; sum2+=$4} END {print \"tot1:\", sum1, \"tot2:\", sum2}'\n<\/pre>\n<h1><span class=\"ez-toc-section\" id=\"nvidia-smi%E7%BB%93%E6%9E%9C%E6%B1%87%E6%80%BB%E6%B1%82%E5%92%8C\"><\/span>\nnvidia-smi\u7ed3\u679c\u6c47\u603b\u6c42\u548c<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>while true\ndo\n  line=&quot;&quot;\n  readarray -t  arr2 &lt; &lt;(nvidia-smi | grep %)\n  for oneline in &quot;${arr2[@]}&quot;; do\n    u1=`echo  &quot;${oneline}&quot; | awk -F&#039;|&#039; &#039;{print $4}&#039; | awk -F&#039;%&#039; &#039;{print $1}&#039; | sed &#039;s, ,,g&#039;`\n    m1=`echo  &quot;${oneline}&quot; | cut -d&#039;|&#039; -f3 | cut -d&#039;\/&#039; -f1 | sed &#039;s, ,,g&#039;`\n    line=&quot;${line},${u1},${m1}&quot;\n  done\n  echo $line &gt;&gt;\/tmp\/gpu-util-mem.txt\n  sleep 0.1\ndone<\/code><\/pre>\n<p>\u6837\u4f8b\u8f93\u51fa<\/p>\n<pre><code>,53,21491MiB,46,21487MiB\n,63,21491MiB,52,21487MiB\n,59,21491MiB,53,21487MiB\n,52,21491MiB,56,21487MiB\n,54,21491MiB,42,21487MiB\n,60,21491MiB,63,21487MiB\n,41,21491MiB,39,21487MiB\n,53,21491MiB,62,21487MiB\n,55,21491MiB,50,21487MiB\n,64,21491MiB,55,21487MiB<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"%E6%9B%B4%E5%A5%BD%E7%9A%84smi\"><\/span>\n\u66f4\u597d\u7684smi<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>while true\ndo\n  nvidia-smi --query-gpu index,utilization.gpu,memory.used --format csv &gt;&gt;\/tmp\/gpu-util-mem.txt\n  sleep 1\ndone<\/code><\/pre>\n<p>\u8f93\u51fa<\/p>\n<pre><code>index, utilization.gpu [%], memory.used [MiB]\n0, 36 %, 78947 MiB\n1, 0 %, 78001 MiB\nindex, utilization.gpu [%], memory.used [MiB]\n0, 40 %, 78947 MiB\n1, 30 %, 78001 MiB<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"nvidia_gpu_%E9%94%81%E9%A2%91\"><\/span>\nnvidia gpu \u9501\u9891<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\/\/ persistent mode on; lock memory clock; lock gpu clock; power limit<br \/>\nnvidia-smi -pm 1 ; nvidia-smi -lmc 6251; nvidia-smi -lgc 1500; nvidia-smi -pl 150<\/p>\n<h1><span class=\"ez-toc-section\" id=\"nvidia_gpu_%E7%9B%91%E6%8E%A7%E9%A2%91%E7%8E%87\"><\/span>\nnvidia gpu \u76d1\u63a7\u9891\u7387<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>watch -n 5 &quot;nvidia-smi --query-gpu=power.max_limit,clocks.current.sm,power.draw,pcie.link.gen.current,pcie.link.gen.max,pcie.link.width.current,pcie.link.width.max,clocks_throttle_reasons.active,power.limit,power.min_limit --format=csv&quot;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5904\u7406\u65e5\u5fd7\uff0c\u6c42\u548c\uff0c\u4efb\u610f\u7cbe\u5ea6 \u65e5\u5fd7\u6587\u4ef6\u6837\u4f8b\uff1a I0802 21:03:05.976434 15241 embedd &#8230; <a title=\"Linux\u5de5\u5177\" class=\"read-more\" href=\"https:\/\/189505.xyz\/?p=262\" aria-label=\"More on Linux\u5de5\u5177\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/262"}],"collection":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=262"}],"version-history":[{"count":10,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/262\/revisions"}],"predecessor-version":[{"id":412,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/262\/revisions\/412"}],"wp:attachment":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}