SlideShare ist ein Scribd-Unternehmen logo
1 von 17
How to Parallelize  a given application with a simple example
Types of Problems ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
New application ,[object Object],[object Object]
Parallelisation of Existing Program ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simple Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A simple example Start Input Do the Computation Output Stop
Start Input Do the Computation Output Stop Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Parallelism Communication Communication
Issues in Parallelisation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simple Example ,[object Object],[object Object],Process 0 : Master either generates or reads as input Disadvantage: Requires communication P 1 P 2 P 3 P n-1
P 0 Start Stop Initialization Time P 1 P 2 P 3 P n-1 Idle Generate input Write output Option 1: Read and Distribute inputs Parallelism Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Communication Communication
Simple Example ,[object Object],[object Object],All processes generate inputs Advantage: No communication P 1 P 2 P 3 P n-1
P 0 Start Stop Initialization Time P 1 P 2 P 3 P n-1 Generate input Write output Option 2: Generate inputs simultaneously Communication Parallelism Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Communication
Sequential Code program summation double precision x,xsum integer i,iseed xsum=0.0 do i=1,1000000000000 x=float(mod(i,10))/10.0 xsum=xsum+x enddo print *,’xsum= ‘,xsum stop end
Parallel Code program summation include “mpif.h” double precision x,xsum, tsum integer i Integer myid,nprocs,IERR Call MPI_INIT(IERR) Call MPI_COMM_RANK(MPI_COMM_WORLD,myid,IERR) Call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,IERR) xsum=0.0 do i= myid+1 ,1000000000000 ,nprocs x=float(mod(i,10))/10.0 xsum=xsum+x enddo Call MPI_REDUCE(xsum,tsum,1,MPI_DOUBLE_PRECISION, MPI_SUM,0,MPI_COMM_WORLD,IERR) If(myid.eq.0)   print *,’tsum= ‘,tsum stop end program summation double precision x,xsum integer i xsum=0.0 do i=1,1000000000000 x=float(mod(i,10))/10.0 xsum=xsum+x enddo print *,’xsum= ‘,xsum stop end
Sequential vs Parallel mpirun –np 8 sum.exe Executes 8 processes  simultaneously sum.exe  Executes a single process Cooperative operations but, multiple points of failure; Tools are still evolving towards debugging parallel executions. Single point of failure Good tools available for debugging mpif77 –o sum.exe sum.f mpicc –o sum.exe sum.f Only one executable created f90 –o sum.exe sum.f gcc –o sum.exe sum.c Only one executable created Redesign the same algorithm with the distribution of work assuming many processes to be executed simultaneously Design algorithm step by step and write the code assuming single process to be executed Parallel Sequential
James Bailey  (New Era in Computation Ed. Metropolis &  Rota) We are all still trained to believe that orderly, sequential processes are more likely to be true.  As we were reshaping our computers, so simultaneously were they reshaping us.  May be when things happen in this world, they actually happen in parallel A Quote
James Bailey  (New Era in Computation Ed. Metropolis &  Rota) We are all still trained to believe that orderly, sequential processes are more likely to be true.  As we were reshaping our computers, so simultaneously were they reshaping us.  May be when things happen in this world, they actually happen in parallel A Quote to conclude

Weitere ähnliche Inhalte

Was ist angesagt?

Algorithm basics
Algorithm basicsAlgorithm basics
Algorithm basicsKuppusamy P
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingPTtp WgWt
 
Code Efficiency (Nur Nachman)
Code Efficiency (Nur Nachman)Code Efficiency (Nur Nachman)
Code Efficiency (Nur Nachman)NurNachman
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notationirdginfo
 
Polyspace CETIC presentation
Polyspace CETIC presentationPolyspace CETIC presentation
Polyspace CETIC presentationcponsard
 
Object oriented programming 12 programming steps in cpp and example
Object oriented programming 12 programming steps in cpp and exampleObject oriented programming 12 programming steps in cpp and example
Object oriented programming 12 programming steps in cpp and exampleVaibhav Khanna
 
C++ by shantu
C++ by shantuC++ by shantu
C++ by shantuShant007
 
Cosc 2425 project 2 part 1 implement the following c++ code
Cosc 2425   project 2 part 1 implement the following c++ code Cosc 2425   project 2 part 1 implement the following c++ code
Cosc 2425 project 2 part 1 implement the following c++ code AISHA232980
 
Lecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsLecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsRajesh K Shukla
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3FabMinds
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programmingHam Jirayu
 

Was ist angesagt? (18)

Algorithm basics
Algorithm basicsAlgorithm basics
Algorithm basics
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Introduction to programming
Introduction  to  programmingIntroduction  to  programming
Introduction to programming
 
Code Efficiency (Nur Nachman)
Code Efficiency (Nur Nachman)Code Efficiency (Nur Nachman)
Code Efficiency (Nur Nachman)
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programming
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Collatz Conjecture Research
Collatz Conjecture ResearchCollatz Conjecture Research
Collatz Conjecture Research
 
Polyspace CETIC presentation
Polyspace CETIC presentationPolyspace CETIC presentation
Polyspace CETIC presentation
 
Object oriented programming 12 programming steps in cpp and example
Object oriented programming 12 programming steps in cpp and exampleObject oriented programming 12 programming steps in cpp and example
Object oriented programming 12 programming steps in cpp and example
 
C++ by shantu
C++ by shantuC++ by shantu
C++ by shantu
 
Cosc 2425 project 2 part 1 implement the following c++ code
Cosc 2425   project 2 part 1 implement the following c++ code Cosc 2425   project 2 part 1 implement the following c++ code
Cosc 2425 project 2 part 1 implement the following c++ code
 
Lecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of AlgorithmsLecture Note-2: Performance analysis of Algorithms
Lecture Note-2: Performance analysis of Algorithms
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
 
22 Jop Oct 08
22 Jop Oct 0822 Jop Oct 08
22 Jop Oct 08
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programming
 
Introduction to-programming
Introduction to-programmingIntroduction to-programming
Introduction to-programming
 
Introduction to programming
Introduction  to  programmingIntroduction  to  programming
Introduction to programming
 

Andere mochten auch

Andere mochten auch (7)

Equipos all in on (aio)
Equipos all in on (aio)Equipos all in on (aio)
Equipos all in on (aio)
 
Impresoras inkjet, láser y matriciales
Impresoras inkjet, láser y matricialesImpresoras inkjet, láser y matriciales
Impresoras inkjet, láser y matriciales
 
Rj 0182 2011-ed
Rj 0182 2011-edRj 0182 2011-ed
Rj 0182 2011-ed
 
Notebooks y netbooks
Notebooks y netbooksNotebooks y netbooks
Notebooks y netbooks
 
Motherboard partes y funcionamiento
Motherboard   partes y funcionamientoMotherboard   partes y funcionamiento
Motherboard partes y funcionamiento
 
Monitores crt
Monitores crtMonitores crt
Monitores crt
 
Motherboard bios y reparación
Motherboard bios y reparaciónMotherboard bios y reparación
Motherboard bios y reparación
 

Ähnlich wie parellel computing

Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsZvi Avraham
 
Parallel Programming on the ANDC cluster
Parallel Programming on the ANDC clusterParallel Programming on the ANDC cluster
Parallel Programming on the ANDC clusterSudhang Shankar
 
Os2 2
Os2 2Os2 2
Os2 2issbp
 
Parallel Programming Primer 1
Parallel Programming Primer 1Parallel Programming Primer 1
Parallel Programming Primer 1mobius.cn
 
Parallel Programming Primer
Parallel Programming PrimerParallel Programming Primer
Parallel Programming PrimerSri Prasanna
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdfpasinduneshan
 
Overview Of Parallel Development - Ericnel
Overview Of Parallel Development -  EricnelOverview Of Parallel Development -  Ericnel
Overview Of Parallel Development - Ericnelukdpe
 
Contents Pre-requisites Approximate .docx
   Contents Pre-requisites  Approximate .docx   Contents Pre-requisites  Approximate .docx
Contents Pre-requisites Approximate .docxShiraPrater50
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithmshccit
 
Algorithm and c language
Algorithm and c languageAlgorithm and c language
Algorithm and c languagekamalbeydoun
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxstilliegeorgiana
 

Ähnlich wie parellel computing (20)

Migration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming ModelsMigration To Multi Core - Parallel Programming Models
Migration To Multi Core - Parallel Programming Models
 
Parallel Programming on the ANDC cluster
Parallel Programming on the ANDC clusterParallel Programming on the ANDC cluster
Parallel Programming on the ANDC cluster
 
Parallel computation
Parallel computationParallel computation
Parallel computation
 
