Lab04: Root Mean Square
Objective
Apply parallel techniques to loop/array processing.
Background
Root Mean Square = sqrt( (a[0]*a[0] + a[1]*a[1] + ... + a[n-1]*a[n-1])/n )
Download the file rms.c, a serial (non-parallel) program
to calculate the root mean square.
Assignment
Edit the file rms.c. Parallelize this program to use at least
4 processes. (split the array up into at least 4 sections, one section per process.
Have each node compute a node-total value for the sum of its terms, then use the
MPI reduce function to add all the node totals into a single world total using a single
command.
Sample Output (original program)
...
960 554 749 981 113 424 488 833 182 799 154 239 502 397 360 564
943 910 324 102 444 450 13 891 830 575 366 163 572 717 912 532
623 661 513 736 437 353 921 619 505 427 859 359 176 571 923 120
481 599 574 277 401 587 169 232 514 887 395 87 604 307 619 227
320 485 315 757 190 236 377 47 15 588 406 191 159 681 663 992
280 238 269 34 177 790 266 692 677 13 779 281 673 750 860 345
587 175 455 130 763 184 177 778 124 936 970 283 617 633 627 250
223 248 636 401 39 902 445 716 267 224 350 292 326 210 638 914
738 93 396 853 629 573 632 753 509 954 388 479 939 15 81 163
615 717 916 654 971 361 723 590 937 73 883 263 635 873 529 725
318 925 579 947 851 211 700 712 517 88 543 456 455 976 971 70
693 887 77 16...
RMS = 578.837337