Question: Need help with a mpi program written in c Write a program named parallelSum.c to complete the following tasks. (a) Each processor will compute and
Need help with a mpi program written in c
Write a program named parallelSum.c to complete the following tasks.
(a) Each processor will compute and print out a partial sum of N/p consecutive integers, where N and p are the total number of integers and the number of processors respectively. You can set N=1,000 in your program and define p=10 processors in PBS job script file, then processor 0 will print out the partial sum of 1+2++100, processor 1 will print out the partial sum of 101+102++200), , and processor 9 will print out the partial sum of 901+902++1,000. (Note: You can declare a constant N=1,000 or use preprocessing statement #define N 1000.)
(c) All processors except processor 0 send their partial sums to processor 0 and print this message.
(d) After processor 0 receives the partial sums from other processors, it will print out the confirmation message to have received the value, add up all the partial sums including its own partial sum, and print out the total sum, the value of 1+2+3+ +1,000).
create a job script named myjob and use 10 nodes to run your program. You can copy the job script file given in lab1 below, and then modify it accordingly.
#!/bin/bash
#PBS -N job3
#PBS -q production
#PBS -l select=8:ncpus=1
#PBS -l place=free
#PBS -V
cd $PBS_O_WORKDIR
mpirun -np 8 -machinefile $PBS_NODEFILE ./hello
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