Os2 2
Os2 2Os2 2
Os2 2
 
parallel-computation.pdf
parallel-computation.pdfparallel-computation.pdf
parallel-computation.pdf
 
Parallel Programming Primer 1
Parallel Programming Primer 1Parallel Programming Primer 1
Parallel Programming Primer 1
 
Parallel Programming Primer
Parallel Programming PrimerParallel Programming Primer
Parallel Programming Primer
 
Ch1
Ch1Ch1
Ch1
 
Ch1
Ch1Ch1
Ch1
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
 
PPS Unit-1.pdf
PPS Unit-1.pdfPPS Unit-1.pdf
PPS Unit-1.pdf
 
3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
GCF
GCFGCF
GCF
 
Overview Of Parallel Development - Ericnel
Overview Of Parallel Development -  EricnelOverview Of Parallel Development -  Ericnel
Overview Of Parallel Development - Ericnel
 
Contents Pre-requisites Approximate .docx
   Contents Pre-requisites  Approximate .docx   Contents Pre-requisites  Approximate .docx
Contents Pre-requisites Approximate .docx
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
Algorithm and c language
Algorithm and c languageAlgorithm and c language
Algorithm and c language
 
Programming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docxProgramming Assignment #2CSci 430 Spring 2019Dates.docx
Programming Assignment #2CSci 430 Spring 2019Dates.docx
 

Kürzlich hochgeladen

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

parellel computing

  • 1. How to Parallelize a given application with a simple example
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. A simple example Start Input Do the Computation Output Stop
  • 7. Start Input Do the Computation Output Stop Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Parallelism Communication Communication
  • 8.
  • 9.
  • 10. P 0 Start Stop Initialization Time P 1 P 2 P 3 P n-1 Idle Generate input Write output Option 1: Read and Distribute inputs Parallelism Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Communication Communication
  • 11.
  • 12. P 0 Start Stop Initialization Time P 1 P 2 P 3 P n-1 Generate input Write output Option 2: Generate inputs simultaneously Communication Parallelism Start Input Do the computation Collect the results Output Stop Divide the Work Communicate input Communication
  • 13. Sequential Code program summation double precision x,xsum integer i,iseed xsum=0.0 do i=1,1000000000000 x=float(mod(i,10))/10.0 xsum=xsum+x enddo print *,’xsum= ‘,xsum stop end
  • 14. Parallel Code program summation include “mpif.h” double precision x,xsum, tsum integer i Integer myid,nprocs,IERR Call MPI_INIT(IERR) Call MPI_COMM_RANK(MPI_COMM_WORLD,myid,IERR) Call MPI_COMM_SIZE(MPI_COMM_WORLD,nprocs,IERR) xsum=0.0 do i= myid+1 ,1000000000000 ,nprocs x=float(mod(i,10))/10.0 xsum=xsum+x enddo Call MPI_REDUCE(xsum,tsum,1,MPI_DOUBLE_PRECISION, MPI_SUM,0,MPI_COMM_WORLD,IERR) If(myid.eq.0) print *,’tsum= ‘,tsum stop end program summation double precision x,xsum integer i xsum=0.0 do i=1,1000000000000 x=float(mod(i,10))/10.0 xsum=xsum+x enddo print *,’xsum= ‘,xsum stop end
  • 15. Sequential vs Parallel mpirun –np 8 sum.exe Executes 8 processes simultaneously sum.exe Executes a single process Cooperative operations but, multiple points of failure; Tools are still evolving towards debugging parallel executions. Single point of failure Good tools available for debugging mpif77 –o sum.exe sum.f mpicc –o sum.exe sum.f Only one executable created f90 –o sum.exe sum.f gcc –o sum.exe sum.c Only one executable created Redesign the same algorithm with the distribution of work assuming many processes to be executed simultaneously Design algorithm step by step and write the code assuming single process to be executed Parallel Sequential
  • 16. James Bailey (New Era in Computation Ed. Metropolis & Rota) We are all still trained to believe that orderly, sequential processes are more likely to be true. As we were reshaping our computers, so simultaneously were they reshaping us. May be when things happen in this world, they actually happen in parallel A Quote
  • 17. James Bailey (New Era in Computation Ed. Metropolis & Rota) We are all still trained to believe that orderly, sequential processes are more likely to be true. As we were reshaping our computers, so simultaneously were they reshaping us. May be when things happen in this world, they actually happen in parallel A Quote to conclude