OpenMP Lab01 CRAY SV1 Introductory Programs


Programming a "shared memory" system with threads
  • Fortran Resources

    Assignment

    1. Look over the Index and Introduction sections of this OpenMP Tutorial

    2. Compile and run parallel.f (Fortran!)
      • On the SV1: f90 -o parallel parallel.f -ffree
        (-ffree means free form syntax)
        (You can also use "ftn", there is a "man ftn")
      • To change the number of threads:
        • In bash: export OMP_NUM_THREADS=12 (for 12 threads)
        • Not in bash: setenv OMP_NUM_THREADS 12 (no = sign)

    3. Compile and run reduction.f
      • Explain what is happening, what is this "reduction" doing?

    4. Compile and run dodir.f
      • Note what is happening to the array indexes in each thread
      • Print out the values of array B after the parallel loop.
      • What are the following intrinsics:
        • RANDOM_NUMBER()
        • MAXVAL()
        • MAXLOC()
      • What is this program doing?

    5. Adapt your matrix multiply algorithm to this parallel loop