Find Jobs
Hire Freelancers

Parallel program question answer

$15-20 AUD

Terminado
Publicado hace más de 10 años

$15-20 AUD

Pagado a la entrega
Need answers for the questions of the 2 parallel programs given below. Needed within 18-20 hours ans it shouldn't be a problem for someone who did parallel programming. Max. $20 will be accepted. Program 1: Consider the following fragment of a parallel program. MPI_Comm_rank(MPI_COMM_WORLD, &procnum); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); // COMMENT 1 right = procnum + 1; if (right == numprocs) right = 0; left = procnum - 1; if (left == -1) left = numprocs-1; sum = 0; value = procnum; for (i = 0; i < numprocs; i++) { // COMMENT 2 MPI_Send(&value,1,MPI_INT,right,tag,MPI_COMM_WORLD); MPI_Recv(&new_value,1,MPI_INT,left,tag,MPI_COMM_WORLD,&status); // COMMENT 3 sum = sum + new_value; value = new_value; } // COMMENT 4 if (procnum == 0) { printf ("%d\n", sum); } (a) For each of the four lines listed as comments, such as COMMENT 1 etc, write down the comment number and then a short explanation of the lines of code underneath that comment. For example, for COMMENT 1, explain the two subsequent lines, before the blank line. (b) Explain the purpose of the for loop. (c) Draw a diagram showing the flow of messages between processes in an execution of the program. Assume four processes. Program 2:Consider the following parallel program (as presented in lectures): #include mpi.h #include <stdio.h> #include <math.h> #define MAXSIZE 1000 void main(int argc, char *argv[]){ int myid,numprocs; int data[MAXSIZE], i, x, low, high, myresult, result; char fn[255]; char *fp; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&numprocs); MPI_Comm_rank(MPI_COMM_WORLD,&myid); if (my_id == 0){ strcpy(fn,getenv(HOME)); strcat(fn,/MPI/[login to view URL]); if((fp = fopen(fn,r)) == NULL){ printf(Cant open the input file); exit(1); } for (i=0; i < MAXSIZE; i++) fscanf(fp,%d,&data[i]); MPI_Bcast(data,MAXSIZE,MPI_INT,0,MPI_COMM_WORLD); x = MAXSIZE / numprocs; low = myid * x; high = low + x; for(i = low; i < high; i++) myresult += data[i]; printf(I got %d from %d\n,myresult, myid); MPI_Reduce(&myresult,&result,1,MPI_INT,MPI_SUM,0, MPI_COMM_WORLD); if (myid == 0) printf(the sum is %d.\n,result); MPI_Finalize(); }} (a) Show how the program can be initiated with five processes in use. (b) Identify clearly which code is executed by which processes. (c) What is the significance of the communicator in the call to MPI Bcast? (d) Draw a diagram to show the process structure in the executing program. (e) Draw a series of diagrams to show how the computation proceeds. Identify parts executed in parallel, and code executed sequentially. (f) Can the final reduce be done in parallel? Explain.
ID del proyecto: 5120527

Información sobre el proyecto

3 propuestas
Proyecto remoto
Activo hace 11 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Hi! I am well familiar with MPI concepts. I can answer those questions providing high-quality solution to each of them.
$20 AUD en 3 días
0,0 (0 comentarios)
0,0
0,0
3 freelancers están ofertando un promedio de $22 AUD por este trabajo
Avatar del usuario
Parallel programmer with experience in MPI. I can answer the question and explain the code. I know MPI from university, where we used MPICH2 to run distributed programs.
$25 AUD en 0 día
4,9 (36 comentarios)
4,8
4,8
Avatar del usuario
I've 3+ years experience working in c , Perl. I can do it....................................................................
$20 AUD en 2 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de AUSTRALIA
Brisbane, Australia
4,9
52
Forma de pago verificada
Miembro desde oct 20, 2013

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.