Tuesday 4 August 2009

Parallel Computing

Parallel Computing with MPI (Message Passing Interface)

Parallel Computing ဆုိတာ computer program ပုစာၧ(၁)ပုဒ္ကုိ execute လုပ္ရန္ အတြက္ မ်ားစြားေသာ processors အေရတြက္မ်ား တစ္ၿပဳိင္နက္အသုံးျပဳထားၿခင္းလုိ႔ အဓိပၸာယ္ဖြင္႔ဆုိႏုိင္ပါသည္။ ေၿမာက္မ်ားစြာေသာ တြက္ခ်က္မူဆုိင္ရာ ပုစာၧ၊ problem ေတြကုိ တစ္ျပဳိင္နက္ေျဖရွင္းတြက္ခ်က္ေပးႏိုင္တဲ႔ computation form ျဖစ္သလုိ ၾကီးမားေသာတြက္ခ်က္မူဆုိင္ရာ ပရုိဂရမ္၊ ပုစာၧ၊ problem မ်ားကုိလဲ ေသးငယ္ေသာ အစိတ္အပုိင္းအျဖစ္ ခြဲေ၀ စိတ္ပုိင္းျပီး တစ္ျပဳိင္နက္တြက္ခ်က္ေျဖရွင္းေဆာင္ရြက္ေပးႏုိင္တဲ႔ computation form ျဖစ္ပါတယ္။ Parallel computers အမ်ဳိးအစားအေနနဲ႔ (၂) မ်ဳိးရွိပါသည္။ အဲဒီ parallel architectures မ်ားကေတာ႔
- Shared memory multiprocessor
- Distributed memory multicomputer
တုိ႔ျဖစ္ၾကပါသည္။ Parallel architectures အေၾကာင္းကုိ ေအာက္တြင္ ဆက္လက္ေဖာ္ျပထားပါသည္။
က်ေနာ္အခု ေရးသားေဖာ္ျပမည္႔ အေၾကာင္းအရာသည္ processors (၃) လုံးကုိ တစ္ျပဳိင္နက္အသုံးျပဳျပီး computer program ပုစာၧ ျဖစ္ေသာ MPI program ကုိ execute လုပ္ပါမည္။ Execute လုပ္ရာတြင္ processor တစ္လုံးမွ အၿခားတစ္လုံးဆီသုိ႔ data မ်ားကုိ အျပန္အလွန္ ပုိ႔ယူေဆာင္ရြက္သည္။ ထုိသုိ႔ေသာ ပရုိဂရမ္မ်ားကုိ Parallel computing လုပ္ဖုိ႔အတြက္ OS အျဖစ္ Linux OS ကုိအသုံးျပဳထားပါသည္။ ဘာေၾကာင္႔ လဲဆုိေတာ႔ LINUX သည္ multiuser, multitasking and multiprocessing ျဖစ္သည္႔အျပင္ SMP (symmetrical multiprocessing) support ျဖစ္သည္႔အတြက္ Memory management ပါလုပ္ႏုိင္သည္။ C, C++, Pascal, Cobol, Fortran, Delphi, Kylix စသည္႔ programming language မ်ားစြာအတြက္ free ျဖစ္ေသာ library မ်ား utilities မ်ားကုိလဲ support လုပ္ေပးႏုိင္ပါသည္။ Parallel programming Issues ရဲ႕ ရည္မွန္းခ်က္ကေတာ႔ execution time ေတြကုိ reduce လုပ္ဖုိ႔ပါပဲ။ execution time ေတြကေတာ႔

-computation time
-idel time (watiting for data from other processors)
-communication time (time the processors take to send and receive messages) တုိ႔ျဖစ္ၾကပါသည္။
ယခုအခ်ိန္အခါမွာ parallel programs မ်ားကုိ တြက္ခ်က္အေကာင္အထည္ေဖာ္ေဆာင္ရြက္ဖုိ႔အတြက္ various linguistic မ်ားရွိပါသည္။ ထုိသုိ႔ တြက္ခ်က္ေဆာင္ရြက္ဖုိ႔ ရန္ parallel programming model ေတြလုိအပ္ပါသည္။ parallel programming model ဆုိတာကေတာ႔ parallel algorithms ေတြကုိ ေဖာ္ျပဖုိ႔ အတြက္ software technologies ျဖစ္ပါသည္။ special libiary မ်ား ျဖစ္ၾကတဲ႔ ( MPI, PVM and other parallel programming models)၊ ၄င္းတုိ႔ဟာ process ေတြ ကုိ တစ္ျပဳိင္နက္ေဆာင္ရြက္ရာမွာ အျပန္အလွန္ေဆာင္ရြက္ႏုိင္ရန္ ႏွင္႔ Parallel program system ေတြကုိ အဆုံးသတ္ အေကာင္အထည္ေဖာ္ေဆာင္ရြက္ေပးႏုိင္တဲ႔ software technologies မ်ားျဖစ္ၾကပါသည္။ အဲဒါေတြအားလုံးဟာ High level languages ရဲ႕ parallel program systems ေပၚအေၿခခံထားပါသည္။ parallel programming models မ်ားရဲ႕ Libraries ေတြကေတာ႔
• POSIX Threads
• MPI
• SHMEM
• PVM
• TBB
• KAAPI တုိ႔ျဖစ္ၾကပါသည္။
ေဖာ္ျပပါ Libraries မ်ားထဲမွ MPI (Massage passing Interface) ဆုိတဲ႔ Programming model ကုိ Test လုပ္၍ ေရးသားေဖာ္ျပပါမည္။ MPI အေၾကာင္းကုိ ေရးသားမေဖာ္ျပမွီ Advantages of Parallel Programming နဲ႔ Parallel Computer Architectures အေၾကာင္းကုိ အနည္းက်ဥ္းေရးသားလုိက္ပါသည္။ Parallel computing Field သည္ အလြန္က်ယ္ျပန္႔သည္႔ Field ျဖစ္သည္႔အတြက္ က်ေနာ္႔ အေနနဲ႔ လုိအပ္ခ်က္မ်ားစြာရွိႏုိင္ပါေသာေၾကာင္႔ စာဖတ္သူမ်ားအေနနဲ႔ နာလည္မူေပးႏုိင္ပါရန္ ေမတၱာရပ္ခံပါသည္။

Advantages of Parallel Programming ဘာေတြလဲ?
• Need to solve larger problems
o more memory intensive
o more computation
o more data intensive
• Parallel programming provides
o more CPU resources
o more memory resources
o solve problems that were not possible with serial program
o solve problems more quickly

Parallel Computer Architectures ဆုိတာဘာလဲ?
Parallel Computer Architectures အတြက္ အေၿခခံ architectures (၂) မ်ဳိးရွိပါသည္။ Distributed Memory (ex. Compute cluster & pc) ႏွင္႔ Shared Memory Computer တုိ႔ျဖစ္ပါတယ္။ Distributed Memory (ex. Compute cluster) ဆုိသည္မွာ ကြန္ပ်ဴတာမ်ားသည္ အျမဲတမ္း network switch မွတဆင္႔ connect လုပ္ပါသည္၊ data မ်ားသည္ network ကုိေက်ာ္၍ processor (၁)လုံးမွ အၿခား processor (၁)လုံးဆီ data flows လုပ္ပါသည္။
each processor has its own memory addresses and data has to be sent from one processor to another
collection of computers which may be dual or quad-core nodes
each node uses its own local memory
work together to solve a problem
communicate between nodes and cores via messagesnodes are networked together
Shared Memory Computer ဆုိသည္မွာ data မ်ားကုိ ကြန္ပ်ဴတာ (၁)လုံးမွ အၿခားကြန္ပ်ဴတာ (၁)လုံးသုိ႔ ေပးပုိ႔ရန္မလုိပါ။
all processors share the same "memory addresses"
multiple processors
share a global memory space
processors can efficiently exchange/share data
ေနာက္ဆုံး Parallel Computers mixed shared/distributed memory architecture ကေတာ႔ Nodes မ်ားမွာ processor 1 လုံးထက္ပုိ၍ ပါရွိပါတယ္။ Processors ေတြကေတာ႔ dual/quad-core processors မ်ားျဖစ္ၾကပါသည္။
အခုအခ်ိန္အခါမွာ parallel systems ႏွင္႔ instrument (tool) အမ်ဳိးအစားမ်ားျဖစ္တဲ႔ Distributed Memory system (ex. Compute cluster) ႏွင္႔ Shared Memory Computer system ေတြကုိ ဖန္းတီးေဆာင္ရြက္ႏုိင္ဖုိ႔အတြက္ ပုိျပီး အထင္ရွားေက်ာ္ၾကားဆုံးျဖစ္တဲ႔ instrument (tool) မ်ားကေတာ႔ OpenMP ႏွင္႔ MPI တုိ႔ပဲျဖစ္ပါတယ္။ အၿခားေသာ system ႏွင္႔ instrument မ်ားလဲရွိၾကပါေသာ္လည္း ပုိမုိက်ယ္ျပန္႔စြာ အသုံးျပဳတာကေတာ႔ OpenMP ႏွင္႔ MPI တုိ႔ပဲျဖစ္ၾကပါသည္။
MPI ဆုိတာဘာလဲ?
လုိရင္းနဲ႔ အတုိရွင္းဆုံးေျပာရရင္ေတာ႔ MPI ဆုိတာ processes မ်ားကုိ parallel computing လုပ္ဖုိ႔အတြက္ က်ယ္ျပန္႔စြာ အသုံးျပဳတဲ႔ programming နည္းပညာတခုပါ။ Processes ေတြကုိ တစ္ခ်ိန္တည္းတစ္ျပဳိင္တည္း တြက္ခ်က္ေဆာင္ရြက္ေနခ်ိန္အတြင္း Information (send/receive data) ေတြကုိ အျပန္အလွန္ေျပာင္းလဲပုိ႔ေပးတဲ႔ Interface တစ္ခုလုိ႔ အဓိပၸာယ္ ဖြင္႔ဆုိရပါရေစ။ Process တုိင္းဟာ သူ႔ရဲ႕ own local variables ေတြရွိၾကတယ္။ MPI သည္ parallel programs ေတြကုိ create လုပ္ဖုိ႔ ႏွင္႔ distributed memory Architecture (clusters or pc) ျဖင္႔လုပ္ထားေသာ computing(computer)systems မ်ားအတြက္ က်ယ္ျပန္႔စြာဖန္းတီး အသုံးျပဳဖုိ႔ျဖစ္ပါသည္။ Distributed memory ဆုိတာဘာလဲ? Distributed memory computer အေၾကာင္းကုိ အထက္မွာ ေဖာ္ျပခဲ႔ ျပီးျဖစ္ပါသည္။ MPI program ေရးသားဖုိ႔အတြက္ (support) အေထာက္အကူျပဳတဲ႔ library of functions ကေတာ႔ (C/C++) သု႔ိမဟုတ္ subroutines (Fortran) programming languages တုိ႔ျဖစ္ပါတယ္။

