在linu虛擬機(jī)中配置多節(jié)點(diǎn)MPI_第1頁(yè)
在linu虛擬機(jī)中配置多節(jié)點(diǎn)MPI_第2頁(yè)
在linu虛擬機(jī)中配置多節(jié)點(diǎn)MPI_第3頁(yè)
在linu虛擬機(jī)中配置多節(jié)點(diǎn)MPI_第4頁(yè)
在linu虛擬機(jī)中配置多節(jié)點(diǎn)MPI_第5頁(yè)
已閱讀5頁(yè),還剩10頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

計(jì)算機(jī)科學(xué)與技術(shù)系實(shí)驗(yàn)報(bào)告課程名稱:并行計(jì)算及編程實(shí)驗(yàn)項(xiàng)目:在linux虛擬機(jī)中配置多節(jié)點(diǎn)MPI專業(yè)班級(jí):姓 名:學(xué) 號(hào):實(shí)驗(yàn)時(shí)間:批閱時(shí)間:指導(dǎo)教師:成績(jī):蘭州交通大學(xué)《并行計(jì)算及編程》課程實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)名稱:在linux虛擬機(jī)中配置多節(jié)點(diǎn)MPI一、 實(shí)驗(yàn)?zāi)康脑趌inux虛擬機(jī)中配置多節(jié)點(diǎn)MPI,完成以下任務(wù)(2選1):1、 矩陣-向量乘法;2、 數(shù)據(jù)積分法求圓周率n二、 實(shí)驗(yàn)內(nèi)容(1) 分別用串行程序和MPI并行程序?qū)崿F(xiàn)(2) 比較并行和串行程序的執(zhí)行時(shí)間(3) 計(jì)算并行程序相對(duì)于串行程序的加速比三、 實(shí)驗(yàn)環(huán)境Windows10,CentOS四、實(shí)驗(yàn)過(guò)程(包括程序設(shè)計(jì)說(shuō)明,實(shí)驗(yàn)步驟,經(jīng)調(diào)試后正確的源程序,程序運(yùn)行結(jié)果)圖1下載安裝VMwareWorkstation②下載并安裝Linux系統(tǒng),這里我用的是CentOS,我開了兩臺(tái)虛擬機(jī),centos6和centos664。保證臺(tái)虛擬機(jī)都可以上網(wǎng),且可以ping通。我的兩個(gè)虛擬機(jī)的網(wǎng)絡(luò)地址分別是28和29mil■*!!wtanr- -xtwi ||-耳3JlA3口爲(wèi);卞PCI-圖2保證都可上網(wǎng)[jiangshanshan@node2童面]$su密碼:[raaWnodeZ莫面]#useraddmpiuser[root@nade2桌面]#passwdnopiuser更改用戶mpiuser的密碼。新的密碼;重新輸入新的密碼:passwd:所荷的身份驗(yàn)證今牌己經(jīng)成功更新。[roaWnode2桌面]#■圖8記住要設(shè)置密碼才可使用圖10此時(shí)在第一臺(tái)虛擬機(jī)中ping第二臺(tái)依舊可以ping通④保障兩臺(tái)虛擬機(jī)是互通的圖10此時(shí)在第一臺(tái)虛擬機(jī)中ping第二臺(tái)依舊可以ping通④保障兩臺(tái)虛擬機(jī)是互通的圖9設(shè)置成功CeritOS69[mpiusertanodelDesktop]$ping29PING192.1&8.2^.129(29J5&{84}bytesofdata.64bytesfrom29:icmp_seq=lttl=64time=0.331ms64bytesfrom29:icmp_seq=2ttl=64time=0.88^1ms64bytesfrom29:icmp_seq=3ttl=fi4time=2.09msi_i14hosts驚localhostlocalhost.localdomainiocalhost4localhost4.Iocald0[nain4::1 localhostlocalhost.localdomainLocalhostGlocalhoste.localdomainGnodelnode2|圖11dns域名⑤實(shí)現(xiàn)免密碼SSH登陸,當(dāng)前節(jié)點(diǎn)為nodel,用戶為mpiuser,工作目錄為?家目錄[mpiuser@node2Desktop]$scpnodel:-/.ssh/*./mpiusertanodel'spassword:100^3930.4KB/S00:0Q100^16751.6KB/509:003950.4KB/S100%4023.4KB/S00:00authorLzed_lte/sid_rsaid_rsaLpcbknown_hosts[mpiusenanode2Desktop]$|圖16scpnode1:~/.ssh/*./拷貝nodel上的.ssh文件夾到node2[mpiuser@node2Desktop]$suPassword:[root迫Desktop]#scpnodel:/etc/卜oets/mtc/hosTheauthenticityofhost'nodel(281'can'tbeestablished.RSAkeyfingerprintisc7:9a:f2:el:e6:78:el:3b:d9:cc:6c:5f:8a:13:bf:6a.Areyousureyouwanttocontinu亡connecting(ye5/nol?yesWarning:Permanentlyadded"nodel,28'(RSA)toth已listofknownhosts.rootfanodel'spassword:hosts 100%20S 0.2KB/S 00:00[root@node2Desktop]#|圖17設(shè)置node2拷貝nodel上的hosts文件到node2[mpiuser@node2Desktop]$sshnode2rpiuseri(anode2'spassword:Lastlogin:SatJun2015:21:242020fromnode2[mpiuseri(anode2-]$sshnodelmpiusenanodel'spassword:Lastlogin:ThuJun2510:03:442020fromnodel[mpiusenanodel~]$|圖18sshnodesshnodel遇到問(wèn)題 :node2的ssh連接我好像是還沒(méi)有設(shè)置好,依舊需要密碼連接才可以。⑥配置MPI運(yùn)行環(huán)境官方網(wǎng)站下載其中的mpich-3.2.tar.gz此處遇到問(wèn)題,在下載時(shí):[sudo]p日sswo「dformpiuser:mpiuserisnotinthesudaersfile.Thisincidentwillbereported.圖19遇到問(wèn)題:該問(wèn)題在嵌入式作業(yè)中同樣出現(xiàn)過(guò),但我在改時(shí),遇到了gedit的命令問(wèn)題,實(shí)在是解決不了。我用共享內(nèi)存的方式在windows中下載好,放在共享文件中。最開始使用的是rar文件,但Linux中需要安裝RARforLinux,我就直接在共享文件中解壓了。圖20共享文件然后安裝時(shí)又發(fā)現(xiàn)又各種問(wèn)題,之后我又再次在官網(wǎng)下載了(之前一直中途失敗,具體原因不明)⑦解壓并進(jìn)入目錄亠mpkh-332.tergz一卜■limleft一14.S播 MEl“24KBrsec;-■i. mpich"3_3=2?t3rgiI■F血ShawAll□Dwrlwck圖21官網(wǎng)下載好mpiuser@nodel:/home/mpiuser/DownloadsFileEditViewSearchTerminalHelpmpich-3.3.2/已xamples/pmande'L_fence.cmpich-3.3.2/已xamples/argobots/mpich-3.3.2/examples/argob0ts/sendrecv_u'Lt.(mpich-3.3.2/examples/hel'Low.cmpich-3.3.2/examples/srtest.cmpich-3.3.2/examples/develop已「5/圖22解壓tarxvfmpich-3.2.tar.gzmpiuser@rodel:/home/mpLuser/Downloads/mpich-3.3.2FileEdizViewSearchTerminalHelpcheckingforx86cpuid...yescheckingforpthread_niutuX—Lock...yescheckingifpluginsupportisenabled...nochEekingcomponentstobuildstatically...noosxmlsyntheticxm^nolibxnilLinnxlinuxiox86checkingcompon已ntstohuildasplugins...sourcing/homE/niipiii5已「/DownLo日dsfnipich-S.:3.2/s「(7piiv'hyci「BFmpi<:hp「Ei^q圖23cdmpich-3.3.2 ./configureprefix=/usr/local/mpich遇到問(wèn)題:圖23運(yùn)行出錯(cuò)

解決問(wèn)題:圖26解決問(wèn)題:成功!configurationcompleted遇到問(wèn)題.解決問(wèn)題:[root(anode2Desktop]#yuninstallgcc*-y|圖29解決問(wèn)題圖解決問(wèn)題:圖26解決問(wèn)題:成功!configurationcompleted遇到問(wèn)題.解決問(wèn)題:[root(anode2Desktop]#yuninstallgcc*-y|圖29解決問(wèn)題圖30解決問(wèn)題DependencyUpdated:;iUStdC+^.x8S640N.4.7-23.616Complete![root@node2Desktop]^|config.status:creatingcontig.status:creatingconfig.status:creatingconfig.status:creatingconfig.status:已xectitingdepfilescommandsfnnfic?刁1~iie:戸工口門」~1~1nnLibtooLcommands[rootfanodelmpich-3.3.2]#,/co「figii「已-prefix=/usr/local/mpich--disable-fortran|j_|[mpinser(3node2Desktop]tsudoyumin&tallgetLoadedpligins:fastestmirror,refresli-packagekitpsecLrilySettingupInstall卩「ocessLeadingnurrorspeedsfromcachedhosttilebase:mirror.biT.extras:mirror.bit.edL.cn圖28下載GCC編譯器但依舊不可以,所以之后我全部一次安裝好C的編譯器在node2時(shí)用了圖25的命令,但顯示其他錯(cuò)誤:checkingwhetherTRUEhasbeendefined...nocheckingwhethertheCh-+compilerg++canbuildanexecutable...noconfigure:已「「o「:Abortingbecaus已C++compi1已「doesnotwork.IfyoudonotnedaC++compiler,configur已訶ith--disabl已-exx圖27少了C++的編譯器configure:error:NoFortran77compilerfound.Ifyoudon'tneedtobuildaryFortranprograms,youcandisableFortransupportusing--disable-fortrar.IfyoudowanttobuildFortranprograms,youneedtoinstallaFortrancompilersuchasgfortranorifortbeforeyoucanproceed.圖24圖25解決問(wèn)題:將圖23命令改為此命令Makefilelnclude/Maketi.esrc/Hakefiledtpoolsconf.h之后node2的安裝成功!config?,tdtus;executinglibtoalcommandsConfigurationcom卩?[root(anode2mpich-3.3.2]#|[roottanodelmpich-3.3.2]#|圖31解決問(wèn)題cp-psrc/已nv/mpicc.bashsrc/env/mpicccp-psrc/env/mpicxx.bashsrc/env/mpicxxmake[21:Leavingdirectory"/home/mpiuser/Downlaads/mpicn-3.3.2'Hakinqallin已xamplesmake[2]:Enteringdirectory"/home/mpiu5er/DoirtTiloads/[npich-3.3.2/exaiiples'CC cpi.oCCLD cpimake[2]:LeavingdirectoryVhome/mpiuser/Downloads/mpicn-B.3.2/examples1make[1]:Leavingdirectory7h□me/mpiuser/Downlaads/mpicn-3.3.2'Lrootfftnodelmpich-3.3.2]#|圖32make編譯Makinginstallin已xarplesmake'2]:Enteringdirectory"/ho[ne/[iipiuser/Do^riloads/inpich-3.3.2/exairples'make3]:Enteringdirectory"/hoiiie/mpiuser/Dowriloads/mpich-3.3.2/exanrples'make3':Nothingtobedon已fo「'install-ex已make3]:Nothingtobedonefor"install-data-am'.make3]:Leavingdirectory1/home/mpiuser/Dovjnloads/mpich-3.3.2/examples1make2]:L已a(bǔ)wingdirectory/home/mpius已「/Dovjnioads/mpich-3.3.2/examp'Les1make1]:Leavingdirectory1/home/mpiuser/Dovjiiloads/mpich-3.3.2'[rooWnodelmpich-3.3.2]#|圖33makeinstall安裝⑧設(shè)置環(huán)境變量exportPATH=$PATH:/cpt/FriendlyAHM/toolschain/A.4.3/binPATH=$PATH:/usr/local/mpich/binMANPATH=$MANPAIH:/usr/Iocal/mpich/manexportPATHMANPATH|圖34設(shè)置環(huán)境變量~/.bashrc至此MPI安裝完成!⑨mpi多節(jié)點(diǎn)配置[roottanod已].Desktop]#touch/usr/local/mpich/servers[root(3nodelDesktop]#|圖36新建一個(gè)配置文件

潛 servers[Readonly](/usr/local/mpith)-gedlt _□kFileEditViewSearchTtiolsDocumentsHelp「嶺卩沙vsave|uncfo矽|詔喑#4勲[_lservers灘Riedel;2node2:2圖37修改其中內(nèi)容為⑩用示例程序進(jìn)行測(cè)試單節(jié)點(diǎn)測(cè)試:遇到問(wèn)題:FileEditViewSearchTerminalHelp[mpiuserFileEditViewSearchTerminalHelp[mpiuser(anodelexamples]sIsargobotsdevelopers ircpi.cpmandelfence.cspawnmerqechild2.cchild.c已xamples.sinMakefilepmandelservice.cspawnmergeparent.ccpif77Makefile.ampmand已Ispaserv.csrtest.ccpi-cf9DMakefile.inpmandelspawn.ccpi=ohellow.'Cparerr.cREADMEexxicpi.cpmandeL.cspawrmergechildl.c[mpiusertanodelexamples]smpicchellos.c-□helldwbash:mpicc:commandnotfound[mpiuser(anodelexamples]smpirun-np4cpibash:mpirun:commandno:found[mpiuser(arodelexamples]s|圖38出現(xiàn)問(wèn)題遇到問(wèn)題:之后我就去改正環(huán)境變量,然后改錯(cuò)了?。。∥业乃谐?jí)用戶下的linux命令都不可以用了。所以要返回修改在超級(jí)用戶下,用全路徑的方式去修改!/usr/bin/gedit?/.bashreexportPATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/binexportPATH=$PATH:/usr/lacal/mpich/binl;roottanodelexampl已s]#mpicchellow.c-obellow圖39;roottanodelexampl已s]#mpicchellow.c-obellowdevelopersicpi?cpmandel.cexamples.sinircpiBcpmandel_fence.cf77Makefilepmandelservice.clakefile.anpmandel_spaserv.cMakefile.inpmandelspawn.chellow.cparent.cREADMEis5pawn_merge_childl.cspawn_merge_child2,cspawn_m已「gE_pa「已nt.csrtes:.c.roottanodelexamples]#is5pawn_merge_childl.cspawn_merge_child2,cspawn_m已「gE_pa「已nt.csrtes:.cexx[root(an0c!^^xanip^?]#|圖40mpicc命令成功

[root(anodelHelloHelloHelloHelloworldworldworldworldexampl已[root(anodelHelloHelloHelloHelloworldworldworldworldexampl已s]#mpirjn0processprocessprocessprocess[root(anodelfromfromfromfromexamples]#|ofofofof圖41單節(jié)點(diǎn)測(cè)試成功-np表示numberofprocessors,即進(jìn)程數(shù),N自己取值[roottanodelexampl已s]#nipirun-np4./cpiof4is□nnodelof4is□nnodelof斗is□nnod已]_of斗is□nnod已]_ProcessProcessProcessProcesspiisapproximately3.1415926544231239rErroris0.0000000008333307wallclacktime=9.016059[roottanodelexampl已s]#|圖42都在節(jié)點(diǎn)1上[root(anode2exampl已s]#mpirun-np./cpiof4isonnode2of4isonnode2of4isonnode?of4is□nnode2ProcessProcessProcessProc已品piisapproximately3.1415926544231239,Erroris0.0000000008333307wallclocktime=9.019652[rcot@node2examples]#I圖43都在節(jié)點(diǎn)2上多節(jié)點(diǎn)測(cè)試:nodeinode!node2node?nodeinode!node2node?Process2of4isonProcess1of4isonProcess9ofisonpiisapproximately3.1415926544231239,Erroris6.9600063906333397wallclacktime=s.Q19652[rDot@rode2examples-)#|圖44多節(jié)點(diǎn)測(cè)試如上,在兩個(gè)節(jié)點(diǎn)上分別運(yùn)行了兩個(gè)進(jìn)程,配置過(guò)程結(jié)束。實(shí)驗(yàn)結(jié)果:(二)數(shù)據(jù)積分法求圓周率n1.源程序(串行):#includevstdio.h>#includevstdlib.h>#includevtime.h>staticlongnum_steps=10000000;//定義所分的塊數(shù)intmain(intargc,char**argv){inti;doublex,sum=0.0,pi;clock_tstart_time,end_time;start_time=clock();doublestep=1.0/(double)num_steps;for(i=0;i<num_steps;i++){x=(i+0.5)*step;sum=sum+4.0/(1.0+x*x);}pi=step*sum;end_time=clock();printf("Piis%.16f\n",pi);printf("Walltime=%e\n",end_time-start_time);return0;}結(jié)果:[rootOiodelnytestgcc-otest-1test-1,c[root(Biodelrrytestk./test-1Piis3.14159Z6535839708憎丨丨ti(TE=15.ZB2000[root^iodelrrytest圖452.源程序(并行):#includevstdio.h>#includevstdlib.h>#includevmpi.h>staticlongnum_s

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論