SlideShare a Scribd company logo
1 of 12
Jacobi Project
Members: Young Song, Hung Lay, Caleb Jang
Problem
• A room has four walls and a fireplace. Temperature of wall is 20°C, and
temperature of fireplace is 100°C. Write a parallel program using Jacobi
iteration to compute the temperature inside the room and plot (preferably in
color) temperature contours at 10°C intervals using Xlib calls or similar
graphics calls as available on your system.
Jacobi Iteration
Iteration formula - ith equation rearranged to have ith unknown on left side:
Laplace Approach
Approach
• Known: Fire: 100 C, Wall: 20 C
• Unknown: Air: ?
• Initial Air: 0 C
Initial Matrix
[20 20 100 20 20]
[20 0 0 0 20]
[20 0 0 0 20]
[20 0 0 0 20]
[20 20 20 20 20]
The temperature of air which is initially set 0
increases during iterations.
Sequential Code
• Using a fixed number of iterations
for (iteration = 0; iteration < limit; iteration++)
{ for (i = 1; i < n; i++)
for (j = 1; j < n; j++) g[i][j] = 0.25*(h[i-1][j]+h[i+1][j]+h[i][j-1]+h[i][j+1]);
for (i = 1; i < n; i++) /* update points */
for (j = 1; j < n; j++) h[i][j] = g[i][j];
}
Parallel Methods
Split the fixed amount of iterations into process using Partitioning.
Start =0
RNG = iterations/num of process
Process 1: Start to Start+RNG, then Start = Start+RNG
Process 2: Start to Start+RNG, then Start = Start+RNG
Process 3: Start to Start+RNG, then Start = Start+RNG
.
.
.
MPI
if (rank > 0){ //Receives the data from the previous
ranks
MPI_Recv(&i_last, 1, MPI_INT, rank - 1, 1,
MPI_COMM_WORLD, &status );
if (rank < 4){
MPI_Send(&i_last, 1, MPI_INT, rank + 1, 1,
MPI_COMM_WORLD ); //Sends the boundary for
the other }
We would split the work and have each process send and
receive the data.
When equal to 0, It would begin to run the Jacobi iteration on
two rows, and then continue to pass that information to the
next process until it would finish
Comparison
Sequential Parallel MPI
0.0331208s 2.179189s 0.0146498s
//# of process = 5. Size of
array = 12 * 12
//same //same
Graphical Result for Ideal Result
Graph from real tables
20 20 20 20 100 100 20 20 20 20
20 22.3 26.05 34.63 58.90 58.90 34.63 26.05 22.3 20
20 23.14 27.27 33.56 42.08 42.08 33.56 27.27 23.14 20
20 22.98 26.35 30.25 33.78 33.78 30.25 26.35 22.98 20
20 22.42 24.90 27.30 29.02 29.02 27.30 24.90 22.42 20
20 21.8 23.53 25.04 25.98 25.98 25.04 23.53 21.8 20
20 21.24 22.40 23.34 23.88 23.88 23.34 22.40 21.24 20
20 20.77 21.47 22.02 22.34 22.34 22.02 21.47 20.77 20
20 20.37 20.70 20.95 21.20 21.20 20.95 20.70 20.37 20
20 20 20 20 20 20 20 20 20 20

More Related Content

What's hot

Digital and logic designs presentation
Digital and logic designs presentationDigital and logic designs presentation
Digital and logic designs presentation
Haya Butt
 
Early Sizing Calculation
Early Sizing CalculationEarly Sizing Calculation
Early Sizing Calculation
Amol Dudhate
 
Lab sheet 4 bti1022
Lab sheet 4 bti1022Lab sheet 4 bti1022
Lab sheet 4 bti1022
alish sha
 

What's hot (20)

Radix Sort
Radix SortRadix Sort
Radix Sort
 
Data Structure Radix Sort
Data Structure Radix SortData Structure Radix Sort
Data Structure Radix Sort
 
Digital and logic designs presentation
Digital and logic designs presentationDigital and logic designs presentation
Digital and logic designs presentation
 
Probability of finding a single qubit in a state
Probability of finding a single qubit in a stateProbability of finding a single qubit in a state
Probability of finding a single qubit in a state
 
Random numbers c++ class 11 and 12
Random numbers c++  class 11 and 12Random numbers c++  class 11 and 12
Random numbers c++ class 11 and 12
 
Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)
Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)
Runtime Monitoring of Stream Logic Formulae (Talk @ FPS 2015)
 