ဘာေၾကာင္႔ MPI ကုိ Parallel computing အတြက္အသုံးျပဳတာလဲ?
MPI သည္ parallel programs ေတြကုိ express လုပ္ဖုိ႔အတြက္
 Powerful
 Efficient
 Portable way
မ်ားကုိ provides လုပ္ေပးေသာေၾကာင္႔ အသုံးျပဳၿခင္းျဖစ္ပါသည္။


MPI program Testing လုပ္ဖုိ႔အတြက္ျပင္ဆင္ၿခင္း။
Distributed Memory Computer Architecture System ကုိအသုံးျပဳ တြက္ခ်က္ေဆာင္ရြက္မွာ ျဖစ္သည္႔အတြက္ က်ေနာ္တုိ႔ အေနနဲ႔ ကြန္ပ်ဴတာအေရအတြက္သည္ (၁)လုံးႏွင္႔ အထက္တြင္သာရွိရပါမည္။ သုိ႔ျဖစ္ပါ၍ က်ေနာ္႔ အေနနဲ႔ (PC-1) P-4 3.2Ghz ၊ (PC-2) P-4 3.0Ghz ၊ (PC-3) P-4 3.2Ghz ဆုိျပီး ကြန္ပ်ဴတာ (၃)လုံးကုိ ေရြးခ်ယ္လုိက္ပါသည္။ ေရြးခ်ယ္ထားေသာ ကြန္ပ်ဴတာ (၃)လုံးကုိ ခ်ိတ္ဆက္ျပီး MPI program ကုိ parallel ေျဖရွင္းတြက္ခ်က္မွာ ျဖစ္ပါတယ္။ Local (LAN) အတြင္းမွာ တြက္ခ်က္မူေတြ ေဆာင္ရႊက္ ျပဳလုပ္မွာ ျဖစ္လုိ႔ Switch တစ္လုံး ႏွင္႔ RJ45 cable မ်ားလဲလုိအပ္ပါသည္။ ခ်ိတ္ဆက္ေျဖရွင္းေဆာင္ရြက္မည္႔ ကြန္ပ်ဴတာမ်ားတြင္ users မ်ားအေနနဲ႔ အင္တာနက္ပါ အသုံးျပဳခ်င္တယ္ဆုိရင္ေတာ႔ အင္တာနက္ရတဲ႔ ကြန္ပ်ဴတာ (၁) လုံးမွ bulid in ပါလာခဲ့တဲ့ NIC (NETWORK INTERFACE CARD) ကဒ္အျပင္ ေနာက္ထပ္ NIC တစ္ကဒ္ ထပ္ၿပီးတပ္လုိက္ပါ။ Straight-through Cable မ်ားနဲ႔ NIC to Switch - Switch to Computer - Computer to Switch ခ်ိတ္ဆက္ၿခင္းျဖင္႔ အင္တာနက္ကုိ Sharing လုပ္ျပီးအသုံးျပဳႏုိင္ပါသည္။ က်ေနာ္တုိ႔ ေရြးခ်ယ္ထားေသာ ကြန္ပ်ဴတာမ်ားတြင္ OS အျဖစ္ Linux Fedora ကုိ Installation လုပ္ထားပါသည္။ စာဖတ္သူမ်ား အေနနဲ႔ Operating System “Linux” ရဲ႕ file structure တည္ေဆာက္ပုံ ၊ command line interface မွာ အသုံးျပဳတဲ႔ command မ်ားနဲ႔ shell script မ်ား ေရးသားပုံေတြကုိ အကြၽမ္းတ၀င္ ရင္းႏွီးေနမယ္ဆုိရင္ အခု က်ေနာ္တုိ႔ test လုပ္မယ္႔ အေၾကာင္းအရာကုိ အလြယ္တကူ နားလည္ႏုိင္ပါသည္။ ရင္းႏွီးကြၽမ္း၀င္မူမရွိေသာ စာဖတ္သူမ်ားကုိလဲ က်ေနာ္႔ အေနနဲ႔ အတတ္ႏုိင္ဆုံးနားလည္ႏုိင္ေအာင္ capture pic ေလးေတြနဲ႔ ေဖာ္ျပေပးထားပါသည္။ က်ေနာ္႔ အေနနဲ႔ test လုပ္ရာမွာ အသုံးျပဳသြားတဲ႔ commands မ်ားကုိ detail မရွင္းျပေတာ႔ပါဘူး။ အဆင္႔တုိင္းတြင္ အားလုံး နားလည္ႏုိင္ေအာင္ ေရးသားထားပါသည္။
၁။ ပထမဆုံး အဆင္႔ေနနဲ႔ က်ေနာ္တုိ႔ MPI program ကုိ Install လုပ္ပါမယ္။ Linux ဧ။္ source code တြင္ rpm, dpkg, tar, tgz စသည္တုိ႔မွ တဆင္႔ compilation လုပ္သည္ကုိ သိရွိျပီးျဖစ္ရပါမည္။ /usr/local/ ထဲမွာ MPI program ကုိ install လုပ္မွာ ျဖစ္တဲ႔အတြက္ mkdir MPI ဆုိျပီး directory (floder) ေလးတခု ဖန္းတီးထားပါတယ္။ /home/moelwin/Desktop/MPI_pack ထဲက mpich-1.2.7.tar.gz ကုိ MPI ဆုိတဲ႔ က်ေနာ္တုိ႔ create လုပ္ထားတဲ႔ directory ထဲ copy လုပ္လုိက္ပါတယ္။ Copy လုပ္ထားေသာ package ကုိ command tar (Tape archive format) ကုိအသုံးျပဳျပီး –zxvof (option) ျဖင္႔ unzip လုပ္လုိက္ပါသည္။ ( As knowledge-> tar format ေတာ္ေတာ္မ်ားမ်ားတြင္ source code မ်ားပါလာတတ္ျပီး မိမိစက္ေပၚတြင္ျပန္ျပီး compile လုပ္ေပးရပါသည္။ သုိ႔မွသာ execute လုပ္ႏုိင္သည္႔ binary file ထြက္လာမည္ ျဖစ္သည္။ source code မ်ားပါလာသည္ ဆုိေသာ္လဲ binary file မ်ား လည္းပါလာတတ္ပါသည္။ source code ထည္႔ေပးရၿခင္းမွာ စက္တုိင္းတြင္ operate လုပ္ႏုိင္ရန္အတြက္ ျဖစ္သည္။ ထုိ႔ေၾကာင္႔ tar format တြင္ source code သည္ primary ျဖစ္ျပီး binary file သည္ secondry ျဖစ္သည္။

၂။ Unzip လုပ္ျပီးေနာက္ က်ေနာ္တုိ႔ အေနနဲ႔ mpich-1.2.7 ဆုိတဲ႔ file ထြက္လာပါသည္။ ရရွိလာေသာ mpich-1.2.7 file ထဲမွ binary files မ်ားျဖစ္ေသာ configure ႏွင္႔ makelinks ကုိ command pipe (‘|’), tee တုိ႔ျဖင္႔ configuration ႏွင္႔ make လုပ္လုိက္ပါသည္။ ပုံတြင္ configuration completed ျဖစ္ျပီးေနာက္ make လုပ္ပါသည္။

၃။ make ျပဳလုပ္ျပီးေနာက္ mpich-1.2.3 ထဲမွ bin/ ရွိရာသုိ႔ သြားပါသည္။ mpich-1.2.7 /examples/basic/ ေအာက္တြင္ hello++.cc ဆုိတဲ႔ MPI program ရွိပါတယ္။ ဆုိလုိခ်င္တာကေတာ႔ အဲဒီ hello++.cc ဆုိတဲ႔ program ကုိ bin/ ထဲတြင္ mpiCC command ျဖင္႔ compile လုပ္ရန္ျဖစ္ပါသည္။ ပုံတြင္ၾကည္႔ပါ။ ./mpiCC ../examples/basic/hello++.cc –o hello.out ဆုိျပီး compile လုပ္ထားပါသည္။(-o) option သည္ bin ထဲတြင္ hello++.o ေပၚေစရန္ျဖစ္ျပီး၊ hello.out သည္ က်ေနာ္တုိ႔ result (output) ရဖုိ႔အတြက္ run ရမည္႔ program name ျဖစ္ပါသည္။ (./) သည္ ယခုလက္ရွိ အလုပ္လုပ္ေနေသာ directory ေအာက္တြင္ အလုပ္လုပ္ လုပ္မည္ဟု ေျပာၿခင္းျဖစ္ပါသည္။

၄။ Compile လုပ္ျပီးပါက bin/ ထဲတြင္ hello++.o file ႏွင္႔ binary file (.exe) ျဖစ္ေသာ hello.out ေတြ႔ရပါမည္။ hello.out ဆုိတဲ႔ .exe file ကုိ bin/ ထဲတြင္ Run ႏုိင္ရန္ က်ေနာ္တုိ႔ အေနနဲ႔ PATH လမ္းေၾကာင္းေပးရပါမယ္၊ ပုံတြင္ၾကည္႔ပါ export ဆုိျပီး bin ထဲသု႔ိ PATH လမ္းေၾကာင္းေပးထားပါသည္။ PATH လမ္းေၾကာင္းေပးျပီးေနာက္ mpirun ဆုိျပီး hello.out ဆုိတဲ႔ .exe ကုိ run လုိက္ပါသည္။ mpirun hello.out ေနရာတြင္ ./hello.out ဆုိ၍ အစားထုိး execution လုပ္ႏုိင္ပါသည္။ mpirun hello.out ဆုိျပီး run လုိက္ေသာအခါ Hello World! I am 0 of 1 ဆုိျပီး Output ထုတ္ေပးတာကုိ ေတြ႔ရပါသည္။ ပုံတြင္ၾကည္႔ပါ။ က်ေနာ္တုိ႔ အေနနဲ႔ PC တစ္လုံးထဲမွာပဲ run လုိ႔ process ကုိ 0 of 1 ဆုိျပီးျပထားပါသည္။ Parallel computing ျဖစ္လုိ႔ က်ေနာ္တုိ႔ အေနနဲ႔ ကြန္ပ်ဴတာ (၂)လုံး ၊ (၃)လုံး၊ အစရွိသျဖင္႔ တစ္ျပဳိင္တည္း ပရုိဂရမ္ကုိ run ႏုိင္ေအာင္ေဆာင္ရြက္ပါမည္။ က်ေနာ္ကေတာ႔ ကြန္ပ်ဴတာ (၅)လုံး ထိခ်ိတ္ျပီး test လုပ္ဖူးပါတယ္။ အခု test မွာေတာ႔ (၃)လုံးေပါ႔ဗ်ာ။ အဲဒီလုိ ခ်ိတ္ဆက္ျပီး program ကုိ execution လုပ္ႏုိင္ဖုိ႔အတြက္ က်ေနာ္တုိ႔ အေနနဲ႔ RSH server ကုိ ဖန္းတီးရပါမယ္။ RSH-server ဆုိတာဘာလဲ ? rsh-server package ထဲမွာ set of programs ေတြပါ၀င္တယ္၊ အဲဒီ programs မ်ားက က်ေနာ္တုိ႔ users ေတြကုိ ဘာေတြေဆာင္ရြက္ခြင္႔ျပဳႏုိင္သလဲဆုိေတာ႔ စက္ေတြကုိ remote လုပ္ႏုိင္၊ အၿခားစက္မ်ားသုိ႔ login လုပ္ႏုိင္၊ စက္ေတြၾကားမွာ files မ်ားကုိ copy လုပ္ႏုိင္တဲ႔ command ေတြကုိ run ႏုိင္ေအာင္ခြင္႔ျပဳေပးထားပါသည္။ (respectively commands မ်ားကေတာ႔ -> rsh, rlogin, and rcp )။ အဲဒီ commands 3 ခုလုံး ဟာ rhosts style authentication ကုိအသုံးျပဳသည္။ အဲဒီ package ထဲမွာ all of these services အတြက္ လုိအပ္တဲ႔ servers မ်ားပါ၀င္ပါသည္။

၅။ RSH Server ကုိ ဖန္းတီးဖုိ႔အတြက္ remote admin မ်ားျဖစ္ေသာ
xinetd-2.3.14.10.el5.1386.rpm ႏွင္႔ rsh-server-0.17-37.el5.1386.rpm Services မ်ားကုိ က်ေနာ္တုိ႔ OS installation လုပ္ထားတဲ႔ ေခြထဲမွ အဲဒီ package မ်ားကုိ install လုပ္ပါမယ္။ install လုပ္ဖုိ႔ အတြက္ /bin ထဲတြင္ mount point (/mnt/cdrom) တစ္ခု create လုပ္သည္။ create လုပ္ထားေသာ mount point ထဲသုိ႔ /dev/cdrom /mnt/cdrom ဆုိျပီး command mount –t iso9660 ျဖင္႔ mount လုပ္လုိက္ပါသည္။ iso9660 ဆုိတာကေတာ႔ file type ျဖစ္ပါသည္။ mount လုပ္ျပီးပါက က်ေနာ္တုိ႔ အေနနဲ႔ အဲဒီ services (၂)ခု ကုိ install လုပ္ပါမည္။ Install လုပ္မည္႔ command ကေတာ႔ rpm (Redhat package management) ျဖစ္ပါသည္။ ထုိသုိ႔ install လုပ္ရာတြင္ က်ေနာ္တုိ႔ Install လုပ္လုိေသာ services မ်ားသည္ မိမိတုိ႔တင္ထားေသာ Linux OS အလုိက္ directory ေနရာအမ်ဳိး၂ တြင္ ရွိေနတတ္ပါသည္။ ဥပမာ ။ အခုပုံတြင္ျပထားတာကေတာ႔ Redhat 5 Server OS အတြက္ျဖစ္ပါသည္။ Fedora ဆုိရင္ ဘယ္လုိေျပာင္သြားမလဲဆုိရင္ေတာ႔ rpm –ivh /mnt/cdrom/Fedora/RPMS/xinetd-2.3.14-10.el5.1386.rpm ဆုိျပီေျပာင္းလဲသြားပါမည္။ မိမိတုိ႔ တင္ထားေသာ OS ေပၚတြင္မူတည္ ရွိေနတတ္ပါသည္။

၆။ ေနာက္တဆင္႔ အေနနဲ႔ က်ေနာ္တုိ႔ IP address ေတြကုိ create လုပ္ပါမယ္။ပုံတြင္ၾကည္႔ပါ။ ကြန္ပ်ဴတာ (၃)လုံးဆုိေတာ႔ က်ေနာ္႔ IP address က 192.168.1.2 ေပါ႔၊ က်န္တဲ႔ စက္ေတြမွာကေတာ႔ 192.168.1.3 နဲ႔ 192.168.1.4 ျဖစ္ပါမည္။

၇။ ေအာက္က ပုံမွာကေတာ႔ Ethernet devices ကုိျပထားပါသည္။

၈။ ေအာက္ကပုံေတြမွာကေတာ႔ က်ေနာ္တုိ႔ အေနနဲ႔ DNS ႏွင္႔ Hostsname မ်ားကုိေရးျပထားပါသည္။ hostsname ႏွင္႔ IP address ကုိေရးထည္႔ရာတြင္ Program ကုိ execution လုပ္ရာတြင္ပါ၀င္မည္႔ ကြန္ပ်ဴတာမ်ားရဲ႕ hostsname ႏွင္႔ IP address မ်ားျဖစ္ပါသည္။ ပါ၀င္ေဆာင္ရြက္မည္႔ ကြန္ပ်ဴတာတုိင္းတြင္ hostname ႏွင္႔ IP address မ်ားကုိ ေအာက္ေဖာ္ျပပါ ပုံအတုိင္း ျဖည္႔စြက္ေပးရပါမည္။

၉။ ေအာက္ေဖာ္ျပပါ ပုံတြင္ cat command ျဖင္႔ hostsname ႏွင္႔ IP address ကုိၾကည္႔ပါသည္။ ၿဖည္႔စြက္ရန္လုိအပ္မူရွိပါက vi editor ကုိ အသုံးျပဳ ၍ ၀င္ေရာက္ၿဖည္႔စြက္ေရးသားႏုိင္ပါသည္။ vi editor ျဖင္႔ ၿဖည္႔စြက္ေရးသားခ်င္ရင္ေတာ႔ Insert key အျဖစ္ I ကုိႏွိပ္ ၍ Insert လုပ္ႏုိင္သည္။ ေရးသားျပီးပါက save လုိလွ်င္ Esc ႏွိပ္ းwq ျပီးရင္ Enter ရုိက္ေပးရန္။ ဘာမွ insert မလုပ္ဘူး ဆုိရင္ေတာ႔ Esc ႏွိပ္ းq! ျဖင္႔ vi editor မွ ျပန္ထြက္ႏုိင္ပါသည္။

၁၀။ rsh server ကုိ run ႏုိင္ရန္အတြက္ အေရးၾကီးဆုံးအခ်က္မွာ စက္တုိင္းတြင္ service shell သည္ disable=yes (default) ျဖစ္ေနမည္။ vi editor ျဖင္႔ ၀င္ေရာက္ျပင္ေပးရမည္။ေအာက္ေဖာ္ျပပါပုံသည္ vi editor ျဖင္႔ ၀င္ေရာက္ျပင္ထားေသာပုံျဖစ္ပါသည္။ စက္တုိင္းတြင္ disable=no ျဖစ္ေနရပါမည္။၁၁။ ေနာက္တဆင္႔ အေနနဲ႔ cat command ျဖင္႔ machines.LINUX ထဲတြင္ hostsname ရွိ/မရွိၾကည္႔ပါသည္။ hostsname (၃)ခုလုံး မရွိပါက vi editor ျဖင္႔ ၀င္ေရာက္ၿဖည္႔စြက္ေပးရပါမည္။ေအာက္ေဖာ္ျပပါပုံသည္ ျဖည္႔စြက္ထားေသာ ပုံျဖစ္ပါသည္။

၁၂။ ေနာက္တဆင္႔ အေနနဲ႔ ပါ၀င္ေဆာင္ရြက္မည္႔ ကြန္ပ်ဴတာတုိင္းရဲ႕ User Name မ်ားကုိ Add လုပ္ပါမည္။ Add လုပ္ရာတြင္ password မ်ားသည္ root (#) password မ်ားသာျဖစ္ရမည္။ အထက္ပါေဖာ္ျပခဲ႔ေသာ အခ်က္အလက္မ်ားအားလုံးသည္ ပါ၀င္ေဆာင္ရြက္မည္႔ ကြန္ပ်ဴတာတုိင္းတြင္ လုပ္ေဆာင္ရမည္ကုိ စာဖတ္သူမ်ားအေနနဲ႔ သတိထားေစလုိပါသည္။

၁၃။ အထက္ပါအခ်က္အလက္မ်ားကုိ စက္တုိင္းတြင္ ေဆာင္ရြက္ျပီးစီး ပါက rsh server run ႏုိင္ရန္အတြက္ က်ေနာ္တုိ႔ အေနနဲ႔ မျဖစ္မေနလုပ္ရမည္႔ လုပ္ငန္းစဥ္မ်ားကေတာ႔ ေအာက္ေဖာ္ျပပါပုံတြင္ ျပထားသည္႔ အတုိင္း Service configuration မွ iptables ႏွင္႔ ip6tables ကုိ Stop ေပးရပါမည္။ xinetd ႏွင္႔ rsh ကုိ restart ေပးရပါမည္။

၁၄။ ေအာက္ေဖာ္ျပပါ ပုံမ်ားသည္ rsh command သုံး ၍ စက္ေတြကုိ run ထားေသာပုံမ်ားျဖစ္ပါသည္။ ပထမဦးစြာ က်ေနာ္႔စက္ကေနျပီး မိမိစက္ (၁)လုံးတည္း ကုိ အရင္ run လုိက္သည္ ။ ထုိသုိ႔ မိမိစက္(၁)လုံးတည္း run ျပီးေနာက္ အၿခားစက္ေတြကုိ run ပါသည္၊ ပုံတြင္ၾကည္႔ပါ။ ls (list) ျဖင္႔ run လုိက္ေသာေၾကာင္႔ စက္တုိင္းတြင္ ရွိေနေသာ Data မ်ားကုိေတြ႔ရပါမည္။ ပုံတြင္ hello ၊ sun ၊ welcome ဆုိျပီး program name မ်ားကုိေတြ႔ရပါမည္။

၁၅။ rsh ေတြ run ျပီးေနာက္ က်ေနာ္တုိ႔ စက္ေတြထဲမွာ ရွိတဲ႔ MPI program ေတြကုိ run ပါမွာမယ္။ က်ေနာ္႔ အေနနဲ႔ ကေတာ႔ WELCOME အလုိ႔ အမည္ေပးထားတဲ႔ က်ေနာ္႔ရဲ႕ Simple Program ေလးကုိ test လုပ္ျပသြားမွာျဖစ္ပါတယ္။ Program ေလးကေတာ႔ အရမ္းရုိးရွင္းတဲ႔ program ေလးျဖစ္ပါတယ္။ ေအာက္ေဖာ္ျပပါ ပုံကုိၾကည္႔ပါ လက္ရွိေရာက္ေနတဲ႔ directory ထဲမွာ execution လုပ္မွာျဖစ္လုိ႔ PATH လမ္းေၾကာင္းေပးလုိက္ပါသည္။ PATH လမ္းေၾကာင္း export လုပ္ျပီးေနာက္ mpirun –np 1 welcome.out ဆုိျပီး welcome ဆုိတဲ႔ program ကုိ run လုိက္ပါသည္။ ထုိသုိ႔ run ရာတြင္ -np သည္ number of processor ျဖစ္ျပီး ၊ 1 သည္ processor (၁)လုံး ျဖစ္သည္ကုိဆုိလုိပါသည္။ ေအာက္မွာျပထားတဲ႔ ပုံေတြမွာ processor (၁)လုံး၊ (၂)လုံး၊ (၃)လုံး နဲ႔ welcome ဆုိတဲ႔ MPI program ကုိ parallel computing လုပ္ထားပါသည္။ Parallel program ျဖစ္ေသာ MPI program ကုိ execution လုပ္မည္႔ အခ်ိန္အတြင္း က်ေနာ္တုိ႔ အေနနဲ႔ Processor အလုံးအေရအတြက္ ဘယ္ေလာက္သုံးျပီး run မလဲဆုိတာကုိ သတ္မွတ္ေပးႏုိင္ပါသည္။ Program မ်ားကုိ စက္တုိင္းတြင္ execution လုပ္ႏုိင္ရန္အတြက္ စက္တုိင္းတြင္ programs မ်ားကုိ copy လုပ္ထားေပးရပါမည္။ Program အားလုံးရဲ႕ processes မ်ားသည္ 0 မွ စ ၍ ေရတြက္သည္၊ Process 0 of 3 is alive တြင္ process သည္ 0 ျဖစ္ျပီး 3 သည္ processor အေရအတြက္ျဖစ္ပါသည္။ Output result ကေတာ႔

Process 0 of 3 is alive Process 1 of 3 is alive
Process 2 of 3 is alive
Welcome to http://www.MyanmarFamily.org!

နိဂုံး
အထက္မွာ ေဖာ္ျပခဲ႔တဲ႔ အေၾကာင္းအရာမ်ားနဲ႔ ပတ္သက္ ၍ Parallel Computing Field သည္ အရမ္းက်ယ္ျပန္႔ပါသည္။ အဲဒီထဲကမွ က်ေနာ္႔အေနနဲ႔ parallel programming model ရဲ႕ special library တစ္ခုျဖစ္ေသာ MPI အေၾကာင္းကုိသာ ေရးသားေဖာ္ျပထားပါသည္။ message passing အလုပ္လုပ္ပုံေတြကုိလဲ အထက္မွာ ပုံႏွင္႔တကြ ေဖာ္ျပထားေပးပါတယ္။ Program (၁) ပုဒ္ကုိ processors (၃)လုံး ႏွင္႔ parallel computing လုပ္ပုံကုိေဖာ္ျပခဲ႔ျပီး ျဖစ္ပါသည္။ ေလ႔လာေနဆဲ ေက်ာင္းသားတစ္ဦးျဖစ္လုိ႔ အထက္ပါအေၾကာင္းအရာႏွင္႔ ပတ္သက္ ၍ လုိအပ္ခ်က္မ်ားစြာ ရွိႏုိင္ပါသည္။ ဤစာေစာင္ကုိ ေလ႔လာဖတ္လုိက္ရသည္႔ စာဖတ္သူ၊ ညီအစ္ကုိေမာင္ႏွမ မ်ားအားလုံး နားလည္ေပးၾကပါလုိ႔ ေမတၱာရပ္ခံပါရေစ။ က်ေနာ္႔ အေနႏွင္႔ ကြန္ပ်ဴတာနည္းပညာ နဲ႔ပတ္သက္၍ အနည္းငယ္ေလ႔လာထားေသာ Parallel computing အေၾကာင္းကုိ စာဖတ္သူမ်ားအေနနဲ႔ ရင္ႏွီးကြၽမ္း၀င္မူ ရွိသြားေအာင္ ေရးသားတင္ျပ လုိက္ရပါသည္။

စာဖတ္သူမ်ား နားလည္ႏုိင္ရန္ ပုံႏွင္႔တကြ ေရးသားေဖာ္ျပ ခ်င္ေသာ္လဲ ပုံေတြ တင္ရာမွာ အခက္အခဲ ရွိပါသျဖင္႔ နားလည္ေပးပါရန္.... စာဖတ္သူမ်ားအေနႏွင္႔ စိတ္၀င္စားပါက...ပုံႏွင္တကြ ေရးသားထားတဲ႔ စာေစာင္ကုိ က်ေနာ္ upload တင္ေပးပါမည္...

Reference:
1. http://users.abo.fi/mats/PP2008/programs/MPI/index.html
2. http://www.pdc.kth.se/training/Tutor/MPI/Templates/index-frame.html
3. http://www.dartmouth.edu/~rc/classes/intro_mpi/intro_mpi_overview.html
4. https://www.cityu.edu.hk/acim/facilities/MPI.htm
5. http://www.uppmax.uu.se/support/faqs/faqs/how-can-i-compile-mpi-programs-on-ra-isis
6. http://www.mcs.anl.gov/research/projects/mpi/tutorial/gropp/talk.html#Node0
7. https://computing.llnl.gov/tutorials/mpi/#What
8. http://en.wikipedia.org/wiki/Parallel_computing#Parallel_programming_languages
9. http://iproc.ru/programming/mpich-windows/
10. http://iproc.ru/
11. https://computing.llnl.gov/tutorials/parallel_comp/#Whatis
12. http://kb.iu.edu/data/angf.html
13. http://www.cfd-online.com/Wiki/Parallel_computing

1 comment:

  1. ေက်းဇူးပါ အဆင္ေျပရင္ဒီထပ္ပိုျပီးသိခ်င္ပါတယ္
    စာေစာင္ကို တင္ေပးေစခ်င္ပါတယ္....

    ReplyDelete

Copyright 2008 ဗဟုသုတမ်ားတုိးပြားႏုိင္ၾကပါေစ . All rights reserved.

Template By: Hive Designs Ported By: Theme Lab. Blogger by akOOgle