Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| tau [2014/03/28 14:53] – [Compiler-Based Instrumentation] admin | tau [2015/02/27 13:28] (Version actuelle) – supprimée admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== TAU ====== | ||
| - | |||
| - | TAU is an MPI program analyzer. It generates all necessary information during the program | ||
| - | execution, so that it can be read after it and displayed by a specialized program. | ||
| - | |||
| - | |||
| - | |||
| - | ===== Installed version ===== | ||
| - | |||
| - | * 2.23 compiled with GCC and Open MPI | ||
| - | * 2.23 compiled with ICC and Open MPI | ||
| - | |||
| - | use '' | ||
| - | |||
| - | example : | ||
| - | |||
| - | <code bash> | ||
| - | |||
| - | $ module avail tau | ||
| - | |||
| - | tau/ | ||
| - | |||
| - | </ | ||
| - | |||
| - | ===== TAU usage and displaying tools ===== | ||
| - | |||
| - | * **Dynamic Instrumentation**: | ||
| - | * **Compiler-Based Instrumentation**: | ||
| - | |||
| - | ==== Dynamic Instrumentation ==== | ||
| - | |||
| - | - Load the needed tau <code bash>$ module load tau</ | ||
| - | - Compile <code bash>$ mpicc hello.c -o hello</ | ||
| - | - Dynamic instrumentation <code bash>$ mpirun -np $NSLOTS tau_exec -T TRACE ./ | ||
| - | - Run TAU's recompiling tool < | ||
| - | - After this it will have generated some output files, merge them with the next command <code bash>$ tau2slog2 tau.trc tau.edf -o tau.slog2</ | ||
| - | - Now just open the new merged file with the default displaying tool <code bash>$ jumpshot tau.slog2</ | ||
| - | |||
| - | ==== Compiler-Based Instrumentation==== | ||
| - | |||
| - | For each compiler type there is TAU wrapper, for example: | ||
| - | |||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | |||
| - | Tau warapper sues '' | ||
| - | |||
| - | - Compile programs <code bash> | ||
| - | - Run program as usual <code bash> | ||
| - | - | ||
| - | |||
| - | ==== Example ==== | ||
| - | |||
| - | Let's trace MPI call functions for the next program (simple Jacobi iteration) | ||
| - | |||
| - | <code C> | ||
| - | #include < | ||
| - | #include < | ||
| - | #include " | ||
| - | |||
| - | /* This example handles a 12 x 12 mesh, on 4 processors only. */ | ||
| - | #define maxn 12 | ||
| - | |||
| - | int main( argc, argv ) | ||
| - | int argc; | ||
| - | char **argv; | ||
| - | { | ||
| - | int rank, value, size, errcnt, toterr, i, j, itcnt; | ||
| - | int i_first, i_last; | ||
| - | MPI_Status status; | ||
| - | double | ||
| - | double | ||
| - | double | ||
| - | |||
| - | MPI_Init( &argc, &argv ); | ||
| - | |||
| - | MPI_Comm_rank( MPI_COMM_WORLD, | ||
| - | MPI_Comm_size( MPI_COMM_WORLD, | ||
| - | |||
| - | if (size != 4) MPI_Abort( MPI_COMM_WORLD, | ||
| - | |||
| - | /* xlocal[][0] is lower ghostpoints, | ||
| - | |||
| - | /* Note that top and bottom processes have one less row of interior | ||
| - | | ||
| - | i_first = 1; | ||
| - | i_last | ||
| - | if (rank == 0) i_first++; | ||
| - | if (rank == size - 1) i_last--; | ||
| - | |||
| - | /* Fill the data as specified */ | ||
| - | for (i=1; i< | ||
| - | for (j=0; j<maxn; j++) | ||
| - | xlocal[i][j] = rank; | ||
| - | for (j=0; j<maxn; j++) { | ||
| - | xlocal[i_first-1][j] = -1; | ||
| - | xlocal[i_last+1][j] = -1; | ||
| - | } | ||
| - | |||
| - | itcnt = 0; | ||
| - | do { | ||
| - | /* Send up unless I'm at the top, then receive from below */ | ||
| - | /* Note the use of xlocal[i] for & | ||
| - | if (rank < size - 1) | ||
| - | MPI_Send( xlocal[maxn/ | ||
| - | MPI_COMM_WORLD ); | ||
| - | if (rank > 0) | ||
| - | MPI_Recv( xlocal[0], maxn, MPI_DOUBLE, rank - 1, 0, | ||
| - | MPI_COMM_WORLD, | ||
| - | /* Send down unless I'm at the bottom */ | ||
| - | if (rank > 0) | ||
| - | MPI_Send( xlocal[1], maxn, MPI_DOUBLE, rank - 1, 1, | ||
| - | MPI_COMM_WORLD ); | ||
| - | if (rank < size - 1) | ||
| - | MPI_Recv( xlocal[maxn/ | ||
| - | MPI_COMM_WORLD, | ||
| - | |||
| - | /* Compute new values (but not on boundary) */ | ||
| - | itcnt ++; | ||
| - | diffnorm = 0.0; | ||
| - | for (i=i_first; i< | ||
| - | for (j=1; j< | ||
| - | xnew[i][j] = (xlocal[i][j+1] + xlocal[i][j-1] + | ||
| - | xlocal[i+1][j] + xlocal[i-1][j]) / 4.0; | ||
| - | diffnorm += (xnew[i][j] - xlocal[i][j]) * | ||
| - | (xnew[i][j] - xlocal[i][j]); | ||
| - | } | ||
| - | /* Only transfer the interior points */ | ||
| - | for (i=i_first; i< | ||
| - | for (j=1; j< | ||
| - | xlocal[i][j] = xnew[i][j]; | ||
| - | |||
| - | MPI_Allreduce( & | ||
| - | | ||
| - | gdiffnorm = sqrt( gdiffnorm ); | ||
| - | if (rank == 0) printf( "At iteration %d, diff is %e\n", itcnt, | ||
| - | | ||
| - | } while (gdiffnorm > 1.0e-2 && itcnt < 100); | ||
| - | |||
| - | MPI_Finalize( ); | ||
| - | return 0; | ||
| - | } | ||
| - | |||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | |||
| - | $ module load tau | ||
| - | |||
| - | $ mpicc jacobi.s -o jacobi | ||
| - | |||
| - | $ mpirun -np 4 ./jacobi | ||
| - | |||
| - | $ tau_treemerge.pl | ||
| - | |||
| - | $ tau2slog2 tau.trc tau.edf -o tau.slog2 | ||
| - | |||
| - | $ jumpshot tau.slog2 | ||
| - | |||
| - | </ | ||
| - | |||
| - | {{: | ||
| - | |||