Lecture Note
University:
Boston UniversityCourse:
MET CS 201 | Introduction to ProgrammingAcademic year:
2023
Views:
499
Pages:
15
Author:
seksfeltsryup
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
Get your assignment done in just 3 hours. Quick, easy, and available 24/7.
Report
Tell us what’s wrong with it:
Thanks, got it!
We will moderate it soon!
Our EduBirdie Experts Are Here for You 24/7! Just fill out a form and let us know how we can assist you.
Enter your email below and get instant access to your document