import{S as Kl,i as zl,s as Gl,e as r,k as c,w,t as a,M as Vl,c as o,d as n,m as p,a as l,x as $,h as i,b as s,G as t,g as f,y as P,q as T,o as C,B as k,v as Jl}from"../chunks/vendor-hf-doc-builder.js";import{T as Yl}from"../chunks/Tip-hf-doc-builder.js";import{I as ht}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as ft}from"../chunks/CodeBlock-hf-doc-builder.js";function Ql(Mt){let d,X;return{c(){d=r("p"),X=a(`oneccl_bindings_for_pytorch 1.12.0 prebuilt wheel does not work with PyTorch 1.12.1 (it is for PyTorch 1.12.0)
PyTorch 1.12.1 should work with oneccl_bindings_for_pytorch 1.12.100`)},l(_){d=o(_,"P",{});var x=l(d);X=i(x,`oneccl_bindings_for_pytorch 1.12.0 prebuilt wheel does not work with PyTorch 1.12.1 (it is for PyTorch 1.12.0)
PyTorch 1.12.1 should work with oneccl_bindings_for_pytorch 1.12.100`),x.forEach(n)},m(_,x){f(_,d,x),t(d,X)},d(_){_&&n(d)}}}function Zl(Mt){let d,X,_,x,dt,te,yn,_t,wn,Nt,ye,$n,Ot,q,F,ut,ne,Pn,mt,Tn,St,M,re,Cn,kn,oe,Dn,An,le,In,Rn,qt,N,Un,vt,Ln,Mn,gt,Nn,On,Ht,K,Sn,ae,qn,Hn,Bt,H,z,bt,ie,Bn,Et,Wn,Wt,we,jn,jt,G,xt,u,$e,Xn,Fn,Pe,Kn,zn,Te,Gn,Vn,Ce,Jn,Yn,ke,Qn,Zn,De,er,tr,y,m,Ae,nr,rr,yt,or,Ie,lr,ar,Re,ir,sr,Ue,cr,pr,Le,hr,fr,v,Me,dr,_r,wt,ur,Ne,mr,vr,Oe,gr,br,Se,Er,xr,qe,yr,wr,g,He,$r,Pr,$t,Tr,Be,Cr,kr,We,Dr,Ar,je,Ir,Rr,Xe,Ur,Lr,b,Fe,Mr,Nr,Pt,Or,Ke,Sr,qr,ze,Hr,Br,Ge,Wr,jr,Ve,Xr,Fr,E,Je,Kr,zr,Ye,Gr,Vr,Qe,Jr,Yr,Ze,Qr,Zr,et,eo,to,Tt,Xt,se,Ft,O,no,Ct,ro,oo,ce,lo,ao,Kt,V,zt,B,J,kt,pe,io,Dt,so,Gt,tt,co,Vt,nt,po,Jt,he,Yt,rt,ho,Qt,fe,Zt,W,Y,At,de,fo,It,_o,en,Q,uo,ot,mo,vo,tn,lt,go,nn,j,Z,Rt,_e,bo,Ut,Eo,rn,ue,xo,me,yo,on,at,wo,ln,ve,an,it,$o,sn,st,Po,cn,ge,pn,ee,To,Lt,Co,ko,hn,be,fn;return te=new ht({}),ne=new ht({}),ie=new ht({}),se=new ft({props:{code:"pip install oneccl_bind_pt=={pytorch_version} -f https://developer.intel.com/ipex-whl-stable-cpu",highlighted:'pip install oneccl_bind_pt=={<span class="hljs-attribute">pytorch_version} -f https</span>://developer<span class="hljs-variable">.intel</span><span class="hljs-variable">.com</span>/ipex-whl-stable-cpu'}}),V=new Yl({props:{warning:!0,$$slots:{default:[Ql]},$$scope:{ctx:Mt}}}),pe=new ht({}),he=new ft({props:{code:`oneccl_bindings_for_pytorch_path=$(python -c "from oneccl_bindings_for_pytorch import cwd; print(cwd)")
source $oneccl_bindings_for_pytorch_path/env/setvars.sh`,highlighted:`oneccl_bindings_for_pytorch_path=$(<span class="hljs-keyword">python</span> -c <span class="hljs-string">&quot;from oneccl_bindings_for_pytorch import cwd; print(cwd)&quot;</span>)
<span class="hljs-keyword">source</span> $oneccl_bindings_for_pytorch_path/<span class="hljs-keyword">env</span>/setvars.sh`}}),fe=new ft({props:{code:`torch_ccl_path=$(python -c "import torch; import torch_ccl; import os;  print(os.path.abspath(os.path.dirname(torch_ccl.__file__)))")
source $torch_ccl_path/env/setvars.sh`,highlighted:`torch_ccl_path=$(<span class="hljs-keyword">python</span> -c <span class="hljs-string">&quot;import torch; import torch_ccl; import os;  print(os.path.abspath(os.path.dirname(torch_ccl.__file__)))&quot;</span>)
<span class="hljs-keyword">source</span> $torch_ccl_path/<span class="hljs-keyword">env</span>/setvars.sh`}}),de=new ht({}),_e=new ht({}),ve=new ft({props:{code:` export CCL_WORKER_COUNT=1
 export MASTER_ADDR=127.0.0.1
 mpirun -n 2 -genv OMP_NUM_THREADS=23 \\
 python3 run_qa.py \\
 --model_name_or_path bert-large-uncased \\
 --dataset_name squad \\
 --do_train \\
 --do_eval \\
 --per_device_train_batch_size 12  \\
 --learning_rate 3e-5  \\
 --num_train_epochs 2  \\
 --max_seq_length 384 \\
 --doc_stride 128  \\
 --output_dir /tmp/debug_squad/ \\
 --no_cuda \\
 --xpu_backend ccl \\
 --use_ipex`,highlighted:` export CCL_WORKER_COUNT=1
 export MASTER_ADDR=127.0.0.1
 mpirun -n 2 -genv OMP_NUM_THREADS=23 \\
 python3 run_qa.py \\
 --model_name_or_path bert-large-uncased \\
 --dataset_name squad \\
 --do_train \\
 --do_eval \\
 --per_device_train_batch_size 12  \\
 --learning_rate 3e-5  \\
 --num_train_epochs 2  \\
 --max_seq_length 384 \\
 --doc_stride 128  \\
 --output_dir /tmp/debug_squad/ \\
 --no_cuda \\
 --xpu_backend ccl \\
 --use_ipex`}}),ge=new ft({props:{code:` cat hostfile
 xxx.xxx.xxx.xxx #node0 ip
 xxx.xxx.xxx.xxx #node1 ip`,highlighted:` cat hostfile
 xxx.xxx.xxx.xxx #node0 ip
 xxx.xxx.xxx.xxx #node1 ip`}}),be=new ft({props:{code:` export CCL_WORKER_COUNT=1
 export MASTER_ADDR=xxx.xxx.xxx.xxx #node0 ip
 mpirun -f hostfile -n 4 -ppn 2 \\
 -genv OMP_NUM_THREADS=23 \\
 python3 run_qa.py \\
 --model_name_or_path bert-large-uncased \\
 --dataset_name squad \\
 --do_train \\
 --do_eval \\
 --per_device_train_batch_size 12  \\
 --learning_rate 3e-5  \\
 --num_train_epochs 2  \\
 --max_seq_length 384 \\
 --doc_stride 128  \\
 --output_dir /tmp/debug_squad/ \\
 --no_cuda \\
 --xpu_backend ccl \\
 --use_ipex \\
 --bf16`,highlighted:` export CCL_WORKER_COUNT=1
 export MASTER_ADDR=xxx.xxx.xxx.xxx #node0 ip
 mpirun -f hostfile -n 4 -ppn 2 \\
 -genv OMP_NUM_THREADS=23 \\
 python3 run_qa.py \\
 --model_name_or_path bert-large-uncased \\
 --dataset_name squad \\
 --do_train \\
 --do_eval \\
 --per_device_train_batch_size 12  \\
 --learning_rate 3e-5  \\
 --num_train_epochs 2  \\
 --max_seq_length 384 \\
 --doc_stride 128  \\
 --output_dir /tmp/debug_squad/ \\
 --no_cuda \\
 --xpu_backend ccl \\
 --use_ipex \\
 --bf16`}}),{c(){d=r("meta"),X=c(),_=r("h1"),x=r("a"),dt=r("span"),w(te.$$.fragment),yn=c(),_t=r("span"),wn=a("Efficient Training on Multiple CPUs"),Nt=c(),ye=r("p"),$n=a("When training on a single CPU is too slow, we can use multiple CPUs. This guide focuses on PyTorch-based DDP enabling distributed CPU training efficiently."),Ot=c(),q=r("h2"),F=r("a"),ut=r("span"),w(ne.$$.fragment),Pn=c(),mt=r("span"),Tn=a("Intel\xAE oneCCL Bindings for PyTorch"),St=c(),M=r("p"),re=r("a"),Cn=a("Intel\xAE oneCCL"),kn=a(" (collective communications library) is a library for efficient distributed deep learning training implementing such collectives like allreduce, allgather, alltoall. For more information on oneCCL, please refer to the "),oe=r("a"),Dn=a("oneCCL documentation"),An=a(" and "),le=r("a"),In=a("oneCCL specification"),Rn=a("."),qt=c(),N=r("p"),Un=a("Module "),vt=r("code"),Ln=a("oneccl_bindings_for_pytorch"),Mn=a(" ("),gt=r("code"),Nn=a("torch_ccl"),On=a(" before version 1.12)  implements PyTorch C10D ProcessGroup API and can be dynamically loaded as external ProcessGroup and only works on Linux platform now"),Ht=c(),K=r("p"),Sn=a("Check more detailed information for "),ae=r("a"),qn=a("oneccl_bind_pt"),Hn=a("."),Bt=c(),H=r("h3"),z=r("a"),bt=r("span"),w(ie.$$.fragment),Bn=c(),Et=r("span"),Wn=a("Intel\xAE oneCCL Bindings for PyTorch installation:"),Wt=c(),we=r("p"),jn=a("Wheel files are available for the following Python versions:"),jt=c(),G=r("table"),xt=r("thead"),u=r("tr"),$e=r("th"),Xn=a("Extension Version"),Fn=c(),Pe=r("th"),Kn=a("Python 3.6"),zn=c(),Te=r("th"),Gn=a("Python 3.7"),Vn=c(),Ce=r("th"),Jn=a("Python 3.8"),Yn=c(),ke=r("th"),Qn=a("Python 3.9"),Zn=c(),De=r("th"),er=a("Python 3.10"),tr=c(),y=r("tbody"),m=r("tr"),Ae=r("td"),nr=a("1.13.0"),rr=c(),yt=r("td"),or=c(),Ie=r("td"),lr=a("\u221A"),ar=c(),Re=r("td"),ir=a("\u221A"),sr=c(),Ue=r("td"),cr=a("\u221A"),pr=c(),Le=r("td"),hr=a("\u221A"),fr=c(),v=r("tr"),Me=r("td"),dr=a("1.12.100"),_r=c(),wt=r("td"),ur=c(),Ne=r("td"),mr=a("\u221A"),vr=c(),Oe=r("td"),gr=a("\u221A"),br=c(),Se=r("td"),Er=a("\u221A"),xr=c(),qe=r("td"),yr=a("\u221A"),wr=c(),g=r("tr"),He=r("td"),$r=a("1.12.0"),Pr=c(),$t=r("td"),Tr=c(),Be=r("td"),Cr=a("\u221A"),kr=c(),We=r("td"),Dr=a("\u221A"),Ar=c(),je=r("td"),Ir=a("\u221A"),Rr=c(),Xe=r("td"),Ur=a("\u221A"),Lr=c(),b=r("tr"),Fe=r("td"),Mr=a("1.11.0"),Nr=c(),Pt=r("td"),Or=c(),Ke=r("td"),Sr=a("\u221A"),qr=c(),ze=r("td"),Hr=a("\u221A"),Br=c(),Ge=r("td"),Wr=a("\u221A"),jr=c(),Ve=r("td"),Xr=a("\u221A"),Fr=c(),E=r("tr"),Je=r("td"),Kr=a("1.10.0"),zr=c(),Ye=r("td"),Gr=a("\u221A"),Vr=c(),Qe=r("td"),Jr=a("\u221A"),Yr=c(),Ze=r("td"),Qr=a("\u221A"),Zr=c(),et=r("td"),eo=a("\u221A"),to=c(),Tt=r("td"),Xt=c(),w(se.$$.fragment),Ft=c(),O=r("p"),no=a("where "),Ct=r("code"),ro=a("{pytorch_version}"),oo=a(` should be your PyTorch version, for instance 1.13.0.
Check more approaches for `),ce=r("a"),lo=a("oneccl_bind_pt installation"),ao=a(`.
Versions of oneCCL and PyTorch must match.`),Kt=c(),w(V.$$.fragment),zt=c(),B=r("h2"),J=r("a"),kt=r("span"),w(pe.$$.fragment),io=c(),Dt=r("span"),so=a("Intel\xAE MPI library"),Gt=a(`

Use this standards-based MPI implementation to deliver flexible, efficient, scalable cluster messaging on Intel\xAE architecture. This component is part of the Intel\xAE oneAPI HPC Toolkit.
`),tt=r("p"),co=a("oneccl_bindings_for_pytorch is installed along with the MPI tool set. Need to source the environment before using it."),Vt=c(),nt=r("p"),po=a("for Intel\xAE oneCCL >= 1.12.0"),Jt=c(),w(he.$$.fragment),Yt=c(),rt=r("p"),ho=a("for Intel\xAE oneCCL whose version < 1.12.0"),Qt=c(),w(fe.$$.fragment),Zt=c(),W=r("h4"),Y=r("a"),At=r("span"),w(de.$$.fragment),fo=c(),It=r("span"),_o=a("IPEX installation:"),en=c(),Q=r("p"),uo=a("IPEX provides performance optimizations for CPU training with both Float32 and BFloat16, you could refer "),ot=r("a"),mo=a("single CPU section"),vo=a("."),tn=c(),lt=r("p"),go=a("The following \u201CUsage in Trainer\u201D takes mpirun in Intel\xAE MPI library as an example."),nn=c(),j=r("h2"),Z=r("a"),Rt=r("span"),w(_e.$$.fragment),bo=c(),Ut=r("span"),Eo=a("Usage in Trainer"),rn=a(`

To enable multi CPU distributed training in the Trainer with the ccl backend, users should add **\`--xpu_backend ccl\`** in the command arguments.
`),ue=r("p"),xo=a("Let\u2019s see an example with the "),me=r("a"),yo=a("question-answering example"),on=c(),at=r("p"),wo=a("The following command enables training with 2 processes on one Xeon node, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance."),ln=c(),w(ve.$$.fragment),an=c(),it=r("p"),$o=a("The following command enables training with a total of four processes on two Xeons (node0 and node1, taking node0 as the main process), ppn (processes per node) is set to 2, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance."),sn=c(),st=r("p"),Po=a("In node0, you need to create a configuration file which contains the IP addresses of each node (for example hostfile) and pass that configuration file path as an argument."),cn=c(),w(ge.$$.fragment),pn=c(),ee=r("p"),To=a("Now, run the following command in node0 and "),Lt=r("strong"),Co=a("4DDP"),ko=a(" will be enabled in node0 and node1 with BF16 auto mixed precision:"),hn=c(),w(be.$$.fragment),this.h()},l(e){const h=Vl('[data-svelte="svelte-1phssyn"]',document.head);d=o(h,"META",{name:!0,content:!0}),h.forEach(n),X=p(e),_=o(e,"H1",{class:!0});var Ee=l(_);x=o(Ee,"A",{id:!0,class:!0,href:!0});var Ao=l(x);dt=o(Ao,"SPAN",{});var Io=l(dt);$(te.$$.fragment,Io),Io.forEach(n),Ao.forEach(n),yn=p(Ee),_t=o(Ee,"SPAN",{});var Ro=l(_t);wn=i(Ro,"Efficient Training on Multiple CPUs"),Ro.forEach(n),Ee.forEach(n),Nt=p(e),ye=o(e,"P",{});var Uo=l(ye);$n=i(Uo,"When training on a single CPU is too slow, we can use multiple CPUs. This guide focuses on PyTorch-based DDP enabling distributed CPU training efficiently."),Uo.forEach(n),Ot=p(e),q=o(e,"H2",{class:!0});var dn=l(q);F=o(dn,"A",{id:!0,class:!0,href:!0});var Lo=l(F);ut=o(Lo,"SPAN",{});var Mo=l(ut);$(ne.$$.fragment,Mo),Mo.forEach(n),Lo.forEach(n),Pn=p(dn),mt=o(dn,"SPAN",{});var No=l(mt);Tn=i(No,"Intel\xAE oneCCL Bindings for PyTorch"),No.forEach(n),dn.forEach(n),St=p(e),M=o(e,"P",{});var xe=l(M);re=o(xe,"A",{href:!0,rel:!0});var Oo=l(re);Cn=i(Oo,"Intel\xAE oneCCL"),Oo.forEach(n),kn=i(xe," (collective communications library) is a library for efficient distributed deep learning training implementing such collectives like allreduce, allgather, alltoall. For more information on oneCCL, please refer to the "),oe=o(xe,"A",{href:!0,rel:!0});var So=l(oe);Dn=i(So,"oneCCL documentation"),So.forEach(n),An=i(xe," and "),le=o(xe,"A",{href:!0,rel:!0});var qo=l(le);In=i(qo,"oneCCL specification"),qo.forEach(n),Rn=i(xe,"."),xe.forEach(n),qt=p(e),N=o(e,"P",{});var ct=l(N);Un=i(ct,"Module "),vt=o(ct,"CODE",{});var Ho=l(vt);Ln=i(Ho,"oneccl_bindings_for_pytorch"),Ho.forEach(n),Mn=i(ct," ("),gt=o(ct,"CODE",{});var Bo=l(gt);Nn=i(Bo,"torch_ccl"),Bo.forEach(n),On=i(ct," before version 1.12)  implements PyTorch C10D ProcessGroup API and can be dynamically loaded as external ProcessGroup and only works on Linux platform now"),ct.forEach(n),Ht=p(e),K=o(e,"P",{});var _n=l(K);Sn=i(_n,"Check more detailed information for "),ae=o(_n,"A",{href:!0,rel:!0});var Wo=l(ae);qn=i(Wo,"oneccl_bind_pt"),Wo.forEach(n),Hn=i(_n,"."),_n.forEach(n),Bt=p(e),H=o(e,"H3",{class:!0});var un=l(H);z=o(un,"A",{id:!0,class:!0,href:!0});var jo=l(z);bt=o(jo,"SPAN",{});var Xo=l(bt);$(ie.$$.fragment,Xo),Xo.forEach(n),jo.forEach(n),Bn=p(un),Et=o(un,"SPAN",{});var Fo=l(Et);Wn=i(Fo,"Intel\xAE oneCCL Bindings for PyTorch installation:"),Fo.forEach(n),un.forEach(n),Wt=p(e),we=o(e,"P",{});var Ko=l(we);jn=i(Ko,"Wheel files are available for the following Python versions:"),Ko.forEach(n),jt=p(e),G=o(e,"TABLE",{});var mn=l(G);xt=o(mn,"THEAD",{});var zo=l(xt);u=o(zo,"TR",{});var D=l(u);$e=o(D,"TH",{align:!0});var Go=l($e);Xn=i(Go,"Extension Version"),Go.forEach(n),Fn=p(D),Pe=o(D,"TH",{align:!0});var Vo=l(Pe);Kn=i(Vo,"Python 3.6"),Vo.forEach(n),zn=p(D),Te=o(D,"TH",{align:!0});var Jo=l(Te);Gn=i(Jo,"Python 3.7"),Jo.forEach(n),Vn=p(D),Ce=o(D,"TH",{align:!0});var Yo=l(Ce);Jn=i(Yo,"Python 3.8"),Yo.forEach(n),Yn=p(D),ke=o(D,"TH",{align:!0});var Qo=l(ke);Qn=i(Qo,"Python 3.9"),Qo.forEach(n),Zn=p(D),De=o(D,"TH",{align:!0});var Zo=l(De);er=i(Zo,"Python 3.10"),Zo.forEach(n),D.forEach(n),zo.forEach(n),tr=p(mn),y=o(mn,"TBODY",{});var S=l(y);m=o(S,"TR",{});var A=l(m);Ae=o(A,"TD",{align:!0});var el=l(Ae);nr=i(el,"1.13.0"),el.forEach(n),rr=p(A),yt=o(A,"TD",{align:!0}),l(yt).forEach(n),or=p(A),Ie=o(A,"TD",{align:!0});var tl=l(Ie);lr=i(tl,"\u221A"),tl.forEach(n),ar=p(A),Re=o(A,"TD",{align:!0});var nl=l(Re);ir=i(nl,"\u221A"),nl.forEach(n),sr=p(A),Ue=o(A,"TD",{align:!0});var rl=l(Ue);cr=i(rl,"\u221A"),rl.forEach(n),pr=p(A),Le=o(A,"TD",{align:!0});var ol=l(Le);hr=i(ol,"\u221A"),ol.forEach(n),A.forEach(n),fr=p(S),v=o(S,"TR",{});var I=l(v);Me=o(I,"TD",{align:!0});var ll=l(Me);dr=i(ll,"1.12.100"),ll.forEach(n),_r=p(I),wt=o(I,"TD",{align:!0}),l(wt).forEach(n),ur=p(I),Ne=o(I,"TD",{align:!0});var al=l(Ne);mr=i(al,"\u221A"),al.forEach(n),vr=p(I),Oe=o(I,"TD",{align:!0});var il=l(Oe);gr=i(il,"\u221A"),il.forEach(n),br=p(I),Se=o(I,"TD",{align:!0});var sl=l(Se);Er=i(sl,"\u221A"),sl.forEach(n),xr=p(I),qe=o(I,"TD",{align:!0});var cl=l(qe);yr=i(cl,"\u221A"),cl.forEach(n),I.forEach(n),wr=p(S),g=o(S,"TR",{});var R=l(g);He=o(R,"TD",{align:!0});var pl=l(He);$r=i(pl,"1.12.0"),pl.forEach(n),Pr=p(R),$t=o(R,"TD",{align:!0}),l($t).forEach(n),Tr=p(R),Be=o(R,"TD",{align:!0});var hl=l(Be);Cr=i(hl,"\u221A"),hl.forEach(n),kr=p(R),We=o(R,"TD",{align:!0});var fl=l(We);Dr=i(fl,"\u221A"),fl.forEach(n),Ar=p(R),je=o(R,"TD",{align:!0});var dl=l(je);Ir=i(dl,"\u221A"),dl.forEach(n),Rr=p(R),Xe=o(R,"TD",{align:!0});var _l=l(Xe);Ur=i(_l,"\u221A"),_l.forEach(n),R.forEach(n),Lr=p(S),b=o(S,"TR",{});var U=l(b);Fe=o(U,"TD",{align:!0});var ul=l(Fe);Mr=i(ul,"1.11.0"),ul.forEach(n),Nr=p(U),Pt=o(U,"TD",{align:!0}),l(Pt).forEach(n),Or=p(U),Ke=o(U,"TD",{align:!0});var ml=l(Ke);Sr=i(ml,"\u221A"),ml.forEach(n),qr=p(U),ze=o(U,"TD",{align:!0});var vl=l(ze);Hr=i(vl,"\u221A"),vl.forEach(n),Br=p(U),Ge=o(U,"TD",{align:!0});var gl=l(Ge);Wr=i(gl,"\u221A"),gl.forEach(n),jr=p(U),Ve=o(U,"TD",{align:!0});var bl=l(Ve);Xr=i(bl,"\u221A"),bl.forEach(n),U.forEach(n),Fr=p(S),E=o(S,"TR",{});var L=l(E);Je=o(L,"TD",{align:!0});var El=l(Je);Kr=i(El,"1.10.0"),El.forEach(n),zr=p(L),Ye=o(L,"TD",{align:!0});var xl=l(Ye);Gr=i(xl,"\u221A"),xl.forEach(n),Vr=p(L),Qe=o(L,"TD",{align:!0});var yl=l(Qe);Jr=i(yl,"\u221A"),yl.forEach(n),Yr=p(L),Ze=o(L,"TD",{align:!0});var wl=l(Ze);Qr=i(wl,"\u221A"),wl.forEach(n),Zr=p(L),et=o(L,"TD",{align:!0});var $l=l(et);eo=i($l,"\u221A"),$l.forEach(n),to=p(L),Tt=o(L,"TD",{align:!0}),l(Tt).forEach(n),L.forEach(n),S.forEach(n),mn.forEach(n),Xt=p(e),$(se.$$.fragment,e),Ft=p(e),O=o(e,"P",{});var pt=l(O);no=i(pt,"where "),Ct=o(pt,"CODE",{});var Pl=l(Ct);ro=i(Pl,"{pytorch_version}"),Pl.forEach(n),oo=i(pt,` should be your PyTorch version, for instance 1.13.0.
Check more approaches for `),ce=o(pt,"A",{href:!0,rel:!0});var Tl=l(ce);lo=i(Tl,"oneccl_bind_pt installation"),Tl.forEach(n),ao=i(pt,`.
Versions of oneCCL and PyTorch must match.`),pt.forEach(n),Kt=p(e),$(V.$$.fragment,e),zt=p(e),B=o(e,"H2",{class:!0});var vn=l(B);J=o(vn,"A",{id:!0,class:!0,href:!0});var Cl=l(J);kt=o(Cl,"SPAN",{});var kl=l(kt);$(pe.$$.fragment,kl),kl.forEach(n),Cl.forEach(n),io=p(vn),Dt=o(vn,"SPAN",{});var Dl=l(Dt);so=i(Dl,"Intel\xAE MPI library"),Dl.forEach(n),vn.forEach(n),Gt=i(e,`

Use this standards-based MPI implementation to deliver flexible, efficient, scalable cluster messaging on Intel\xAE architecture. This component is part of the Intel\xAE oneAPI HPC Toolkit.
`),tt=o(e,"P",{});var Al=l(tt);co=i(Al,"oneccl_bindings_for_pytorch is installed along with the MPI tool set. Need to source the environment before using it."),Al.forEach(n),Vt=p(e),nt=o(e,"P",{});var Il=l(nt);po=i(Il,"for Intel\xAE oneCCL >= 1.12.0"),Il.forEach(n),Jt=p(e),$(he.$$.fragment,e),Yt=p(e),rt=o(e,"P",{});var Rl=l(rt);ho=i(Rl,"for Intel\xAE oneCCL whose version < 1.12.0"),Rl.forEach(n),Qt=p(e),$(fe.$$.fragment,e),Zt=p(e),W=o(e,"H4",{class:!0});var gn=l(W);Y=o(gn,"A",{id:!0,class:!0,href:!0});var Ul=l(Y);At=o(Ul,"SPAN",{});var Ll=l(At);$(de.$$.fragment,Ll),Ll.forEach(n),Ul.forEach(n),fo=p(gn),It=o(gn,"SPAN",{});var Ml=l(It);_o=i(Ml,"IPEX installation:"),Ml.forEach(n),gn.forEach(n),en=p(e),Q=o(e,"P",{});var bn=l(Q);uo=i(bn,"IPEX provides performance optimizations for CPU training with both Float32 and BFloat16, you could refer "),ot=o(bn,"A",{href:!0});var Nl=l(ot);mo=i(Nl,"single CPU section"),Nl.forEach(n),vo=i(bn,"."),bn.forEach(n),tn=p(e),lt=o(e,"P",{});var Ol=l(lt);go=i(Ol,"The following \u201CUsage in Trainer\u201D takes mpirun in Intel\xAE MPI library as an example."),Ol.forEach(n),nn=p(e),j=o(e,"H2",{class:!0});var En=l(j);Z=o(En,"A",{id:!0,class:!0,href:!0});var Sl=l(Z);Rt=o(Sl,"SPAN",{});var ql=l(Rt);$(_e.$$.fragment,ql),ql.forEach(n),Sl.forEach(n),bo=p(En),Ut=o(En,"SPAN",{});var Hl=l(Ut);Eo=i(Hl,"Usage in Trainer"),Hl.forEach(n),En.forEach(n),rn=i(e,`

To enable multi CPU distributed training in the Trainer with the ccl backend, users should add **\`--xpu_backend ccl\`** in the command arguments.
`),ue=o(e,"P",{});var Do=l(ue);xo=i(Do,"Let\u2019s see an example with the "),me=o(Do,"A",{href:!0,rel:!0});var Bl=l(me);yo=i(Bl,"question-answering example"),Bl.forEach(n),Do.forEach(n),on=p(e),at=o(e,"P",{});var Wl=l(at);wo=i(Wl,"The following command enables training with 2 processes on one Xeon node, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance."),Wl.forEach(n),ln=p(e),$(ve.$$.fragment,e),an=p(e),it=o(e,"P",{});var jl=l(it);$o=i(jl,"The following command enables training with a total of four processes on two Xeons (node0 and node1, taking node0 as the main process), ppn (processes per node) is set to 2, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance."),jl.forEach(n),sn=p(e),st=o(e,"P",{});var Xl=l(st);Po=i(Xl,"In node0, you need to create a configuration file which contains the IP addresses of each node (for example hostfile) and pass that configuration file path as an argument."),Xl.forEach(n),cn=p(e),$(ge.$$.fragment,e),pn=p(e),ee=o(e,"P",{});var xn=l(ee);To=i(xn,"Now, run the following command in node0 and "),Lt=o(xn,"STRONG",{});var Fl=l(Lt);Co=i(Fl,"4DDP"),Fl.forEach(n),ko=i(xn," will be enabled in node0 and node1 with BF16 auto mixed precision:"),xn.forEach(n),hn=p(e),$(be.$$.fragment,e),this.h()},h(){s(d,"name","hf:doc:metadata"),s(d,"content",JSON.stringify(ea)),s(x,"id","efficient-training-on-multiple-cpus"),s(x,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(x,"href","#efficient-training-on-multiple-cpus"),s(_,"class","relative group"),s(F,"id","intel-oneccl-bindings-for-pytorch"),s(F,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(F,"href","#intel-oneccl-bindings-for-pytorch"),s(q,"class","relative group"),s(re,"href","https://github.com/oneapi-src/oneCCL"),s(re,"rel","nofollow"),s(oe,"href","https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html"),s(oe,"rel","nofollow"),s(le,"href","https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html"),s(le,"rel","nofollow"),s(ae,"href","https://github.com/intel/torch-ccl"),s(ae,"rel","nofollow"),s(z,"id","intel-oneccl-bindings-for-pytorch-installation"),s(z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(z,"href","#intel-oneccl-bindings-for-pytorch-installation"),s(H,"class","relative group"),s($e,"align","center"),s(Pe,"align","center"),s(Te,"align","center"),s(Ce,"align","center"),s(ke,"align","center"),s(De,"align","center"),s(Ae,"align","center"),s(yt,"align","center"),s(Ie,"align","center"),s(Re,"align","center"),s(Ue,"align","center"),s(Le,"align","center"),s(Me,"align","center"),s(wt,"align","center"),s(Ne,"align","center"),s(Oe,"align","center"),s(Se,"align","center"),s(qe,"align","center"),s(He,"align","center"),s($t,"align","center"),s(Be,"align","center"),s(We,"align","center"),s(je,"align","center"),s(Xe,"align","center"),s(Fe,"align","center"),s(Pt,"align","center"),s(Ke,"align","center"),s(ze,"align","center"),s(Ge,"align","center"),s(Ve,"align","center"),s(Je,"align","center"),s(Ye,"align","center"),s(Qe,"align","center"),s(Ze,"align","center"),s(et,"align","center"),s(Tt,"align","center"),s(ce,"href","https://github.com/intel/torch-ccl"),s(ce,"rel","nofollow"),s(J,"id","intel-mpi-library"),s(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(J,"href","#intel-mpi-library"),s(B,"class","relative group"),s(Y,"id","ipex-installation"),s(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(Y,"href","#ipex-installation"),s(W,"class","relative group"),s(ot,"href","./perf_train_cpu"),s(Z,"id","usage-in-trainer"),s(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(Z,"href","#usage-in-trainer"),s(j,"class","relative group"),s(me,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering"),s(me,"rel","nofollow")},m(e,h){t(document.head,d),f(e,X,h),f(e,_,h),t(_,x),t(x,dt),P(te,dt,null),t(_,yn),t(_,_t),t(_t,wn),f(e,Nt,h),f(e,ye,h),t(ye,$n),f(e,Ot,h),f(e,q,h),t(q,F),t(F,ut),P(ne,ut,null),t(q,Pn),t(q,mt),t(mt,Tn),f(e,St,h),f(e,M,h),t(M,re),t(re,Cn),t(M,kn),t(M,oe),t(oe,Dn),t(M,An),t(M,le),t(le,In),t(M,Rn),f(e,qt,h),f(e,N,h),t(N,Un),t(N,vt),t(vt,Ln),t(N,Mn),t(N,gt),t(gt,Nn),t(N,On),f(e,Ht,h),f(e,K,h),t(K,Sn),t(K,ae),t(ae,qn),t(K,Hn),f(e,Bt,h),f(e,H,h),t(H,z),t(z,bt),P(ie,bt,null),t(H,Bn),t(H,Et),t(Et,Wn),f(e,Wt,h),f(e,we,h),t(we,jn),f(e,jt,h),f(e,G,h),t(G,xt),t(xt,u),t(u,$e),t($e,Xn),t(u,Fn),t(u,Pe),t(Pe,Kn),t(u,zn),t(u,Te),t(Te,Gn),t(u,Vn),t(u,Ce),t(Ce,Jn),t(u,Yn),t(u,ke),t(ke,Qn),t(u,Zn),t(u,De),t(De,er),t(G,tr),t(G,y),t(y,m),t(m,Ae),t(Ae,nr),t(m,rr),t(m,yt),t(m,or),t(m,Ie),t(Ie,lr),t(m,ar),t(m,Re),t(Re,ir),t(m,sr),t(m,Ue),t(Ue,cr),t(m,pr),t(m,Le),t(Le,hr),t(y,fr),t(y,v),t(v,Me),t(Me,dr),t(v,_r),t(v,wt),t(v,ur),t(v,Ne),t(Ne,mr),t(v,vr),t(v,Oe),t(Oe,gr),t(v,br),t(v,Se),t(Se,Er),t(v,xr),t(v,qe),t(qe,yr),t(y,wr),t(y,g),t(g,He),t(He,$r),t(g,Pr),t(g,$t),t(g,Tr),t(g,Be),t(Be,Cr),t(g,kr),t(g,We),t(We,Dr),t(g,Ar),t(g,je),t(je,Ir),t(g,Rr),t(g,Xe),t(Xe,Ur),t(y,Lr),t(y,b),t(b,Fe),t(Fe,Mr),t(b,Nr),t(b,Pt),t(b,Or),t(b,Ke),t(Ke,Sr),t(b,qr),t(b,ze),t(ze,Hr),t(b,Br),t(b,Ge),t(Ge,Wr),t(b,jr),t(b,Ve),t(Ve,Xr),t(y,Fr),t(y,E),t(E,Je),t(Je,Kr),t(E,zr),t(E,Ye),t(Ye,Gr),t(E,Vr),t(E,Qe),t(Qe,Jr),t(E,Yr),t(E,Ze),t(Ze,Qr),t(E,Zr),t(E,et),t(et,eo),t(E,to),t(E,Tt),f(e,Xt,h),P(se,e,h),f(e,Ft,h),f(e,O,h),t(O,no),t(O,Ct),t(Ct,ro),t(O,oo),t(O,ce),t(ce,lo),t(O,ao),f(e,Kt,h),P(V,e,h),f(e,zt,h),f(e,B,h),t(B,J),t(J,kt),P(pe,kt,null),t(B,io),t(B,Dt),t(Dt,so),f(e,Gt,h),f(e,tt,h),t(tt,co),f(e,Vt,h),f(e,nt,h),t(nt,po),f(e,Jt,h),P(he,e,h),f(e,Yt,h),f(e,rt,h),t(rt,ho),f(e,Qt,h),P(fe,e,h),f(e,Zt,h),f(e,W,h),t(W,Y),t(Y,At),P(de,At,null),t(W,fo),t(W,It),t(It,_o),f(e,en,h),f(e,Q,h),t(Q,uo),t(Q,ot),t(ot,mo),t(Q,vo),f(e,tn,h),f(e,lt,h),t(lt,go),f(e,nn,h),f(e,j,h),t(j,Z),t(Z,Rt),P(_e,Rt,null),t(j,bo),t(j,Ut),t(Ut,Eo),f(e,rn,h),f(e,ue,h),t(ue,xo),t(ue,me),t(me,yo),f(e,on,h),f(e,at,h),t(at,wo),f(e,ln,h),P(ve,e,h),f(e,an,h),f(e,it,h),t(it,$o),f(e,sn,h),f(e,st,h),t(st,Po),f(e,cn,h),P(ge,e,h),f(e,pn,h),f(e,ee,h),t(ee,To),t(ee,Lt),t(Lt,Co),t(ee,ko),f(e,hn,h),P(be,e,h),fn=!0},p(e,[h]){const Ee={};h&2&&(Ee.$$scope={dirty:h,ctx:e}),V.$set(Ee)},i(e){fn||(T(te.$$.fragment,e),T(ne.$$.fragment,e),T(ie.$$.fragment,e),T(se.$$.fragment,e),T(V.$$.fragment,e),T(pe.$$.fragment,e),T(he.$$.fragment,e),T(fe.$$.fragment,e),T(de.$$.fragment,e),T(_e.$$.fragment,e),T(ve.$$.fragment,e),T(ge.$$.fragment,e),T(be.$$.fragment,e),fn=!0)},o(e){C(te.$$.fragment,e),C(ne.$$.fragment,e),C(ie.$$.fragment,e),C(se.$$.fragment,e),C(V.$$.fragment,e),C(pe.$$.fragment,e),C(he.$$.fragment,e),C(fe.$$.fragment,e),C(de.$$.fragment,e),C(_e.$$.fragment,e),C(ve.$$.fragment,e),C(ge.$$.fragment,e),C(be.$$.fragment,e),fn=!1},d(e){n(d),e&&n(X),e&&n(_),k(te),e&&n(Nt),e&&n(ye),e&&n(Ot),e&&n(q),k(ne),e&&n(St),e&&n(M),e&&n(qt),e&&n(N),e&&n(Ht),e&&n(K),e&&n(Bt),e&&n(H),k(ie),e&&n(Wt),e&&n(we),e&&n(jt),e&&n(G),e&&n(Xt),k(se,e),e&&n(Ft),e&&n(O),e&&n(Kt),k(V,e),e&&n(zt),e&&n(B),k(pe),e&&n(Gt),e&&n(tt),e&&n(Vt),e&&n(nt),e&&n(Jt),k(he,e),e&&n(Yt),e&&n(rt),e&&n(Qt),k(fe,e),e&&n(Zt),e&&n(W),k(de),e&&n(en),e&&n(Q),e&&n(tn),e&&n(lt),e&&n(nn),e&&n(j),k(_e),e&&n(rn),e&&n(ue),e&&n(on),e&&n(at),e&&n(ln),k(ve,e),e&&n(an),e&&n(it),e&&n(sn),e&&n(st),e&&n(cn),k(ge,e),e&&n(pn),e&&n(ee),e&&n(hn),k(be,e)}}}const ea={local:"efficient-training-on-multiple-cpus",sections:[{local:"intel-oneccl-bindings-for-pytorch",sections:[{local:"intel-oneccl-bindings-for-pytorch-installation",title:"Intel\xAE oneCCL Bindings for PyTorch installation:"}],title:"Intel\xAE oneCCL Bindings for PyTorch"},{local:"intel-mpi-library",sections:[{local:"ipex-installation",title:"IPEX installation:"}],title:"Intel\xAE MPI library"},{local:"usage-in-trainer",title:"Usage in Trainer"}],title:"Efficient Training on Multiple CPUs"};function ta(Mt){return Jl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class aa extends Kl{constructor(d){super();zl(this,d,ta,Zl,Gl,{})}}export{aa as default,ea as metadata};
