tau

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
tau [2014/03/28 09:57] – [Example] admintau [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  ''module avail tau'' to view installed versions. 
- 
-  
-===== TAU usage and displaying tools ===== 
- 
-  * **Dynamic Instrumentation**: No change to your application's source or binary code is necessary. Using the tau_exec command before your executable generates both profile and trace data. 
-  * **Compiler-Based Instrumentation**: TAU can also be used to compile your application using wrapper scripts for ''mpicc'', ''mpicxx'', and ''mpif90''. Tau instruments the binary code without changing the source. Using the ''tau_exec'' command before the TAU-compiled executable generates profile and trace data. Data is collected on both ''MPI'' calls and your application's function calls. 
- 
-==== Dynamic Instrumentation ==== 
- 
-  - Load the needed tau <code bash>$ module load tau/ompi-gcc</code> 
-  - Compile <code bash>$ mpicc hello.c -o hello</code> 
-  - Dynamic instrumentation <code bash>$ mpirun -np $NSLOTS tau_exec -T TRACE ./hello</code>  
-  - Run TAU's recompiling tool <code>$ tau_treemerge.pl</code> 
-  - 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</code> 
-  - Now just open the new merged file with the default displaying tool <code bash>$ jumpshot tau.slog2</code> 
- 
-==== Compiler-Based Instrumentation==== 
- FIXME TODO 
- 
-==== Example ==== 
- 
-Let's trace MPI call functions for the next program (simple Jacobi iteration) 
- 
-<code C> 
-#include <stdio.h> 
-#include <math.h> 
-#include "mpi.h" 
- 
-/* 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     diffnorm, gdiffnorm; 
-    double     xlocal[(12/4)+2][12]; 
-    double     xnew[(12/3)+2][12]; 
- 
-    MPI_Init( &argc, &argv ); 
- 
-    MPI_Comm_rank( MPI_COMM_WORLD, &rank ); 
-    MPI_Comm_size( MPI_COMM_WORLD, &size ); 
- 
-    if (size != 4) MPI_Abort( MPI_COMM_WORLD, 1 ); 
- 
-    /* xlocal[][0] is lower ghostpoints, xlocal[][maxn+2] is upper */ 
- 
-    /* Note that top and bottom processes have one less row of interior 
-       points */ 
-    i_first = 1; 
-    i_last  = maxn/size; 
-    if (rank == 0)        i_first++; 
-    if (rank == size - 1) i_last--; 
- 
-    /* Fill the data as specified */ 
-    for (i=1; i<=maxn/size; 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 &xlocal[i][0] */ 
- if (rank < size - 1)  
-     MPI_Send( xlocal[maxn/size], maxn, MPI_DOUBLE, rank + 1, 0,  
-       MPI_COMM_WORLD ); 
- if (rank > 0) 
-     MPI_Recv( xlocal[0], maxn, MPI_DOUBLE, rank - 1, 0,  
-       MPI_COMM_WORLD, &status ); 
- /* 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/size+1], maxn, MPI_DOUBLE, rank + 1, 1,  
-       MPI_COMM_WORLD, &status ); 
-  
- /* Compute new values (but not on boundary) */ 
- itcnt ++; 
- diffnorm = 0.0; 
- for (i=i_first; i<=i_last; i++)  
-     for (j=1; j<maxn-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<=i_last; i++)  
-     for (j=1; j<maxn-1; j++)  
- xlocal[i][j] = xnew[i][j]; 
- 
- MPI_Allreduce( &diffnorm, &gdiffnorm, 1, MPI_DOUBLE, MPI_SUM, 
-        MPI_COMM_WORLD ); 
- gdiffnorm = sqrt( gdiffnorm ); 
- if (rank == 0) printf( "At iteration %d, diff is %e\n", itcnt,  
-        gdiffnorm ); 
-    } while (gdiffnorm > 1.0e-2 && itcnt < 100); 
- 
-    MPI_Finalize( ); 
-    return 0; 
-} 
- 
-</code> 
- 
-<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 
- 
-</code> 
- 
-{{:tau1.png?800|}} {{:tau2.png?400 |}} 
- 
  
  • tau.1396000666.txt.gz
  • Dernière modification : 2015/02/25 08:45
  • (modification externe)