Commit 37c16d5b authored by Camille Coti's avatar Camille Coti
Browse files

Added some profiling elements with TAU (disabled by default)

parent a5f4f5e6
...@@ -3,6 +3,31 @@ ...@@ -3,6 +3,31 @@
#ifdef TAUPROF #ifdef TAUPROF
double previous = 0; double previous = 0;
double getTimeSpent( void* ptr ){
long calls, childcalls;
double incl[TAU_MAX_COUNTERS], excl[TAU_MAX_COUNTERS];
const char **counters;
int numcounters, j;
TAU_PROFILER_GET_CALLS(ptr, &calls);
TAU_PROFILER_GET_CHILD_CALLS(ptr, &childcalls);
TAU_PROFILER_GET_INCLUSIVE_VALUES(ptr, &incl);
TAU_PROFILER_GET_EXCLUSIVE_VALUES(ptr, &excl);
TAU_PROFILER_GET_COUNTER_INFO(&counters, &numcounters);
printf("Calls = %ld, child = %ld\n", calls, childcalls);
printf("numcounters = %d\n", numcounters);
for (j = 0; j < numcounters ; j++) {
printf(">>>");
printf("counter [%d] = %s\n", j, counters[j]);
printf(" excl [%d] = %g, incl [%d] = %g\n", j, excl[j], j, incl[j]);
}
return incl[0];
}
double getTimeSpent( const char* cnt ){ double getTimeSpent( const char* cnt ){
const char **inFuncs; const char **inFuncs;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define TAU_STOP( a ) do { ;; } while( 0 ); #define TAU_STOP( a ) do { ;; } while( 0 );
#endif // TAUPROF #endif // TAUPROF
double getTimeSpent( void* );
double getTimeSpent( const char* ); double getTimeSpent( const char* );
uint64_t rdtsc( void ); uint64_t rdtsc( void );
......
...@@ -106,7 +106,12 @@ gi::ex multiply_1level( tensor3D_t& T, matrix_int_t& J, int size ) { // simpler ...@@ -106,7 +106,12 @@ gi::ex multiply_1level( tensor3D_t& T, matrix_int_t& J, int size ) { // simpler
j = 0; j = 0;
double time; double time;
#ifdef TAUPROF
void* ptr;
TAU_PROFILER_CREATE( ptr, "b","", TAU_USER );
#endif
for( a1 = 0 ; a1 < size; a1++ ){ for( a1 = 0 ; a1 < size; a1++ ){
i=i+1; i=i+1;
// std::cout << "Tens: " << Tens << std::endl; // std::cout << "Tens: " << Tens << std::endl;
...@@ -115,17 +120,40 @@ gi::ex multiply_1level( tensor3D_t& T, matrix_int_t& J, int size ) { // simpler ...@@ -115,17 +120,40 @@ gi::ex multiply_1level( tensor3D_t& T, matrix_int_t& J, int size ) { // simpler
j=j+1; j=j+1;
// printf("j = %d\n", j); // printf("j = %d\n", j);
for( a3 = 0 ; a3 < size ; a3++ ){ for( a3 = 0 ; a3 < size ; a3++ ){
// TAU_START( "b" ); #ifdef TAUPROF
TAU_START( "b" );
TAU_PROFILER_START( ptr );
#endif
A = T[a1][a2][a3]; A = T[a1][a2][a3];
/* Beyond this point, a2 and a3 are only used in the simplectic matrix */ /* Beyond this point, a2 and a3 are only used in the simplectic matrix */
for( b1 = 0 ; b1 < size ; b1++ ){ for( b1 = 0 ; b1 < size ; b1++ ){
Tn = one_level1_product( &T, &J, A, size, a1, a2, a3, b1 ); Tn = one_level1_product( &T, &J, A, size, a1, a2, a3, b1 );
Tens += Tn; Tens += Tn;
} }
// TAU_STOP( "b" ); #ifdef TAUPROF
//#ifdef TAUPROF TAU_STOP( "b" );
#if 0 // time = getTimeSpent( ptr );
time = getTimeSpent( "b" );
long calls, childcalls;
double incl[TAU_MAX_COUNTERS], excl[TAU_MAX_COUNTERS];
const char **counters;
int numcounters, i, j;
TAU_PROFILER_GET_CALLS(ptr, &calls);
TAU_PROFILER_GET_CHILD_CALLS(ptr, &childcalls);
TAU_PROFILER_GET_INCLUSIVE_VALUES(ptr, &incl);
TAU_PROFILER_GET_EXCLUSIVE_VALUES(ptr, &excl);
TAU_PROFILER_GET_COUNTER_INFO(&counters, &numcounters);
printf("Calls = %ld, child = %ld\n", calls, childcalls);
printf("numcounters = %d\n", numcounters);
for (j = 0; j < numcounters ; j++) {
printf(">>>");
printf("counter [%d] = %s\n", j, counters[j]);
printf(" excl [%d] = %g, incl [%d] = %g\n", j, excl[j], j, incl[j]);
}
// time = getTimeSpent( "b" );
#endif // TAUPROF #endif // TAUPROF
} }
} }
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#include "tensormatrix.h" #include "tensormatrix.h"
#include "utils.h" #include "utils.h"
#ifdef TAUPROF
#include <TAU.h>
#endif
#define DEBUG 0 #define DEBUG 0
namespace gi = GiNaC; namespace gi = GiNaC;
...@@ -59,7 +63,12 @@ int main( int argc, char** argv ){ ...@@ -59,7 +63,12 @@ int main( int argc, char** argv ){
double tv_start, tv_para, tv_seq; double tv_start, tv_para, tv_seq;
int rank; int rank;
#ifdef TAUPROF
TAU_INIT(&argc, &argv);
TAU_PROFILE_SET_NODE(0);
#endif
MPI_Init( &argc, &argv ); MPI_Init( &argc, &argv );
MPI_Comm_rank( MPI_COMM_WORLD, &rank ); MPI_Comm_rank( MPI_COMM_WORLD, &rank );
// std::cout << "Process " << rank << " has pid " << getpid() << std::endl; // std::cout << "Process " << rank << " has pid " << getpid() << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment