Upload the Assignment Here

This assignment is a continuation of the inclass fitting exercise we did to the weekly gasoline consumption data. In this case, we are only interested in finding the minimum chi2 value for the first 600 data points, by using a 7 variable fit.



We have written the code for you.


In this exercise you are turn in the following 4 elements:


    a) keep track of the timings as a function of the number of iterations at constant number of processors and make a plot of timing vs iterations. Iterations should be 1000,1E4,1E5,1E6,1E7,1E8,1E9 running on 4 processors (don't want to overwhelm aciss)

    b) fix the number of iterations at 1E6 (one million) but change the number of processors in the mpirun commmand and then make a plot of timing vs number of processors. Choose processor steps of 2,4,8, 12 and 16.

    c) Produce a plot of the best solution you obtain against the data using gnuplot (explicit example below) by using 8 processors and as many iterations as you want to find the minimum chi squared value.

    d) take a look at the actual code (fit_data.f90) and write a one paragraph explanation of how you think this code is finding the minimum solution. Include the value of chi^2 that you found and how many iterations that you used.

    We will discuss a) and b) and d) in class on friday a bit.



Explicit procedure:

  1. you need to be in virtual box or equivalent

  2. ssh -X username@aciss (-X flag is important so that gnuplot window is launched on your client)

  3. qsub -I (to reserve a node for this so your not running on the head node)

  4. in the aciss shell execute these commands:
      mkdir ex7
      cd ex7
      cp ~dkmatter/sciprog/craig/* .
      module load mpi-tor/openmpi-1.7_gcc-4.8
      module list (check that modules got loaded)
      make check


    If the make check command generated output, then all is well.

  5. now you need to execute the following command line; in this case we are asking for 2 processors:

    time mpirun -np 2 fit_data 100000


    The time command will output at the very end the wall clock time. For instance, the 2 processor command above should return a time of about 5 seconds for 100000 iterations. Check that this true for you. (there will be some variations depending on what node your assigned by qsub)

  6. The output files that are generated are all named:

    fort.xx; where xx is indexed with respect to the rank (number of processors requested) starting at 21. Therefore for np 2 you would get fort.21 and fort.22 as the only output files.

    Executing the following commands will turn the individual files into one file.


      touch nohair

      cat fort.2* >> nohair


    For part c) find the lowest value of chi squared in the nohair file and note the solution. The chi square value is in the third column of the output. Run the fortran progam called rplot to enter your parameters from you minimum solution (source code = read.f90)

    Open gnuplot by typing gnuplot

      within gnuplot

      set yrange [6000:10000]

      plot "fort.20" , "fort.35"


      Now you have produced the plot to turn in for part C.

    DON'T FORGET ABOUT PART D ABOVE