Generate a random integer in the range

Assignment Help C/C++ Programming
Reference no: EM13757664

Write a parallel program with MPI functions to do the following

1) Define an array of size 1000.

2) Generate a random integer in the range of: 0 t0 999 for: n.

3) Generate n random integers in the range of: 0 to 1000 and save them in array.

4) For m (its value comes from the input) processes divide that array to (m-1) segments. All the segments except the last one must be equal (Note that the last segment may get bigger than other segments)

5) Each of process p1, p2, p3,..., pm-1 obtains the biggest number from its segment and send it to the process with rank = 0.

6) Process 0 receives a number from each process: p1, p2, p3,..., pm-1, finds the biggest number and print it.

Note: If m -1 is bigger n terminate the execution of the program with an appropriate message the shows the value of m-1 and n.

The following is a serial program. It may help.

//File name: a.c

#include <stdio.h>

#include <time.h>

#include <stdlib.h>

#define atmost 1000

int find(int* a, int from, int to){
int i, b;
printf("%d----%d\n", from,to);
b = a[from];
for(i = from + 1; i <= to; i++)
if(a[i] > b)
b = a[i];

Reference no: EM13757664

Questions Cloud

What is gross domestic product : What is Gross Domestic Product and What is included in this statistic? What is excluded? Give two examples of goods or services that are included in GDP and two examples of goods or services that are excluded
New business venture-planning phase : Discuss how a SWOT analysis should be used as an analytical tool that can help you work through all the information you have about your business. Why should an entrepreneur conduct a SWOT analysis during his/her new business venture-planning phase?
Write a research essay on japanese kabuki theatre : Write a research essay on Japanese Kabuki Theatre, Christopher Marlowe: The Other Elizabethan Playwright, London's Historic Drury Lane Theatre, American Musicals by Stephen Sondheim and Theatre in Prisons.
Performance appraisals : What purpose do they serve under a performance management system? Performance appraisals – are they necessary or not?
Generate a random integer in the range : Write a parallel program with MPI functions, Define an array of size 1000. Generate a random integer in the range of: 0 t0 999 for: n. Generate n random integers in the range of: 0 to 1000 and save them in array.
Chemlabs uses raw materials : Chemlabs uses raw materials I and II to produce two domestic cleaning solutions, A and B. the daily availability of raw material I and II are 150 and 145 units, respectively. One unit of A consumes 0.5 units of I and 0.6 of II. One units of B consume..
Talks about the employee specific security : Following standard talks about the employee specific security, Following standard has good information on setting up IT security policies
Capacity utilization and quality in a service operation : Describe the relationship between capacity utilization and quality in a service operation. Describe the similarities and differences between a workcenter manufacturing process and an assembly line manufacturing process. Describe the similarities and ..
The wireless lan technology had a profound impact : The wireless LAN technology (IEEE802.11x standards) has had a profound impact in short-range communications. Other wireless technologies, particularly Bluetooth, Zigbee, IrDA, RFID and NFC offer shorter-range communication services for various typ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Manipulate various types of accounts

Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write. Anot..

  Write a mips program that uses a recursive implementation

Write a MIPS program that uses a recursive implementation of quick sort to sort an array of numbers. The values of the array will be given to you via standard input. The first number will be the number of elements in the array and followed by the ..

  Modify the circuit of figure by rewriting the pld program

Modify the circuit of Figure by rewriting the PLD program to address memory in locations A0000H-BFFFFH for the ROM

  Draws a pyramid consisting of bricks

Write a C program that draws a pyramid consisting of bricks arranged in horizontal rows, so that the number of bricks in each row decreases by one as you move up the pyramid.

  Write a program that will calculate the percentage

Write a program that will calculate the percentage wins of a team. The program will input the number of wins and losses that a team acquired during a season. The wins should be input in a parameter-less value returning function that returns the wi..

  You are required to prepare a program for assessment system

you are required to prepare a program for assessment system of a university. the main idea is to evaluate the gpa

  Read integers values one at a time from standard input

Write a C++ program to do the following. The program will read integers values one at a time from standard input (cin) until you read the value 150.

  Write a program that converts each name

You are given a file consisting of students? names in the following form: lastName, firstName middleName. (Note that a student may not have a middle name.) Write a program that converts each name to the following form: firstName middleName lastNam..

  Dealerships are awarded the rebate

Dealerships are awarded the rebate on a quarter-by-quarter basis, only for quarters where their actual sales exceeded expected volumes for that quarter. Expected sales volumes for each quarter are as follows:

  Lab-1the goal of this lab is to better familiarize you with

lab-1the goal of this lab is to better familiarize you with polymorphism and the factory design pattern two key

  Two types of constructors

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  Write a program in which set up a douhly-subscripted array

Write a program in which you set up a douhly-subscripted array to store each character in the wit. Ube ;old loops, and the most efficient  statements to do it. Include documentation (comment stmts.) in your program.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd