Practical: Working environment
------------------------------ 

 1. Your working directory: cd ~/CG/01
 
 2. Choose your task: {task} (out of 01 02 03 04 05 06 07 08 09 10 11 12 15)
 
 3. Fetch your skeleton:   cp  ~/CG/skel/cg_{task}.c  . 
 
 4. Add your code, compile, run and test it (correct result?, same as serial result?)
 
 5. If your task works:
    extract your part (from   /*== task_ii begin ==*/  to  /*== task_ii end ==*/ )
    into  cgp{task}.c
 
 6. When all groups have finished, everyone can check the total result with:
    ls -l ../*/cgp*.c
    cat ~/../zhrvu16/CG/00/cgp00.c  ~/../zhrvu*/CG/01/cgp01.c   ~/../zhrvu*/CG/01/cgp02.c  \
        ~/../zhrvu*/CG/01/cgp03.c   ~/../zhrvu*/CG/01/cgp04.c   ~/../zhrvu*/CG/01/cgp05.c  \
        ~/../zhrvu*/CG/01/cgp06.c   ~/../zhrvu*/CG/01/cgp07.c   ~/../zhrvu*/CG/01/cgp08.c  \
        ~/../zhrvu*/CG/01/cgp09.c   ~/../zhrvu*/CG/01/cgp10.c   ~/../zhrvu*/CG/01/cgp11.c  \
        ~/../zhrvu*/CG/01/cgp12.c   ~/../zhrvu16/CG/00/cgp13.c  ~/../zhrvu16/CG/00/cgp14.c \
        ~/../zhrvu*/CG/01/cgp15.c   ~/../zhrvu16/CG/00/cgp16.c > cg_all.c
 
    Caution: - duplicate parts must be selected by hand ({nr} instead of *)
             - missing parts may be fetched also from ../source/parts/cgp{task}.c

 7. Compile and run cg_all.c

    - on T3E:
      cc -o cg_all cg_all.c -lm          (compile)
      fpart                              (to look whether there are free CPUs)
      mpirun -np 4 ./cg_all              (run parallel)

    - on many other platforms
      cc -o cg_all cg_all.c -lm -lmpi    (compile)
      mpirun -np 4 ./cg_all              (run parallel)
 
    - on non-MPI platforms:
      cc -Dserial -o cg_all cg_all.c -lm (compile)
      ./cg_all                           (run serial)
 

Practical: Options
------------------ 

Compile-time options [default]:
-Dserial              compile without MPI and without distribution [parallel]
Run-time options [default]:
-m {m}                vertical dimension of physical heat area [4]
-n {n}                horizontal dimension  [4]
-imax {iter_max}      maximum number of iterations in the CG solver [500]
-eps {epsilon}        abort criterion of the solver for residual vector [1e-6]
-twodims              choose 2-dimensional domain decomposition [1-dim]
-mprocs {m_procs}     choose number of processors, vertical, (-twodims needed) 
-nprocs {n_procs}     and horizontal [given by MPI_Dims_create]
-prtlev 0|1|2|3|4|5   printing and debug level [1]:
                        1 = only || result – exact solution || and partial result matrix
                        2 = and residual norm after each iteration
                        3 = and result of physical heat matrix
                        4 = and all vector and matrix information in 1st iteration
                        5 = and in all iterations

Example: mpirun -np 4 ./cg_all -m 200 -n 200 -twodims