logo
  • Writing Services
    • Writing Services
      • Essays & Papers
      • Essay Service
      • Write my research paper
      • Apa paper writing service
      • Write my scholarship essay
      • Dissertation writing services
      • Coursework writing service
      • Homework & Assignment
      • Pay for homework
      • English assignment help
      • Do my assignment
      • Assignment help
      • Finance assignment help
      • Do my math homework
      • Spss assignment help
      • Do my homework
      • Biology assignment help
      • Chemistry assignment help
      • More services
      • Personal statement writing service
      • Do my excel assignment
      • Law essay writing service
      • Annotated bibliography writing service
      • Research proposal writing services
      • Nursing assignment help
      • Write my lab report
      • Capstone project writing service
      • Do my powerpoint presentation
  • Study Resources
    • Study Resources
      • Universities
      • Courses
      • Documents

Lecture Note

MPI Beginning Lecture - Introduction Pt 2

  • University:

    Boston University
  • Course:

    MET CS 201 | Introduction to Programming
  • Academic year:

    2023

  • Views:

    499

    Pages:

    15

  • Author:

    seksfeltsryup

Example 1 (Integration) We will introduce some fundamental MPI function calls through the computation of a simple integral by the Mid-point rule. b p 1 n 1  cos(x)dx    a i 0 j 0 ai  ( j 1)*h ai  j *h cos(x )dx   cos(aij ) * h;  h  (b  a) / p / n;  i 0   j 0 ai  a  i * n * h; aij  ai  ( j  0.5) * h p 1  n 1  p is number of partitions and n is increments per partition Example 1 - Serial fortran code Program Example1 implicit none integer n, p, i, j real h, integral_sum, a, b, integral, pi, ai pi = acos(-1.0) ! = 3.14159... a = 0.0 ! lower limit of integration b = pi/2. ! upper limit of integration p=4 ! number of partitions (processes) n = 500 ! number of increments in each partition h = (b-a)/p/n ! length of increment ai = a + i*n*h integral_sum = 0.0 ! Initialize solution to the integral do i=0,p-1 ! Integral sum over all partitions integral_sum = integral_sum + integral(ai,h,n) enddo print *,'The Integral =', integral_sum stop end . . Serial fortran code (cont’d) example1.f continues . . . real function integral(ai, h, n) ! This function computes the integral of the ith partition implicit none integer n, i, j ! i is partition index; j is increment index real h, h2, aij, ai integral = 0.0 ! initialize integral h2 = h/2. do j=0,n-1 ! sum over all "j" integrals aij = ai+ (j+0.5)*h ! lower limit of integration of “j” integral = integral + cos(aij)*h ! contribution due “j” enddo return end Example 1 - Serial C code #include #include float integral(float a, int i, float h, int n); void main() { int n, p, i, j, ierr; float h, integral_sum, a, b, pi, ai; pi = acos(-1.0); /* = 3.14159... * a = 0.; /* lower limit of integration */ b = pi/2.; /* upper limit of integration */ p = 4; /* # of partitions */ n = 500; /* increments in each process */ h = (b-a)/n/p; /* length of increment */ integral_sum = 0.0; for (i=0; i float integral(float ai, float h, int n); // prototyping void main(int argc, char* argv[]) { int n, p, myid, tag, proc, ierr; float h, integral_sum, a, b, ai, pi, my_int; int master = 0; /* processor performing total sum */ MPI_Comm comm; MPI_Status status; . . . Parallel C code (cont’d) comm = MPI_COMM_WORLD; ierr = MPI_Init(&argc,&argv); MPI_Comm_rank(comm, &myid); MPI_Comm_size(comm, &p); // starts MPI // get current process id // get number of processes pi = acos(-1.0); // = 3.14159... a = 0.; // lower limit of integration b = pi*1./2.; // upper limit of integration n = 500; // number of increment within each process tag = 123; // set the tag to identify this particular job h = (b-a)/n/p; // length of increment ai = a + myid*n*h; // lower limit of integration for partition myid my_int = integral(ai, h, n) // compute local sum due myid ... Parallel C code (cont’d) } printf("Process %d has the partial integral of %f\n", myid,my_int); MPI_Send(&my_int, 1, MPI_FLOAT, master, // message destination tag, // message tag comm); if(myid == master) { // Receives serialized integral_sum = 0.0; for (proc=0;proc { // if (!document.getElementById("doc-template-use").classList.contains("doc-template-use")) { // window.location = '/?redirect=login'; // return // } // } // // const redirectToRegister = () => { // if (!document.getElementById("doc-template-use").classList.contains("doc-template-use")) { // window.location = '/?redirect=register'; // return // } // } // const saveDocument = async () => { // if (!document.getElementById("doc-template-use").classList.contains("doc-template-use")) { // window.location = '/?redirect=login'; // return // } // // document.getElementById("save-button").classList.toggle("btn_selected") // document.getElementById("save-button-small").classList.toggle("btn_selected") // // try { // await fetch(`/api/user/saved-documents/${documentId}`, settings); // } catch (e) { // console.log(e) // } // } // // const saveReport = async () => { // let checkboxArray = [] // checkboxArray.push(document.getElementById("checkbox-1").checked) // checkboxArray.push(document.getElementById("checkbox-2").checked) // checkboxArray.push(document.getElementById("checkbox-3").checked) // checkboxArray.push(document.getElementById("checkbox-4").checked) // checkboxArray.push(document.getElementById("checkbox-5").checked) // // const reason = checkboxArray.findIndex((element) => element === true) + 1 // // try { // await fetch(`/api/reports`, {...settings, body: JSON.stringify({document: Number(documentId), reason})}); // closeReportModal() // openThankReportModal() // } catch (e) { // console.log(e) // } // } // const handleDownload = () => { // const downloadLink = JSON.parse(documentFileHash) // const url = `/download/${downloadLink}` // window.open(url, "_blank", "noreferrer"); // } const hideInfo = () => { if (window.innerWidth < 1279.98) { const button = document.querySelector(".document-details__title"); const hiddenDetailsItems = document.querySelectorAll(".hidden-details"); hiddenDetailsItems.forEach((item) => { item.classList.toggle("is-shown") }); button.classList.toggle("is-hidden"); } } const hideDescriptionPageInfo = () => { const button = document.getElementById("hide-button-des"); document.getElementById("description-block").classList.toggle("isShow") button.classList.toggle("is-hidden") button.innerText === "Hide description" ? button.innerHTML = "Show description" : button.innerHTML = "Hide description" } const hideDescriptionPage = () => { document.getElementById("description").classList.toggle("show") } const toggleSidebar = () => { document.getElementById("sidebar").classList.toggle("document-details_hidden"); document.body.classList.toggle( 'sidebar--closed' ); } const closeShareModal = () => { document.getElementById("share-modal").style.display="none" document.getElementById("share-modal2").style.display="none" document.getElementById("share-modal").classList.toggle("show") document.getElementById("share-modal2").classList.toggle("show") }

MPI Beginning Lecture - Introduction Pt 2

MPI Beginning Lecture - Introduction Pt 2 - Page 1
MPI Beginning Lecture - Introduction Pt 2 - Page 2
MPI Beginning Lecture - Introduction Pt 2 - Page 3
MPI Beginning Lecture - Introduction Pt 2 - Page 4
MPI Beginning Lecture - Introduction Pt 2 - Page 5
MPI Beginning Lecture - Introduction Pt 2 - Page 6
MPI Beginning Lecture - Introduction Pt 2 - Page 7
MPI Beginning Lecture - Introduction Pt 2 - Page 8
MPI Beginning Lecture - Introduction Pt 2 - Page 9
MPI Beginning Lecture - Introduction Pt 2 - Page 10
MPI Beginning Lecture - Introduction Pt 2 - Page 11
MPI Beginning Lecture - Introduction Pt 2 - Page 12
MPI Beginning Lecture - Introduction Pt 2 - Page 13
MPI Beginning Lecture - Introduction Pt 2 - Page 14
MPI Beginning Lecture - Introduction Pt 2 - Page 15
of 15
0/0

Recommended Documents

What is Artificial Intelligence
What is Artificial Intelligence
Boston University MET CS 201 | Introduction to Programming

Cheat Sheet

Introduction to Python Part 2
Introduction to Python Part 2
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction To C++ Part 1.1
Introduction To C++ Part 1.1
Boston University MET CS 201 | Introduction to Programming

Lecture Note

⏰ Deadline pressure?

Get your assignment done in just 3 hours. Quick, easy, and available 24/7.

Introduction To C++ Part 1.2
Introduction To C++ Part 1.2
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction to C++ Part 4 Lecture Note Chapter 2
Introduction to C++ Part 4 Lecture Note Chapter 2
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Cryptography History Activity
Cryptography History Activity
Boston University MET CS 201 | Introduction to Programming

Lecture Note

2D Shock Tube (Sod problem) in OpenFOAM (Figures)
2D Shock Tube (Sod problem) in OpenFOAM (Figures)
Boston University MET CS 201 | Introduction to Programming

Research