Lecture02
Lecture02Lecture02
Lecture02
 
Class D Audio Amplifier using PSpice
Class D Audio Amplifier using PSpiceClass D Audio Amplifier using PSpice
Class D Audio Amplifier using PSpice
 
Lecture 3 time complexity
Lecture 3 time complexityLecture 3 time complexity
Lecture 3 time complexity
 
Lecture 1 python arithmetic (ewurc)
Lecture 1 python arithmetic (ewurc)Lecture 1 python arithmetic (ewurc)
Lecture 1 python arithmetic (ewurc)
 
Early Sizing Calculation
Early Sizing CalculationEarly Sizing Calculation
Early Sizing Calculation
 
Final presentation iot
Final presentation iotFinal presentation iot
Final presentation iot
 
Greedy
GreedyGreedy
Greedy
 
Graphing day 1 worked
Graphing day 1 workedGraphing day 1 worked
Graphing day 1 worked
 
4.5 sec and csc worked 3rd
4.5   sec and csc worked 3rd4.5   sec and csc worked 3rd
4.5 sec and csc worked 3rd
 
4.5 tan and cot.ppt worked
4.5   tan and cot.ppt worked4.5   tan and cot.ppt worked
4.5 tan and cot.ppt worked
 
Parallel adder
Parallel adderParallel adder
Parallel adder
 
Concept of c
Concept of cConcept of c
Concept of c
 
Lab sheet 4 bti1022
Lab sheet 4 bti1022Lab sheet 4 bti1022
Lab sheet 4 bti1022
 
B.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital componentB.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital component
 

Similar to Python project2

Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
PMILebanonChapter
 
C++ Programming Club-Lecture 3
C++ Programming Club-Lecture 3C++ Programming Club-Lecture 3
C++ Programming Club-Lecture 3
Ammara Javed
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematical
babuk110
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
gerardkortney
 

Similar to Python project2 (20)

algorithm
algorithmalgorithm
algorithm
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
 
LeetCode Solutions In Java .pdf
LeetCode Solutions In Java .pdfLeetCode Solutions In Java .pdf
LeetCode Solutions In Java .pdf
 
ch07-arrays.ppt
ch07-arrays.pptch07-arrays.ppt
ch07-arrays.ppt
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
C++ Programming Club-Lecture 3
C++ Programming Club-Lecture 3C++ Programming Club-Lecture 3
C++ Programming Club-Lecture 3
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
 
OSCh7
OSCh7OSCh7
OSCh7
 
OS_Ch7
OS_Ch7OS_Ch7
OS_Ch7
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
 
Data Structure & Algorithms - Mathematical
Data Structure & Algorithms - MathematicalData Structure & Algorithms - Mathematical
Data Structure & Algorithms - Mathematical
 
Mechanical Engineering Homework Help
Mechanical Engineering Homework HelpMechanical Engineering Homework Help
Mechanical Engineering Homework Help
 
Python Homework Help
Python Homework HelpPython Homework Help
Python Homework Help
 
Advance data structure & algorithm
Advance data structure & algorithmAdvance data structure & algorithm
Advance data structure & algorithm
 
lab-8 (1).pptx
lab-8 (1).pptxlab-8 (1).pptx
lab-8 (1).pptx
 
ALGO.ppt
ALGO.pptALGO.ppt
ALGO.ppt
 
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and AlgorithmsCP4151 ADSA unit1 Advanced Data Structures and Algorithms
CP4151 ADSA unit1 Advanced Data Structures and Algorithms
 
