1"use strict";(globalThis.webpackChunk_project_hami_website||=[]).push([[3224],{17007(e,n,i){i.r(n),i.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>u,frontMatter:()=>t,metadata:()=>o,toc:()=>a});const o=JSON.parse('{"id":"userguide/hygon-device/enable-hygon-dcu-sharing","title":"Enable Hygon DCU sharing","description":"Introduction","source":"@site/versioned_docs/version-v2.7.0/userguide/hygon-device/enable-hygon-dcu-sharing.md","sourceDirName":"userguide/hygon-device","slug":"/userguide/hygon-device/enable-hygon-dcu-sharing","permalink":"/docs/v2.7.0/userguide/hygon-device/enable-hygon-dcu-sharing","draft":false,"unlisted":false,"editUrl":"https://github.com/Project-HAMi/website/edit/master/versioned_docs/version-v2.7.0/userguide/hygon-device/enable-hygon-dcu-sharing.md","tags":[],"version":"v2.7.0","lastUpdatedAt":1779280232000,"frontMatter":{"title":"Enable Hygon DCU sharing"},"sidebar":"docs","previous":{"title":"Allocate exclusive device","permalink":"/docs/v2.7.0/userguide/cambricon-device/examples/allocate-exclusive"},"next":{"title":"Allocate device memory","permalink":"/docs/v2.7.0/userguide/hygon-device/specify-device-memory-usage"}}');var s=i(74848),c=i(28453);const t={title:"Enable Hygon DCU sharing"},r=void 0,d={},a=[{value:"Introduction",id:"introduction",level:2},{value:"Prerequisites",id:"prerequisites",level:2},{value:"Enabling DCU-sharing Support",id:"enabling-dcu-sharing-support",level:2},{value:"Running DCU jobs",id:"running-dcu-jobs",level:2},{value:"Enable vDCU inside container",id:"enable-vdcu-inside-container",level:2},{value:"Notes",id:"notes",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,c.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"introduction",children:"Introduction"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"HAMi now supports hygon.com/dcu by implementing most device-sharing features as NVIDIA GPUs"}),", including:"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"DCU sharing"}),": Each task can allocate a portion of DCU instead of a whole DCU card, thus DCU can be shared among multiple tasks."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Device Memory Control"}),": DCUs can be allocated with certain device memory size on certain type(i.e Z100) and have made it that it does not exceed the boundary."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"Device compute core limitation"}),": DCUs can be allocated with certain percentage of device core(i.e hygon.com/dcucores:60 indicate this container uses 60% compute cores of this device)"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"DCU Type Specification"}),': You can specify which type of DCU to use or to avoid for a certain task, by setting "hygon.com/use-dcutype" or "hygon.com/nouse-dcutype" annotations.']}),"\n",(0,s.jsx)(n.h2,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"dtk driver >= 24.04"}),"\n",(0,s.jsx)(n.li,{children:"hy-smi v1.6.0"}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"enabling-dcu-sharing-support",children:"Enabling DCU-sharing Support"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Deploy the dcu-vgpu-device-plugin ",(0,s.jsx)(n.a,{href:"https://github.com/Project-HAMi/dcu-vgpu-device-plugin",children:"here"})]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"running-dcu-jobs",children:"Running DCU jobs"}),"\n",(0,s.jsxs)(n.p,{children:["Hygon DCUs can now be requested by a container\nusing the ",(0,s.jsx)(n.code,{children:"hygon.com/dcunum"})," , ",(0,s.jsx)(n.code,{children:"hygon.com/dcumem"})," and ",(0,s.jsx)(n.code,{children:"hygon.com/dcucores"})," resource type:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",children:'apiVersion: v1\nkind: Pod\nmetadata:\n name: alexnet-tf-gpu-pod-mem\n labels:\n purpose: demo-tf-amdgpu\nspec:\n containers:\n - name: alexnet-tf-gpu-container\n image: pytorch:resnet50\n workingDir: /root\n command: ["sleep","infinity"]\n resources:\n limits:\n hygon.com/dcunum: 1 # requesting a GPU\n hygon.com/dcumem: 2000 # each dcu require 2000 MiB device memory\n hygon.com/dcucores: 60 # each dcu use 60% of total compute cores\n\n'})}),"\n",(0,s.jsx)(n.h2,{id:"enable-vdcu-inside-container",children:"Enable vDCU inside container"}),"\n",(0,s.jsx)(n.p,{children:"You need to enable vDCU inside container in order to use it."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"source /opt/hygondriver/env.sh\n"})}),"\n",(0,s.jsx)(n.p,{children:"check if you have successfully enabled vDCU by using following command"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"hy-virtual -sh
1ow-device-info\n"})}),"\n",(0,s.jsx)(n.p,{children:"If you have an output like this, then you have successfully enabled vDCU inside container."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-console",children:"Device 0:\n\tActual Device: 0\n\tCompute units: 60\n\tGlobal memory: 2097152000 bytes\n"})}),"\n",(0,s.jsx)(n.p,{children:"Launch your DCU tasks like you usually do"}),"\n",(0,s.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:'DCU-sharing in init container is not supported, pods with "hygon.com/dcumem" in init container will never be scheduled.'}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Only one vdcu can be acquired per container. If you want to mount multiple dcu devices, then you shouldn't set ",(0,s.jsx)(n.code,{children:"hygon.com/dcumem"})," or ",(0,s.jsx)(n.code,{children:"hygon.com/dcucores"})]}),"\n"]}),"\n"]})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},28453(e,n,i){i.d(n,{R:()=>t,x:()=>r});var o=i(96540);const s={},c=o.createContext(s);function t(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),o.createElement(c.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.