ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Hard to Parallelize Problems
CS5225 Parallel and Concurrent Programming
Dilum Bandara
Dilum.Bandara@uom.lk
Some slides adapted from Dr. Srinath Perera
Problems
? Matrix-Vector Multiplication
? 1D assignment
? 2D Assignment
? Matrix-Matrix Multiplication
2
Matrix-Vector Multiplication
? If x is copied to all processors, parallel solution is trivial
? Assign each row to a processor & calculate, & reduce to output
results
? Expensive if read vector from a file
? Alternatives
? Each process reads parts of data & writes part of the results
? 1D & 2D Assignment
3
1D Assignment
? Each processor is given a row
? Vector is broken down between processors
? Vector is distributed to all through processor via all-to-
all broadcast
? Each vector writes its part of the results
4
1D Assignment (Cont.)
5
1D Assignment ¨C MPI Based
Implementation
? For i-th process
a[i] = read(a[i]); //read row i
x = read(x[i]); //read part of vector
MPI_allgather(x, allx);
y = CalculateY(a[i], allx);
Write(y);
6
2D Assignment
? Distributed across n2 processors & vector is
distributed across leftmost n processors
? Solution
? Each (i, n)-th processor sends to (i, i) processor
? Each (i, i) processor broadcasts over the column
? Calculates results
? Reduce results across rows
7
2D Assignment (Cont.)
8
2D Assignment (Cont.)
For (i, j)-th process
a[x][y] = read(a[x][y]);
If(j == n)
x = read(x[i]);
MPI_Send(x, (i, i))
If(i == j){
MPI_Receive(&block)
MPI_Broadcast(block, j);
blockRecv = block;
}
else{ //receive block from others
MPI_Broadcast(&block, 1, &blockRecv, 1, (j, j));
}
y(I, j ) = Calculate();
//reduce it at the 0th on earch row
MPI_REDUCE(y(I, j), 1, &resultrcv, 1, (i, 0));
write(&resultrcv);
9
Vector-Matrix Multiplication with
Map-Reduce
? If vector fits in memory
? Map
? Send vector & a row to each map task & send to (i, result)
? Reduce
? Print final results
10
Vector-Matrix Multiplication with
Map-Reduce (Cont.)
? If vector does not fit in memory
? Use 1D or 2D Assignments depending on size
? Map
? Send vector & a row to each map task & send to (i, result)
? If it doesn¡¯t fit
? Send part of vector & part of row to each map task & send to (i,
result)
? Reduce
? Print final results
? Refer to ¡°2.3.1 Matrix-Vector Multiplication by Map-
Reduce¡± in the Mining large data sets book
11
? Map
? Make (key, value) pairs out of matrices mij & njk
? Produce (j, (M, i, mij) and (j, (N, k, njk)
? Reduce
? Produce for each j (j, (i, k, mij, njk))
? Map again
? Produce [((i1, k1), m1j*nj1), ((i2, k2), m2j*nj2), ¡­, ((ip, kp), mpj*njp)]
? Reduce again
? For each (i, k) pair sum all & produce ((i, k), v)
Matrix-Matrix Multiplication
12

More Related Content

Similar to Hard to Paralelize Problems: Matrix-Vector and Matrix-Matrix (20)

Ca unit v 27 9-2020
Ca unit v 27 9-2020Ca unit v 27 9-2020
Ca unit v 27 9-2020
Thyagharajan K.K.
?
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
csandit
?
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
cscpconf
?
Unit3 MapReduce
Unit3 MapReduceUnit3 MapReduce
Unit3 MapReduce
Integral university, India
?
IE-301_OptionalProject_Group2_Report
IE-301_OptionalProject_Group2_ReportIE-301_OptionalProject_Group2_Report
IE-301_OptionalProject_Group2_Report
Sarp Uzel
?
An Algorithm for Optimized Cost in a Distributed Computing System
An Algorithm for Optimized Cost in a Distributed Computing SystemAn Algorithm for Optimized Cost in a Distributed Computing System
An Algorithm for Optimized Cost in a Distributed Computing System
IRJET Journal
?
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
Oriental College of Technology,Bhopal
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
TutorialsDuniya.com
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ßNVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA Japan
?
GRAPHICAL STRUCTURES in our lives
GRAPHICAL STRUCTURES in our livesGRAPHICAL STRUCTURES in our lives
GRAPHICAL STRUCTURES in our lives
xryuseix
?
Chapter 4 pc
Chapter 4 pcChapter 4 pc
Chapter 4 pc
Hanif Durad
?
Iaetsd traffic sign recognition for advanced driver
Iaetsd traffic sign recognition for  advanced driverIaetsd traffic sign recognition for  advanced driver
Iaetsd traffic sign recognition for advanced driver
Iaetsd Iaetsd
?
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop ClustersHDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
Xiao Qin
?
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
?
dda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphicsdda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphics
SurjanSinghThakuri
?
Map reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICSMap reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICS
Archana Gopinath
?
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and Visualization
Marjan Sterjev
?
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
csandit
?
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
STATE SPACE GENERATION FRAMEWORK BASED ON BINARY DECISION DIAGRAM FOR DISTRIB...
cscpconf
?
IE-301_OptionalProject_Group2_Report
IE-301_OptionalProject_Group2_ReportIE-301_OptionalProject_Group2_Report
IE-301_OptionalProject_Group2_Report
Sarp Uzel
?
An Algorithm for Optimized Cost in a Distributed Computing System
An Algorithm for Optimized Cost in a Distributed Computing SystemAn Algorithm for Optimized Cost in a Distributed Computing System
An Algorithm for Optimized Cost in a Distributed Computing System
IRJET Journal
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
TutorialsDuniya.com
?
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
?
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ßNVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA HPC ¥½¥Õ¥È¥¦¥¨¥¢Ð±¤áÕi¤ß
NVIDIA Japan
?
GRAPHICAL STRUCTURES in our lives
GRAPHICAL STRUCTURES in our livesGRAPHICAL STRUCTURES in our lives
GRAPHICAL STRUCTURES in our lives
xryuseix
?
Iaetsd traffic sign recognition for advanced driver
Iaetsd traffic sign recognition for  advanced driverIaetsd traffic sign recognition for  advanced driver
Iaetsd traffic sign recognition for advanced driver
Iaetsd Iaetsd
?
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop ClustersHDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
HDFS-HC: A Data Placement Module for Heterogeneous Hadoop Clusters
Xiao Qin
?
dda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphicsdda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphics
SurjanSinghThakuri
?
Map reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICSMap reduce in Hadoop BIG DATA ANALYTICS
Map reduce in Hadoop BIG DATA ANALYTICS
Archana Gopinath
?
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and Visualization
Marjan Sterjev
?

More from Dilum Bandara (20)

Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
Dilum Bandara
?
Time Series Analysis and Forecasting in Practice
Time Series Analysis and Forecasting in PracticeTime Series Analysis and Forecasting in Practice
Time Series Analysis and Forecasting in Practice
Dilum Bandara
?
Introduction to Dimension Reduction with PCA
Introduction to Dimension Reduction with PCAIntroduction to Dimension Reduction with PCA
Introduction to Dimension Reduction with PCA
Dilum Bandara
?
Introduction to Descriptive & Predictive Analytics
Introduction to Descriptive & Predictive AnalyticsIntroduction to Descriptive & Predictive Analytics
Introduction to Descriptive & Predictive Analytics
Dilum Bandara
?
Introduction to Concurrent Data Structures
Introduction to Concurrent Data StructuresIntroduction to Concurrent Data Structures
Introduction to Concurrent Data Structures
Dilum Bandara
?
Introduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with HadoopIntroduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with Hadoop
Dilum Bandara
?
Embarrassingly/Delightfully Parallel Problems
Embarrassingly/Delightfully Parallel ProblemsEmbarrassingly/Delightfully Parallel Problems
Embarrassingly/Delightfully Parallel Problems
Dilum Bandara
?
Introduction to Warehouse-Scale Computers
Introduction to Warehouse-Scale ComputersIntroduction to Warehouse-Scale Computers
Introduction to Warehouse-Scale Computers
Dilum Bandara
?
Introduction to Thread Level Parallelism
Introduction to Thread Level ParallelismIntroduction to Thread Level Parallelism
Introduction to Thread Level Parallelism
Dilum Bandara
?
CPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching TechniquesCPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching Techniques
Dilum Bandara
?
Data-Level Parallelism in Microprocessors
Data-Level Parallelism in MicroprocessorsData-Level Parallelism in Microprocessors
Data-Level Parallelism in Microprocessors
Dilum Bandara
?
Instruction Level Parallelism ¨C Hardware Techniques
Instruction Level Parallelism ¨C Hardware TechniquesInstruction Level Parallelism ¨C Hardware Techniques
Instruction Level Parallelism ¨C Hardware Techniques
Dilum Bandara
?
Instruction Level Parallelism ¨C Compiler Techniques
Instruction Level Parallelism ¨C Compiler TechniquesInstruction Level Parallelism ¨C Compiler Techniques
Instruction Level Parallelism ¨C Compiler Techniques
Dilum Bandara
?
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
Dilum Bandara
?
Advanced Computer Architecture ¨C An Introduction
Advanced Computer Architecture ¨C An IntroductionAdvanced Computer Architecture ¨C An Introduction
Advanced Computer Architecture ¨C An Introduction
Dilum Bandara
?
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
Dilum Bandara
?
Introduction to Content Delivery Networks
Introduction to Content Delivery NetworksIntroduction to Content Delivery Networks
Introduction to Content Delivery Networks
Dilum Bandara
?
Peer-to-Peer Networking Systems and Streaming
Peer-to-Peer Networking Systems and StreamingPeer-to-Peer Networking Systems and Streaming
Peer-to-Peer Networking Systems and Streaming
Dilum Bandara
?
Mobile Services
Mobile ServicesMobile Services
Mobile Services
Dilum Bandara
?
Wired Broadband Communication
Wired Broadband CommunicationWired Broadband Communication
Wired Broadband Communication
Dilum Bandara
?
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
Dilum Bandara
?
Time Series Analysis and Forecasting in Practice
Time Series Analysis and Forecasting in PracticeTime Series Analysis and Forecasting in Practice
Time Series Analysis and Forecasting in Practice
Dilum Bandara
?
Introduction to Dimension Reduction with PCA
Introduction to Dimension Reduction with PCAIntroduction to Dimension Reduction with PCA
Introduction to Dimension Reduction with PCA
Dilum Bandara
?
Introduction to Descriptive & Predictive Analytics
Introduction to Descriptive & Predictive AnalyticsIntroduction to Descriptive & Predictive Analytics
Introduction to Descriptive & Predictive Analytics
Dilum Bandara
?
Introduction to Concurrent Data Structures
Introduction to Concurrent Data StructuresIntroduction to Concurrent Data Structures
Introduction to Concurrent Data Structures
Dilum Bandara
?
Introduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with HadoopIntroduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with Hadoop
Dilum Bandara
?
Embarrassingly/Delightfully Parallel Problems
Embarrassingly/Delightfully Parallel ProblemsEmbarrassingly/Delightfully Parallel Problems
Embarrassingly/Delightfully Parallel Problems
Dilum Bandara
?
Introduction to Warehouse-Scale Computers
Introduction to Warehouse-Scale ComputersIntroduction to Warehouse-Scale Computers
Introduction to Warehouse-Scale Computers
Dilum Bandara
?
Introduction to Thread Level Parallelism
Introduction to Thread Level ParallelismIntroduction to Thread Level Parallelism
Introduction to Thread Level Parallelism
Dilum Bandara
?
CPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching TechniquesCPU Memory Hierarchy and Caching Techniques
CPU Memory Hierarchy and Caching Techniques
Dilum Bandara
?
Data-Level Parallelism in Microprocessors
Data-Level Parallelism in MicroprocessorsData-Level Parallelism in Microprocessors
Data-Level Parallelism in Microprocessors
Dilum Bandara
?
Instruction Level Parallelism ¨C Hardware Techniques
Instruction Level Parallelism ¨C Hardware TechniquesInstruction Level Parallelism ¨C Hardware Techniques
Instruction Level Parallelism ¨C Hardware Techniques
Dilum Bandara
?
Instruction Level Parallelism ¨C Compiler Techniques
Instruction Level Parallelism ¨C Compiler TechniquesInstruction Level Parallelism ¨C Compiler Techniques
Instruction Level Parallelism ¨C Compiler Techniques
Dilum Bandara
?
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
Dilum Bandara
?
Advanced Computer Architecture ¨C An Introduction
Advanced Computer Architecture ¨C An IntroductionAdvanced Computer Architecture ¨C An Introduction
Advanced Computer Architecture ¨C An Introduction
Dilum Bandara
?
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
Dilum Bandara
?
Introduction to Content Delivery Networks
Introduction to Content Delivery NetworksIntroduction to Content Delivery Networks
Introduction to Content Delivery Networks
Dilum Bandara
?
Peer-to-Peer Networking Systems and Streaming
Peer-to-Peer Networking Systems and StreamingPeer-to-Peer Networking Systems and Streaming
Peer-to-Peer Networking Systems and Streaming
Dilum Bandara
?
Wired Broadband Communication
Wired Broadband CommunicationWired Broadband Communication
Wired Broadband Communication
Dilum Bandara
?

Recently uploaded (20)

TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & TipsTrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc
?
Unlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤EUnlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤E
Expeed Software
?
UiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and OpportunitiesUiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and Opportunities
DianaGray10
?
Endpoint Backup: 3 Reasons MSPs Ignore It
Endpoint Backup: 3 Reasons MSPs Ignore ItEndpoint Backup: 3 Reasons MSPs Ignore It
Endpoint Backup: 3 Reasons MSPs Ignore It
MSP360
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
Cloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in AviationCloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in Aviation
Assem mousa
?
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Jonathan Bowen
?
The Future of Repair: Transparent and Incremental by Botond De?nes
The Future of Repair: Transparent and Incremental by Botond De?nesThe Future of Repair: Transparent and Incremental by Botond De?nes
The Future of Repair: Transparent and Incremental by Botond De?nes
ScyllaDB
?
L01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardnessL01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardness
RostislavDaniel
?
Fl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free DownloadFl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free Download
kherorpacca127
?
Deno ...................................
Deno ...................................Deno ...................................
Deno ...................................
Robert MacLean
?
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
ScyllaDB
?
Backstage Software Templates for Java Developers
Backstage Software Templates for Java DevelopersBackstage Software Templates for Java Developers
Backstage Software Templates for Java Developers
Markus Eisele
?
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIATHE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
Srivaanchi Nathan
?
1.1. Evolution-and-Scope-of-Business-Analytics.pptx
1.1. Evolution-and-Scope-of-Business-Analytics.pptx1.1. Evolution-and-Scope-of-Business-Analytics.pptx
1.1. Evolution-and-Scope-of-Business-Analytics.pptx
Jitendra Tomar
?
Early Adopter's Guide to AI Moderation (Preview)
Early Adopter's Guide to AI Moderation (Preview)Early Adopter's Guide to AI Moderation (Preview)
Early Adopter's Guide to AI Moderation (Preview)
nick896721
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarterQ4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
MariaBarbaraPaglinaw
?
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOTSMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
TanmaiArni
?
TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & TipsTrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc Webinar - Building your DPIA/PIA Program: Best Practices & Tips
TrustArc
?
Unlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤EUnlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤E
Expeed Software
?
UiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and OpportunitiesUiPath Agentic Automation Capabilities and Opportunities
UiPath Agentic Automation Capabilities and Opportunities
DianaGray10
?
Endpoint Backup: 3 Reasons MSPs Ignore It
Endpoint Backup: 3 Reasons MSPs Ignore ItEndpoint Backup: 3 Reasons MSPs Ignore It
Endpoint Backup: 3 Reasons MSPs Ignore It
MSP360
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
Cloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in AviationCloud of everything Tech of the 21 century in Aviation
Cloud of everything Tech of the 21 century in Aviation
Assem mousa
?
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Jonathan Bowen
?
The Future of Repair: Transparent and Incremental by Botond De?nes
The Future of Repair: Transparent and Incremental by Botond De?nesThe Future of Repair: Transparent and Incremental by Botond De?nes
The Future of Repair: Transparent and Incremental by Botond De?nes
ScyllaDB
?
L01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardnessL01 Introduction to Nanoindentation - What is hardness
L01 Introduction to Nanoindentation - What is hardness
RostislavDaniel
?
Fl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free DownloadFl studio crack version 12.9 Free Download
Fl studio crack version 12.9 Free Download
kherorpacca127
?
Deno ...................................
Deno ...................................Deno ...................................
Deno ...................................
Robert MacLean
?
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
ScyllaDB
?
Backstage Software Templates for Java Developers
Backstage Software Templates for Java DevelopersBackstage Software Templates for Java Developers
Backstage Software Templates for Java Developers
Markus Eisele
?
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIATHE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
Srivaanchi Nathan
?
1.1. Evolution-and-Scope-of-Business-Analytics.pptx
1.1. Evolution-and-Scope-of-Business-Analytics.pptx1.1. Evolution-and-Scope-of-Business-Analytics.pptx
1.1. Evolution-and-Scope-of-Business-Analytics.pptx
Jitendra Tomar
?
Early Adopter's Guide to AI Moderation (Preview)
Early Adopter's Guide to AI Moderation (Preview)Early Adopter's Guide to AI Moderation (Preview)
Early Adopter's Guide to AI Moderation (Preview)
nick896721
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarterQ4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
Q4_TLE-7-Lesson-6-Week-6.pptx 4th quarter
MariaBarbaraPaglinaw
?
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOTSMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
SMART SENTRY CYBER THREAT INTELLIGENCE IN IIOT
TanmaiArni
?

Hard to Paralelize Problems: Matrix-Vector and Matrix-Matrix

  • 1. Hard to Parallelize Problems CS5225 Parallel and Concurrent Programming Dilum Bandara Dilum.Bandara@uom.lk Some slides adapted from Dr. Srinath Perera
  • 2. Problems ? Matrix-Vector Multiplication ? 1D assignment ? 2D Assignment ? Matrix-Matrix Multiplication 2
  • 3. Matrix-Vector Multiplication ? If x is copied to all processors, parallel solution is trivial ? Assign each row to a processor & calculate, & reduce to output results ? Expensive if read vector from a file ? Alternatives ? Each process reads parts of data & writes part of the results ? 1D & 2D Assignment 3
  • 4. 1D Assignment ? Each processor is given a row ? Vector is broken down between processors ? Vector is distributed to all through processor via all-to- all broadcast ? Each vector writes its part of the results 4
  • 6. 1D Assignment ¨C MPI Based Implementation ? For i-th process a[i] = read(a[i]); //read row i x = read(x[i]); //read part of vector MPI_allgather(x, allx); y = CalculateY(a[i], allx); Write(y); 6
  • 7. 2D Assignment ? Distributed across n2 processors & vector is distributed across leftmost n processors ? Solution ? Each (i, n)-th processor sends to (i, i) processor ? Each (i, i) processor broadcasts over the column ? Calculates results ? Reduce results across rows 7
  • 9. 2D Assignment (Cont.) For (i, j)-th process a[x][y] = read(a[x][y]); If(j == n) x = read(x[i]); MPI_Send(x, (i, i)) If(i == j){ MPI_Receive(&block) MPI_Broadcast(block, j); blockRecv = block; } else{ //receive block from others MPI_Broadcast(&block, 1, &blockRecv, 1, (j, j)); } y(I, j ) = Calculate(); //reduce it at the 0th on earch row MPI_REDUCE(y(I, j), 1, &resultrcv, 1, (i, 0)); write(&resultrcv); 9
  • 10. Vector-Matrix Multiplication with Map-Reduce ? If vector fits in memory ? Map ? Send vector & a row to each map task & send to (i, result) ? Reduce ? Print final results 10
  • 11. Vector-Matrix Multiplication with Map-Reduce (Cont.) ? If vector does not fit in memory ? Use 1D or 2D Assignments depending on size ? Map ? Send vector & a row to each map task & send to (i, result) ? If it doesn¡¯t fit ? Send part of vector & part of row to each map task & send to (i, result) ? Reduce ? Print final results ? Refer to ¡°2.3.1 Matrix-Vector Multiplication by Map- Reduce¡± in the Mining large data sets book 11
  • 12. ? Map ? Make (key, value) pairs out of matrices mij & njk ? Produce (j, (M, i, mij) and (j, (N, k, njk) ? Reduce ? Produce for each j (j, (i, k, mij, njk)) ? Map again ? Produce [((i1, k1), m1j*nj1), ((i2, k2), m2j*nj2), ¡­, ((ip, kp), mpj*njp)] ? Reduce again ? For each (i, k) pair sum all & produce ((i, k), v) Matrix-Matrix Multiplication 12

Editor's Notes

  • #2: Shovel example