import{S as Hr,i as Yr,s as Qr,e as n,k as c,w as M,t as a,M as Fr,c as o,d as l,m as h,a as r,x as E,h as i,b as s,G as t,g as d,y as U,q as C,o as P,B as J,v as zr}from"../chunks/vendor-hf-doc-builder.js";import{T as Or}from"../chunks/Tip-hf-doc-builder.js";import{I as ft}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as dt}from"../chunks/CodeBlock-hf-doc-builder.js";function qr(Nt){let p,W;return{c(){p=n("p"),W=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(u){p=o(u,"P",{});var b=r(p);W=i(b,`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`),b.forEach(l)},m(u,b){d(u,p,b),t(p,W)},d(u){u&&l(p)}}}function Kr(Nt){let p,W,u,b,pt,te,bl,ut,gl,Rt,ge,Ml,Dt,L,V,mt,le,El,_t,Ul,Xt,N,ne,Cl,Pl,oe,Jl,$l,re,Il,xl,Lt,R,kl,wt,Al,jl,Tt,Nl,Rl,Bt,H,Dl,ae,Xl,Ll,St,B,Y,vt,ie,Bl,yt,Sl,Gt,Me,Gl,Zt,Q,bt,m,Ee,Zl,Wl,Ue,Vl,Hl,Ce,Yl,Ql,Pe,Fl,zl,Je,Ol,ql,$e,Kl,en,g,_,Ie,tn,ln,gt,nn,xe,on,rn,ke,an,sn,Ae,cn,hn,je,fn,dn,w,Ne,pn,un,Mt,mn,Re,_n,wn,De,Tn,vn,Xe,yn,bn,Le,gn,Mn,T,Be,En,Un,Et,Cn,Se,Pn,Jn,Ge,$n,In,Ze,xn,kn,We,An,jn,v,Ve,Nn,Rn,Ut,Dn,He,Xn,Ln,Ye,Bn,Sn,Qe,Gn,Zn,Fe,Wn,Vn,y,ze,Hn,Yn,Oe,Qn,Fn,qe,zn,On,Ke,qn,Kn,et,eo,to,Ct,Wt,se,Vt,D,lo,Pt,no,oo,ce,ro,ao,Ht,F,Yt,S,z,Jt,he,io,$t,so,Qt,tt,co,Ft,lt,ho,zt,fe,Ot,nt,fo,qt,de,Kt,G,O,It,pe,po,xt,uo,el,q,mo,ot,_o,wo,tl,rt,To,ll,Z,K,kt,ue,vo,At,yo,nl,me,bo,_e,go,ol,at,Mo,rl,we,al,it,Eo,il,st,Uo,sl,Te,cl,ee,Co,jt,Po,Jo,hl,ve,fl;return te=new ft({}),le=new ft({}),ie=new ft({}),se=new dt({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9uZWNjbF9iaW5kX3B0JTNEJTNEJTdCcHl0b3JjaF92ZXJzaW9uJTdEJTIwLWYlMjBodHRwcyUzQSUyRiUyRmRldmVsb3Blci5pbnRlbC5jb20lMkZpcGV4LXdobC1zdGFibGUtY3B1",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'}}),F=new Or({props:{warning:!0,$$slots:{default:[qr]},$$scope:{ctx:Nt}}}),he=new ft({}),fe=new dt({props:{code:"b25lY2NsX2JpbmRpbmdzX2Zvcl9weXRvcmNoX3BhdGglM0QlMjQocHl0aG9uJTIwLWMlMjAlMjJmcm9tJTIwb25lY2NsX2JpbmRpbmdzX2Zvcl9weXRvcmNoJTIwaW1wb3J0JTIwY3dkJTNCJTIwcHJpbnQoY3dkKSUyMiklMEFzb3VyY2UlMjAlMjRvbmVjY2xfYmluZGluZ3NfZm9yX3B5dG9yY2hfcGF0aCUyRmVudiUyRnNldHZhcnMuc2g=",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`}}),de=new dt({props:{code:"dG9yY2hfY2NsX3BhdGglM0QlMjQocHl0aG9uJTIwLWMlMjAlMjJpbXBvcnQlMjB0b3JjaCUzQiUyMGltcG9ydCUyMHRvcmNoX2NjbCUzQiUyMGltcG9ydCUyMG9zJTNCJTIwJTIwcHJpbnQob3MucGF0aC5hYnNwYXRoKG9zLnBhdGguZGlybmFtZSh0b3JjaF9jY2wuX19maWxlX18pKSklMjIpJTBBc291cmNlJTIwJTI0dG9yY2hfY2NsX3BhdGglMkZlbnYlMkZzZXR2YXJzLnNo",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`}}),pe=new ft({}),ue=new ft({}),we=new dt({props:{code:"JTIwZXhwb3J0JTIwQ0NMX1dPUktFUl9DT1VOVCUzRDElMEElMjBleHBvcnQlMjBNQVNURVJfQUREUiUzRDEyNy4wLjAuMSUwQSUyMG1waXJ1biUyMC1uJTIwMiUyMC1nZW52JTIwT01QX05VTV9USFJFQURTJTNEMjMlMjAlNUMlMEElMjBweXRob24zJTIwcnVuX3FhLnB5JTIwJTVDJTBBJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBiZXJ0LWxhcmdlLXVuY2FzZWQlMjAlNUMlMEElMjAtLWRhdGFzZXRfbmFtZSUyMHNxdWFkJTIwJTVDJTBBJTIwLS1kb190cmFpbiUyMCU1QyUwQSUyMC0tZG9fZXZhbCUyMCU1QyUwQSUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMTIlMjAlMjAlNUMlMEElMjAtLWxlYXJuaW5nX3JhdGUlMjAzZS01JTIwJTIwJTVDJTBBJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMiUyMCUyMCU1QyUwQSUyMC0tbWF4X3NlcV9sZW5ndGglMjAzODQlMjAlNUMlMEElMjAtLWRvY19zdHJpZGUlMjAxMjglMjAlMjAlNUMlMEElMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkZkZWJ1Z19zcXVhZCUyRiUyMCU1QyUwQSUyMC0tbm9fY3VkYSUyMCU1QyUwQSUyMC0tZGRwX2JhY2tlbmQlMjBjY2wlMjAlNUMlMEElMjAtLXVzZV9pcGV4",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 \\
 --ddp_backend ccl \\
 --use_ipex`}}),Te=new dt({props:{code:"JTIwY2F0JTIwaG9zdGZpbGUlMEElMjB4eHgueHh4Lnh4eC54eHglMjAlMjNub2RlMCUyMGlwJTBBJTIweHh4Lnh4eC54eHgueHh4JTIwJTIzbm9kZTElMjBpcA==",highlighted:` cat hostfile
 xxx.xxx.xxx.xxx #node0 ip
 xxx.xxx.xxx.xxx #node1 ip`}}),ve=new dt({props:{code:"JTIwZXhwb3J0JTIwQ0NMX1dPUktFUl9DT1VOVCUzRDElMEElMjBleHBvcnQlMjBNQVNURVJfQUREUiUzRHh4eC54eHgueHh4Lnh4eCUyMCUyM25vZGUwJTIwaXAlMEElMjBtcGlydW4lMjAtZiUyMGhvc3RmaWxlJTIwLW4lMjA0JTIwLXBwbiUyMDIlMjAlNUMlMEElMjAtZ2VudiUyME9NUF9OVU1fVEhSRUFEUyUzRDIzJTIwJTVDJTBBJTIwcHl0aG9uMyUyMHJ1bl9xYS5weSUyMCU1QyUwQSUyMC0tbW9kZWxfbmFtZV9vcl9wYXRoJTIwYmVydC1sYXJnZS11bmNhc2VkJTIwJTVDJTBBJTIwLS1kYXRhc2V0X25hbWUlMjBzcXVhZCUyMCU1QyUwQSUyMC0tZG9fdHJhaW4lMjAlNUMlMEElMjAtLWRvX2V2YWwlMjAlNUMlMEElMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMDEyJTIwJTIwJTVDJTBBJTIwLS1sZWFybmluZ19yYXRlJTIwM2UtNSUyMCUyMCU1QyUwQSUyMC0tbnVtX3RyYWluX2Vwb2NocyUyMDIlMjAlMjAlNUMlMEElMjAtLW1heF9zZXFfbGVuZ3RoJTIwMzg0JTIwJTVDJTBBJTIwLS1kb2Nfc3RyaWRlJTIwMTI4JTIwJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTIwJTJGdG1wJTJGZGVidWdfc3F1YWQlMkYlMjAlNUMlMEElMjAtLW5vX2N1ZGElMjAlNUMlMEElMjAtLWRkcF9iYWNrZW5kJTIwY2NsJTIwJTVDJTBBJTIwLS11c2VfaXBleCUyMCU1QyUwQSUyMC0tYmYxNg==",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 \\
 --ddp_backend ccl \\
 --use_ipex \\
 --bf16`}}),{c(){p=n("meta"),W=c(),u=n("h1"),b=n("a"),pt=n("span"),M(te.$$.fragment),bl=c(),ut=n("span"),gl=a("Efficient Training on Multiple CPUs"),Rt=c(),ge=n("p"),Ml=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."),Dt=c(),L=n("h2"),V=n("a"),mt=n("span"),M(le.$$.fragment),El=c(),_t=n("span"),Ul=a("Intel\xAE oneCCL Bindings for PyTorch"),Xt=c(),N=n("p"),ne=n("a"),Cl=a("Intel\xAE oneCCL"),Pl=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=n("a"),Jl=a("oneCCL documentation"),$l=a(" and "),re=n("a"),Il=a("oneCCL specification"),xl=a("."),Lt=c(),R=n("p"),kl=a("Module "),wt=n("code"),Al=a("oneccl_bindings_for_pytorch"),jl=a(" ("),Tt=n("code"),Nl=a("torch_ccl"),Rl=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"),Bt=c(),H=n("p"),Dl=a("Check more detailed information for "),ae=n("a"),Xl=a("oneccl_bind_pt"),Ll=a("."),St=c(),B=n("h3"),Y=n("a"),vt=n("span"),M(ie.$$.fragment),Bl=c(),yt=n("span"),Sl=a("Intel\xAE oneCCL Bindings for PyTorch installation:"),Gt=c(),Me=n("p"),Gl=a("Wheel files are available for the following Python versions:"),Zt=c(),Q=n("table"),bt=n("thead"),m=n("tr"),Ee=n("th"),Zl=a("Extension Version"),Wl=c(),Ue=n("th"),Vl=a("Python 3.6"),Hl=c(),Ce=n("th"),Yl=a("Python 3.7"),Ql=c(),Pe=n("th"),Fl=a("Python 3.8"),zl=c(),Je=n("th"),Ol=a("Python 3.9"),ql=c(),$e=n("th"),Kl=a("Python 3.10"),en=c(),g=n("tbody"),_=n("tr"),Ie=n("td"),tn=a("1.13.0"),ln=c(),gt=n("td"),nn=c(),xe=n("td"),on=a("\u221A"),rn=c(),ke=n("td"),an=a("\u221A"),sn=c(),Ae=n("td"),cn=a("\u221A"),hn=c(),je=n("td"),fn=a("\u221A"),dn=c(),w=n("tr"),Ne=n("td"),pn=a("1.12.100"),un=c(),Mt=n("td"),mn=c(),Re=n("td"),_n=a("\u221A"),wn=c(),De=n("td"),Tn=a("\u221A"),vn=c(),Xe=n("td"),yn=a("\u221A"),bn=c(),Le=n("td"),gn=a("\u221A"),Mn=c(),T=n("tr"),Be=n("td"),En=a("1.12.0"),Un=c(),Et=n("td"),Cn=c(),Se=n("td"),Pn=a("\u221A"),Jn=c(),Ge=n("td"),$n=a("\u221A"),In=c(),Ze=n("td"),xn=a("\u221A"),kn=c(),We=n("td"),An=a("\u221A"),jn=c(),v=n("tr"),Ve=n("td"),Nn=a("1.11.0"),Rn=c(),Ut=n("td"),Dn=c(),He=n("td"),Xn=a("\u221A"),Ln=c(),Ye=n("td"),Bn=a("\u221A"),Sn=c(),Qe=n("td"),Gn=a("\u221A"),Zn=c(),Fe=n("td"),Wn=a("\u221A"),Vn=c(),y=n("tr"),ze=n("td"),Hn=a("1.10.0"),Yn=c(),Oe=n("td"),Qn=a("\u221A"),Fn=c(),qe=n("td"),zn=a("\u221A"),On=c(),Ke=n("td"),qn=a("\u221A"),Kn=c(),et=n("td"),eo=a("\u221A"),to=c(),Ct=n("td"),Wt=c(),M(se.$$.fragment),Vt=c(),D=n("p"),lo=a("where "),Pt=n("code"),no=a("{pytorch_version}"),oo=a(` should be your PyTorch version, for instance 1.13.0.
Check more approaches for `),ce=n("a"),ro=a("oneccl_bind_pt installation"),ao=a(`.
Versions of oneCCL and PyTorch must match.`),Ht=c(),M(F.$$.fragment),Yt=c(),S=n("h2"),z=n("a"),Jt=n("span"),M(he.$$.fragment),io=c(),$t=n("span"),so=a("Intel\xAE MPI library"),Qt=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=n("p"),co=a("oneccl_bindings_for_pytorch is installed along with the MPI tool set. Need to source the environment before using it."),Ft=c(),lt=n("p"),ho=a("for Intel\xAE oneCCL >= 1.12.0"),zt=c(),M(fe.$$.fragment),Ot=c(),nt=n("p"),fo=a("for Intel\xAE oneCCL whose version < 1.12.0"),qt=c(),M(de.$$.fragment),Kt=c(),G=n("h4"),O=n("a"),It=n("span"),M(pe.$$.fragment),po=c(),xt=n("span"),uo=a("IPEX installation:"),el=c(),q=n("p"),mo=a("IPEX provides performance optimizations for CPU training with both Float32 and BFloat16, you could refer "),ot=n("a"),_o=a("single CPU section"),wo=a("."),tl=c(),rt=n("p"),To=a("The following \u201CUsage in Trainer\u201D takes mpirun in Intel\xAE MPI library as an example."),ll=c(),Z=n("h2"),K=n("a"),kt=n("span"),M(ue.$$.fragment),vo=c(),At=n("span"),yo=a("Usage in Trainer"),nl=a(`

To enable multi CPU distributed training in the Trainer with the ccl backend, users should add **\`--ddp_backend ccl\`** in the command arguments.
`),me=n("p"),bo=a("Let\u2019s see an example with the "),_e=n("a"),go=a("question-answering example"),ol=c(),at=n("p"),Mo=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."),rl=c(),M(we.$$.fragment),al=c(),it=n("p"),Eo=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."),il=c(),st=n("p"),Uo=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."),sl=c(),M(Te.$$.fragment),cl=c(),ee=n("p"),Co=a("Now, run the following command in node0 and "),jt=n("strong"),Po=a("4DDP"),Jo=a(" will be enabled in node0 and node1 with BF16 auto mixed precision:"),hl=c(),M(ve.$$.fragment),this.h()},l(e){const f=Fr('[data-svelte="svelte-1phssyn"]',document.head);p=o(f,"META",{name:!0,content:!0}),f.forEach(l),W=h(e),u=o(e,"H1",{class:!0});var ye=r(u);b=o(ye,"A",{id:!0,class:!0,href:!0});var Io=r(b);pt=o(Io,"SPAN",{});var xo=r(pt);E(te.$$.fragment,xo),xo.forEach(l),Io.forEach(l),bl=h(ye),ut=o(ye,"SPAN",{});var ko=r(ut);gl=i(ko,"Efficient Training on Multiple CPUs"),ko.forEach(l),ye.forEach(l),Rt=h(e),ge=o(e,"P",{});var Ao=r(ge);Ml=i(Ao,"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."),Ao.forEach(l),Dt=h(e),L=o(e,"H2",{class:!0});var dl=r(L);V=o(dl,"A",{id:!0,class:!0,href:!0});var jo=r(V);mt=o(jo,"SPAN",{});var No=r(mt);E(le.$$.fragment,No),No.forEach(l),jo.forEach(l),El=h(dl),_t=o(dl,"SPAN",{});var Ro=r(_t);Ul=i(Ro,"Intel\xAE oneCCL Bindings for PyTorch"),Ro.forEach(l),dl.forEach(l),Xt=h(e),N=o(e,"P",{});var be=r(N);ne=o(be,"A",{href:!0,rel:!0});var Do=r(ne);Cl=i(Do,"Intel\xAE oneCCL"),Do.forEach(l),Pl=i(be," (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(be,"A",{href:!0,rel:!0});var Xo=r(oe);Jl=i(Xo,"oneCCL documentation"),Xo.forEach(l),$l=i(be," and "),re=o(be,"A",{href:!0,rel:!0});var Lo=r(re);Il=i(Lo,"oneCCL specification"),Lo.forEach(l),xl=i(be,"."),be.forEach(l),Lt=h(e),R=o(e,"P",{});var ct=r(R);kl=i(ct,"Module "),wt=o(ct,"CODE",{});var Bo=r(wt);Al=i(Bo,"oneccl_bindings_for_pytorch"),Bo.forEach(l),jl=i(ct," ("),Tt=o(ct,"CODE",{});var So=r(Tt);Nl=i(So,"torch_ccl"),So.forEach(l),Rl=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(l),Bt=h(e),H=o(e,"P",{});var pl=r(H);Dl=i(pl,"Check more detailed information for "),ae=o(pl,"A",{href:!0,rel:!0});var Go=r(ae);Xl=i(Go,"oneccl_bind_pt"),Go.forEach(l),Ll=i(pl,"."),pl.forEach(l),St=h(e),B=o(e,"H3",{class:!0});var ul=r(B);Y=o(ul,"A",{id:!0,class:!0,href:!0});var Zo=r(Y);vt=o(Zo,"SPAN",{});var Wo=r(vt);E(ie.$$.fragment,Wo),Wo.forEach(l),Zo.forEach(l),Bl=h(ul),yt=o(ul,"SPAN",{});var Vo=r(yt);Sl=i(Vo,"Intel\xAE oneCCL Bindings for PyTorch installation:"),Vo.forEach(l),ul.forEach(l),Gt=h(e),Me=o(e,"P",{});var Ho=r(Me);Gl=i(Ho,"Wheel files are available for the following Python versions:"),Ho.forEach(l),Zt=h(e),Q=o(e,"TABLE",{});var ml=r(Q);bt=o(ml,"THEAD",{});var Yo=r(bt);m=o(Yo,"TR",{});var $=r(m);Ee=o($,"TH",{align:!0});var Qo=r(Ee);Zl=i(Qo,"Extension Version"),Qo.forEach(l),Wl=h($),Ue=o($,"TH",{align:!0});var Fo=r(Ue);Vl=i(Fo,"Python 3.6"),Fo.forEach(l),Hl=h($),Ce=o($,"TH",{align:!0});var zo=r(Ce);Yl=i(zo,"Python 3.7"),zo.forEach(l),Ql=h($),Pe=o($,"TH",{align:!0});var Oo=r(Pe);Fl=i(Oo,"Python 3.8"),Oo.forEach(l),zl=h($),Je=o($,"TH",{align:!0});var qo=r(Je);Ol=i(qo,"Python 3.9"),qo.forEach(l),ql=h($),$e=o($,"TH",{align:!0});var Ko=r($e);Kl=i(Ko,"Python 3.10"),Ko.forEach(l),$.forEach(l),Yo.forEach(l),en=h(ml),g=o(ml,"TBODY",{});var X=r(g);_=o(X,"TR",{});var I=r(_);Ie=o(I,"TD",{align:!0});var er=r(Ie);tn=i(er,"1.13.0"),er.forEach(l),ln=h(I),gt=o(I,"TD",{align:!0}),r(gt).forEach(l),nn=h(I),xe=o(I,"TD",{align:!0});var tr=r(xe);on=i(tr,"\u221A"),tr.forEach(l),rn=h(I),ke=o(I,"TD",{align:!0});var lr=r(ke);an=i(lr,"\u221A"),lr.forEach(l),sn=h(I),Ae=o(I,"TD",{align:!0});var nr=r(Ae);cn=i(nr,"\u221A"),nr.forEach(l),hn=h(I),je=o(I,"TD",{align:!0});var or=r(je);fn=i(or,"\u221A"),or.forEach(l),I.forEach(l),dn=h(X),w=o(X,"TR",{});var x=r(w);Ne=o(x,"TD",{align:!0});var rr=r(Ne);pn=i(rr,"1.12.100"),rr.forEach(l),un=h(x),Mt=o(x,"TD",{align:!0}),r(Mt).forEach(l),mn=h(x),Re=o(x,"TD",{align:!0});var ar=r(Re);_n=i(ar,"\u221A"),ar.forEach(l),wn=h(x),De=o(x,"TD",{align:!0});var ir=r(De);Tn=i(ir,"\u221A"),ir.forEach(l),vn=h(x),Xe=o(x,"TD",{align:!0});var sr=r(Xe);yn=i(sr,"\u221A"),sr.forEach(l),bn=h(x),Le=o(x,"TD",{align:!0});var cr=r(Le);gn=i(cr,"\u221A"),cr.forEach(l),x.forEach(l),Mn=h(X),T=o(X,"TR",{});var k=r(T);Be=o(k,"TD",{align:!0});var hr=r(Be);En=i(hr,"1.12.0"),hr.forEach(l),Un=h(k),Et=o(k,"TD",{align:!0}),r(Et).forEach(l),Cn=h(k),Se=o(k,"TD",{align:!0});var fr=r(Se);Pn=i(fr,"\u221A"),fr.forEach(l),Jn=h(k),Ge=o(k,"TD",{align:!0});var dr=r(Ge);$n=i(dr,"\u221A"),dr.forEach(l),In=h(k),Ze=o(k,"TD",{align:!0});var pr=r(Ze);xn=i(pr,"\u221A"),pr.forEach(l),kn=h(k),We=o(k,"TD",{align:!0});var ur=r(We);An=i(ur,"\u221A"),ur.forEach(l),k.forEach(l),jn=h(X),v=o(X,"TR",{});var A=r(v);Ve=o(A,"TD",{align:!0});var mr=r(Ve);Nn=i(mr,"1.11.0"),mr.forEach(l),Rn=h(A),Ut=o(A,"TD",{align:!0}),r(Ut).forEach(l),Dn=h(A),He=o(A,"TD",{align:!0});var _r=r(He);Xn=i(_r,"\u221A"),_r.forEach(l),Ln=h(A),Ye=o(A,"TD",{align:!0});var wr=r(Ye);Bn=i(wr,"\u221A"),wr.forEach(l),Sn=h(A),Qe=o(A,"TD",{align:!0});var Tr=r(Qe);Gn=i(Tr,"\u221A"),Tr.forEach(l),Zn=h(A),Fe=o(A,"TD",{align:!0});var vr=r(Fe);Wn=i(vr,"\u221A"),vr.forEach(l),A.forEach(l),Vn=h(X),y=o(X,"TR",{});var j=r(y);ze=o(j,"TD",{align:!0});var yr=r(ze);Hn=i(yr,"1.10.0"),yr.forEach(l),Yn=h(j),Oe=o(j,"TD",{align:!0});var br=r(Oe);Qn=i(br,"\u221A"),br.forEach(l),Fn=h(j),qe=o(j,"TD",{align:!0});var gr=r(qe);zn=i(gr,"\u221A"),gr.forEach(l),On=h(j),Ke=o(j,"TD",{align:!0});var Mr=r(Ke);qn=i(Mr,"\u221A"),Mr.forEach(l),Kn=h(j),et=o(j,"TD",{align:!0});var Er=r(et);eo=i(Er,"\u221A"),Er.forEach(l),to=h(j),Ct=o(j,"TD",{align:!0}),r(Ct).forEach(l),j.forEach(l),X.forEach(l),ml.forEach(l),Wt=h(e),E(se.$$.fragment,e),Vt=h(e),D=o(e,"P",{});var ht=r(D);lo=i(ht,"where "),Pt=o(ht,"CODE",{});var Ur=r(Pt);no=i(Ur,"{pytorch_version}"),Ur.forEach(l),oo=i(ht,` should be your PyTorch version, for instance 1.13.0.
Check more approaches for `),ce=o(ht,"A",{href:!0,rel:!0});var Cr=r(ce);ro=i(Cr,"oneccl_bind_pt installation"),Cr.forEach(l),ao=i(ht,`.
Versions of oneCCL and PyTorch must match.`),ht.forEach(l),Ht=h(e),E(F.$$.fragment,e),Yt=h(e),S=o(e,"H2",{class:!0});var _l=r(S);z=o(_l,"A",{id:!0,class:!0,href:!0});var Pr=r(z);Jt=o(Pr,"SPAN",{});var Jr=r(Jt);E(he.$$.fragment,Jr),Jr.forEach(l),Pr.forEach(l),io=h(_l),$t=o(_l,"SPAN",{});var $r=r($t);so=i($r,"Intel\xAE MPI library"),$r.forEach(l),_l.forEach(l),Qt=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 Ir=r(tt);co=i(Ir,"oneccl_bindings_for_pytorch is installed along with the MPI tool set. Need to source the environment before using it."),Ir.forEach(l),Ft=h(e),lt=o(e,"P",{});var xr=r(lt);ho=i(xr,"for Intel\xAE oneCCL >= 1.12.0"),xr.forEach(l),zt=h(e),E(fe.$$.fragment,e),Ot=h(e),nt=o(e,"P",{});var kr=r(nt);fo=i(kr,"for Intel\xAE oneCCL whose version < 1.12.0"),kr.forEach(l),qt=h(e),E(de.$$.fragment,e),Kt=h(e),G=o(e,"H4",{class:!0});var wl=r(G);O=o(wl,"A",{id:!0,class:!0,href:!0});var Ar=r(O);It=o(Ar,"SPAN",{});var jr=r(It);E(pe.$$.fragment,jr),jr.forEach(l),Ar.forEach(l),po=h(wl),xt=o(wl,"SPAN",{});var Nr=r(xt);uo=i(Nr,"IPEX installation:"),Nr.forEach(l),wl.forEach(l),el=h(e),q=o(e,"P",{});var Tl=r(q);mo=i(Tl,"IPEX provides performance optimizations for CPU training with both Float32 and BFloat16, you could refer "),ot=o(Tl,"A",{href:!0});var Rr=r(ot);_o=i(Rr,"single CPU section"),Rr.forEach(l),wo=i(Tl,"."),Tl.forEach(l),tl=h(e),rt=o(e,"P",{});var Dr=r(rt);To=i(Dr,"The following \u201CUsage in Trainer\u201D takes mpirun in Intel\xAE MPI library as an example."),Dr.forEach(l),ll=h(e),Z=o(e,"H2",{class:!0});var vl=r(Z);K=o(vl,"A",{id:!0,class:!0,href:!0});var Xr=r(K);kt=o(Xr,"SPAN",{});var Lr=r(kt);E(ue.$$.fragment,Lr),Lr.forEach(l),Xr.forEach(l),vo=h(vl),At=o(vl,"SPAN",{});var Br=r(At);yo=i(Br,"Usage in Trainer"),Br.forEach(l),vl.forEach(l),nl=i(e,`

To enable multi CPU distributed training in the Trainer with the ccl backend, users should add **\`--ddp_backend ccl\`** in the command arguments.
`),me=o(e,"P",{});var $o=r(me);bo=i($o,"Let\u2019s see an example with the "),_e=o($o,"A",{href:!0,rel:!0});var Sr=r(_e);go=i(Sr,"question-answering example"),Sr.forEach(l),$o.forEach(l),ol=h(e),at=o(e,"P",{});var Gr=r(at);Mo=i(Gr,"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."),Gr.forEach(l),rl=h(e),E(we.$$.fragment,e),al=h(e),it=o(e,"P",{});var Zr=r(it);Eo=i(Zr,"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."),Zr.forEach(l),il=h(e),st=o(e,"P",{});var Wr=r(st);Uo=i(Wr,"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."),Wr.forEach(l),sl=h(e),E(Te.$$.fragment,e),cl=h(e),ee=o(e,"P",{});var yl=r(ee);Co=i(yl,"Now, run the following command in node0 and "),jt=o(yl,"STRONG",{});var Vr=r(jt);Po=i(Vr,"4DDP"),Vr.forEach(l),Jo=i(yl," will be enabled in node0 and node1 with BF16 auto mixed precision:"),yl.forEach(l),hl=h(e),E(ve.$$.fragment,e),this.h()},h(){s(p,"name","hf:doc:metadata"),s(p,"content",JSON.stringify(ea)),s(b,"id","efficient-training-on-multiple-cpus"),s(b,"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(b,"href","#efficient-training-on-multiple-cpus"),s(u,"class","relative group"),s(V,"id","intel-oneccl-bindings-for-pytorch"),s(V,"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(V,"href","#intel-oneccl-bindings-for-pytorch"),s(L,"class","relative group"),s(ne,"href","https://github.com/oneapi-src/oneCCL"),s(ne,"rel","nofollow"),s(oe,"href","https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html"),s(oe,"rel","nofollow"),s(re,"href","https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html"),s(re,"rel","nofollow"),s(ae,"href","https://github.com/intel/torch-ccl"),s(ae,"rel","nofollow"),s(Y,"id","intel-oneccl-bindings-for-pytorch-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","#intel-oneccl-bindings-for-pytorch-installation"),s(B,"class","relative group"),s(Ee,"align","center"),s(Ue,"align","center"),s(Ce,"align","center"),s(Pe,"align","center"),s(Je,"align","center"),s($e,"align","center"),s(Ie,"align","center"),s(gt,"align","center"),s(xe,"align","center"),s(ke,"align","center"),s(Ae,"align","center"),s(je,"align","center"),s(Ne,"align","center"),s(Mt,"align","center"),s(Re,"align","center"),s(De,"align","center"),s(Xe,"align","center"),s(Le,"align","center"),s(Be,"align","center"),s(Et,"align","center"),s(Se,"align","center"),s(Ge,"align","center"),s(Ze,"align","center"),s(We,"align","center"),s(Ve,"align","center"),s(Ut,"align","center"),s(He,"align","center"),s(Ye,"align","center"),s(Qe,"align","center"),s(Fe,"align","center"),s(ze,"align","center"),s(Oe,"align","center"),s(qe,"align","center"),s(Ke,"align","center"),s(et,"align","center"),s(Ct,"align","center"),s(ce,"href","https://github.com/intel/torch-ccl"),s(ce,"rel","nofollow"),s(z,"id","intel-mpi-library"),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-mpi-library"),s(S,"class","relative group"),s(O,"id","ipex-installation"),s(O,"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(O,"href","#ipex-installation"),s(G,"class","relative group"),s(ot,"href","./perf_train_cpu"),s(K,"id","usage-in-trainer"),s(K,"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(K,"href","#usage-in-trainer"),s(Z,"class","relative group"),s(_e,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering"),s(_e,"rel","nofollow")},m(e,f){t(document.head,p),d(e,W,f),d(e,u,f),t(u,b),t(b,pt),U(te,pt,null),t(u,bl),t(u,ut),t(ut,gl),d(e,Rt,f),d(e,ge,f),t(ge,Ml),d(e,Dt,f),d(e,L,f),t(L,V),t(V,mt),U(le,mt,null),t(L,El),t(L,_t),t(_t,Ul),d(e,Xt,f),d(e,N,f),t(N,ne),t(ne,Cl),t(N,Pl),t(N,oe),t(oe,Jl),t(N,$l),t(N,re),t(re,Il),t(N,xl),d(e,Lt,f),d(e,R,f),t(R,kl),t(R,wt),t(wt,Al),t(R,jl),t(R,Tt),t(Tt,Nl),t(R,Rl),d(e,Bt,f),d(e,H,f),t(H,Dl),t(H,ae),t(ae,Xl),t(H,Ll),d(e,St,f),d(e,B,f),t(B,Y),t(Y,vt),U(ie,vt,null),t(B,Bl),t(B,yt),t(yt,Sl),d(e,Gt,f),d(e,Me,f),t(Me,Gl),d(e,Zt,f),d(e,Q,f),t(Q,bt),t(bt,m),t(m,Ee),t(Ee,Zl),t(m,Wl),t(m,Ue),t(Ue,Vl),t(m,Hl),t(m,Ce),t(Ce,Yl),t(m,Ql),t(m,Pe),t(Pe,Fl),t(m,zl),t(m,Je),t(Je,Ol),t(m,ql),t(m,$e),t($e,Kl),t(Q,en),t(Q,g),t(g,_),t(_,Ie),t(Ie,tn),t(_,ln),t(_,gt),t(_,nn),t(_,xe),t(xe,on),t(_,rn),t(_,ke),t(ke,an),t(_,sn),t(_,Ae),t(Ae,cn),t(_,hn),t(_,je),t(je,fn),t(g,dn),t(g,w),t(w,Ne),t(Ne,pn),t(w,un),t(w,Mt),t(w,mn),t(w,Re),t(Re,_n),t(w,wn),t(w,De),t(De,Tn),t(w,vn),t(w,Xe),t(Xe,yn),t(w,bn),t(w,Le),t(Le,gn),t(g,Mn),t(g,T),t(T,Be),t(Be,En),t(T,Un),t(T,Et),t(T,Cn),t(T,Se),t(Se,Pn),t(T,Jn),t(T,Ge),t(Ge,$n),t(T,In),t(T,Ze),t(Ze,xn),t(T,kn),t(T,We),t(We,An),t(g,jn),t(g,v),t(v,Ve),t(Ve,Nn),t(v,Rn),t(v,Ut),t(v,Dn),t(v,He),t(He,Xn),t(v,Ln),t(v,Ye),t(Ye,Bn),t(v,Sn),t(v,Qe),t(Qe,Gn),t(v,Zn),t(v,Fe),t(Fe,Wn),t(g,Vn),t(g,y),t(y,ze),t(ze,Hn),t(y,Yn),t(y,Oe),t(Oe,Qn),t(y,Fn),t(y,qe),t(qe,zn),t(y,On),t(y,Ke),t(Ke,qn),t(y,Kn),t(y,et),t(et,eo),t(y,to),t(y,Ct),d(e,Wt,f),U(se,e,f),d(e,Vt,f),d(e,D,f),t(D,lo),t(D,Pt),t(Pt,no),t(D,oo),t(D,ce),t(ce,ro),t(D,ao),d(e,Ht,f),U(F,e,f),d(e,Yt,f),d(e,S,f),t(S,z),t(z,Jt),U(he,Jt,null),t(S,io),t(S,$t),t($t,so),d(e,Qt,f),d(e,tt,f),t(tt,co),d(e,Ft,f),d(e,lt,f),t(lt,ho),d(e,zt,f),U(fe,e,f),d(e,Ot,f),d(e,nt,f),t(nt,fo),d(e,qt,f),U(de,e,f),d(e,Kt,f),d(e,G,f),t(G,O),t(O,It),U(pe,It,null),t(G,po),t(G,xt),t(xt,uo),d(e,el,f),d(e,q,f),t(q,mo),t(q,ot),t(ot,_o),t(q,wo),d(e,tl,f),d(e,rt,f),t(rt,To),d(e,ll,f),d(e,Z,f),t(Z,K),t(K,kt),U(ue,kt,null),t(Z,vo),t(Z,At),t(At,yo),d(e,nl,f),d(e,me,f),t(me,bo),t(me,_e),t(_e,go),d(e,ol,f),d(e,at,f),t(at,Mo),d(e,rl,f),U(we,e,f),d(e,al,f),d(e,it,f),t(it,Eo),d(e,il,f),d(e,st,f),t(st,Uo),d(e,sl,f),U(Te,e,f),d(e,cl,f),d(e,ee,f),t(ee,Co),t(ee,jt),t(jt,Po),t(ee,Jo),d(e,hl,f),U(ve,e,f),fl=!0},p(e,[f]){const ye={};f&2&&(ye.$$scope={dirty:f,ctx:e}),F.$set(ye)},i(e){fl||(C(te.$$.fragment,e),C(le.$$.fragment,e),C(ie.$$.fragment,e),C(se.$$.fragment,e),C(F.$$.fragment,e),C(he.$$.fragment,e),C(fe.$$.fragment,e),C(de.$$.fragment,e),C(pe.$$.fragment,e),C(ue.$$.fragment,e),C(we.$$.fragment,e),C(Te.$$.fragment,e),C(ve.$$.fragment,e),fl=!0)},o(e){P(te.$$.fragment,e),P(le.$$.fragment,e),P(ie.$$.fragment,e),P(se.$$.fragment,e),P(F.$$.fragment,e),P(he.$$.fragment,e),P(fe.$$.fragment,e),P(de.$$.fragment,e),P(pe.$$.fragment,e),P(ue.$$.fragment,e),P(we.$$.fragment,e),P(Te.$$.fragment,e),P(ve.$$.fragment,e),fl=!1},d(e){l(p),e&&l(W),e&&l(u),J(te),e&&l(Rt),e&&l(ge),e&&l(Dt),e&&l(L),J(le),e&&l(Xt),e&&l(N),e&&l(Lt),e&&l(R),e&&l(Bt),e&&l(H),e&&l(St),e&&l(B),J(ie),e&&l(Gt),e&&l(Me),e&&l(Zt),e&&l(Q),e&&l(Wt),J(se,e),e&&l(Vt),e&&l(D),e&&l(Ht),J(F,e),e&&l(Yt),e&&l(S),J(he),e&&l(Qt),e&&l(tt),e&&l(Ft),e&&l(lt),e&&l(zt),J(fe,e),e&&l(Ot),e&&l(nt),e&&l(qt),J(de,e),e&&l(Kt),e&&l(G),J(pe),e&&l(el),e&&l(q),e&&l(tl),e&&l(rt),e&&l(ll),e&&l(Z),J(ue),e&&l(nl),e&&l(me),e&&l(ol),e&&l(at),e&&l(rl),J(we,e),e&&l(al),e&&l(it),e&&l(il),e&&l(st),e&&l(sl),J(Te,e),e&&l(cl),e&&l(ee),e&&l(hl),J(ve,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(Nt){return zr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class aa extends Hr{constructor(p){super();Yr(this,p,ta,Kr,Qr,{})}}export{aa as default,ea as metadata};