Introduction to Python Lecture Note
Introduction to Python Lecture Note
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction to C Part 3
Introduction to C Part 3
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction to C++ Lecture 1 Ch2
Introduction to C++ Lecture 1 Ch2
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Compressible Flow Analysis in a De Laval Nozzle
Compressible Flow Analysis in a De Laval Nozzle
Boston University MET CS 201 | Introduction to Programming

Lecture Note

GPU Programming in Python with PyOpenCL and PyCUDA Atomic Operations
GPU Programming in Python with PyOpenCL and PyCUDA Atomic Operations
Boston University MET CS 201 | Introduction to Programming

Lecture Note

New Documents from this Course

Git for Version Control and Collaboration Part 1
Git for Version Control and Collaboration Part 1
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction to MATLAB Lecture 4 Pt 1
Introduction to MATLAB Lecture 4 Pt 1
Boston University MET CS 201 | Introduction to Programming

Lab

Using Crash Hoare Logic for Certifying the FSCQ File System Ch 2
Using Crash Hoare Logic for Certifying the FSCQ File System Ch 2
Boston University MET CS 201 | Introduction to Programming

Lecture Note

WEB Design
WEB Design
Boston University MET CS 201 | Introduction to Programming

Research

To Change the PMG Problem Configuration
To Change the PMG Problem Configuration
Boston University MET CS 201 | Introduction to Programming

Research

Introduction to Matlab Parallel Computing Tooblox Pt 3
Introduction to Matlab Parallel Computing Tooblox Pt 3
Boston University MET CS 201 | Introduction to Programming

Case

A Scalable Framework for Acceleration of CNN Training on Deeply-Pipelined FPGA Clusters with Weight and Workload Balancing
A Scalable Framework for Acceleration of CNN Training on Deeply-Pipelined FPGA Clusters with Weight and Workload Balancing
Boston University MET CS 201 | Introduction to Programming

Research

Using Crash Hoare Logic for Certifying the FSCQ File System Ch 4
Using Crash Hoare Logic for Certifying the FSCQ File System Ch 4
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Using Crash Hoare Logic for Certifying the FSCQ File System Ch 3
Using Crash Hoare Logic for Certifying the FSCQ File System Ch 3
Boston University MET CS 201 | Introduction to Programming

Lecture Note

Introduction to MATLAB Lecture 4 Pt 2
Introduction to MATLAB Lecture 4 Pt 2
Boston University MET CS 201 | Introduction to Programming

Lab

Processing of 2D RGB and Depth Data into 3D Space
Processing of 2D RGB and Depth Data into 3D Space
Boston University MET CS 201 | Introduction to Programming

Research

Introduction to MATLAB Lecture 4 Pt 3
Introduction to MATLAB Lecture 4 Pt 3
Boston University MET CS 201 | Introduction to Programming

Lab

Fair Use Policy

EduBirdie considers academic integrity to be the essential part of the learning process and does not support any violation of the academic standards. Should you have any questions regarding our Fair Use Policy or become aware of any violations, please do not hesitate to contact us via support@edubirdie.com.

logo

Popular Services

  • Essay writing service
  • Pay someone to do my homework
  • Do my assignment for me
  • Research paper writing services
  • Dissertation writing services
  • Do my homework

Study Resources

  • Essay Examples
  • Blog
  • Study Notes

About Us

  • How it works?
  • Testimonials
  • FAQ
  • Money back guarantee

Contact us

mail icon
  • support@edubirdie.com
phone-icon
  • +3 (595) 691 8356
  • +1 (888) 337 5415
DMCA.com Protection Status

For press

  • Press and media
  • Brand assets
Facebook Twitter Instagram LinkedIn

Local sites

  • Ca.EduBirdie.com- The Best Essay Writing Service for Canadian Students

We accept

2024 © EduBirdie.com. All rights reserved

RADIOPLUS EXPERTS LTD. Louki Akrita, 23 Bellapais Court, Flat/Office 46 1100, Nicosia, Cyprus

Privacy Policy
|
Terms of Use
|
Fair use policy
Subscription rules
|
Referral program Rules
|
Payment policy

Report

Tell us what’s wrong with it:

Thanks, got it!
We will moderate it soon!

Report

Tell us what’s wrong with it:

Almost There!

Two easy ways to download this document

or
Upgrade to premium for unlimited access
Calendar Icon

Free up your schedule!

Our EduBirdie Experts Are Here for You 24/7! Just fill out a form and let us know how we can assist you.

Unlock Icon

Take 5 seconds to unlock

Enter your email below and get instant access to your document

This field is required
Please enter a valid email address
This field is required
This field is required

By clicking 'Sign Up', you agree to our Terms and Conditions and Privacy Policy.