QC-UNIT 2.ppt
QC-UNIT 2.pptQC-UNIT 2.ppt
QC-UNIT 2.ppt
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 

Recently uploaded

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
HyderabadDolls
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
wsppdmt
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
HyderabadDolls
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 
Computer science Sql cheat sheet.pdf.pdf
Computer science Sql cheat sheet.pdf.pdfComputer science Sql cheat sheet.pdf.pdf
Computer science Sql cheat sheet.pdf.pdf
SayantanBiswas37
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
ranjankumarbehera14
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 

Recently uploaded (20)

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Computer science Sql cheat sheet.pdf.pdf
Computer science Sql cheat sheet.pdf.pdfComputer science Sql cheat sheet.pdf.pdf
Computer science Sql cheat sheet.pdf.pdf
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about them
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 

Python project2

  • 1. Jacobi Project Members: Young Song, Hung Lay, Caleb Jang
  • 2. Problem • A room has four walls and a fireplace. Temperature of wall is 20°C, and temperature of fireplace is 100°C. Write a parallel program using Jacobi iteration to compute the temperature inside the room and plot (preferably in color) temperature contours at 10°C intervals using Xlib calls or similar graphics calls as available on your system.
  • 3. Jacobi Iteration Iteration formula - ith equation rearranged to have ith unknown on left side:
  • 5. Approach • Known: Fire: 100 C, Wall: 20 C • Unknown: Air: ? • Initial Air: 0 C
  • 6. Initial Matrix [20 20 100 20 20] [20 0 0 0 20] [20 0 0 0 20] [20 0 0 0 20] [20 20 20 20 20] The temperature of air which is initially set 0 increases during iterations.
  • 7. Sequential Code • Using a fixed number of iterations for (iteration = 0; iteration < limit; iteration++) { for (i = 1; i < n; i++) for (j = 1; j < n; j++) g[i][j] = 0.25*(h[i-1][j]+h[i+1][j]+h[i][j-1]+h[i][j+1]); for (i = 1; i < n; i++) /* update points */ for (j = 1; j < n; j++) h[i][j] = g[i][j]; }
  • 8. Parallel Methods Split the fixed amount of iterations into process using Partitioning. Start =0 RNG = iterations/num of process Process 1: Start to Start+RNG, then Start = Start+RNG Process 2: Start to Start+RNG, then Start = Start+RNG Process 3: Start to Start+RNG, then Start = Start+RNG . . .
  • 9. MPI if (rank > 0){ //Receives the data from the previous ranks MPI_Recv(&i_last, 1, MPI_INT, rank - 1, 1, MPI_COMM_WORLD, &status ); if (rank < 4){ MPI_Send(&i_last, 1, MPI_INT, rank + 1, 1, MPI_COMM_WORLD ); //Sends the boundary for the other } We would split the work and have each process send and receive the data. When equal to 0, It would begin to run the Jacobi iteration on two rows, and then continue to pass that information to the next process until it would finish
  • 10. Comparison Sequential Parallel MPI 0.0331208s 2.179189s 0.0146498s //# of process = 5. Size of array = 12 * 12 //same //same
  • 11. Graphical Result for Ideal Result
  • 12. Graph from real tables 20 20 20 20 100 100 20 20 20 20 20 22.3 26.05 34.63 58.90 58.90 34.63 26.05 22.3 20 20 23.14 27.27 33.56 42.08 42.08 33.56 27.27 23.14 20 20 22.98 26.35 30.25 33.78 33.78 30.25 26.35 22.98 20 20 22.42 24.90 27.30 29.02 29.02 27.30 24.90 22.42 20 20 21.8 23.53 25.04 25.98 25.98 25.04 23.53 21.8 20 20 21.24 22.40 23.34 23.88 23.88 23.34 22.40 21.24 20 20 20.77 21.47 22.02 22.34 22.34 22.02 21.47 20.77 20 20 20.37 20.70 20.95 21.20 21.20 20.95 20.70 20.37 20 20 20 20 20 20 20 20 20 20 20