Commit 6eb8b453 authored by Camille Coti's avatar Camille Coti
Browse files

Timers

parent d16e606f
......@@ -300,10 +300,14 @@ gi::ex add_expressions_parall( std::vector<std::string> expressions, gi::lst sym
/* How much are we going to send: stop at a + or - sign (and keep the sign) */
chunk = ceil( s.length() / ( size - 1 ) );
end = cut[i] + chunk;
while( !( s[end] == '+' || s[end] == '-' || end == s.length() - 1) ){
if( end > ( s.length() - 1 ) ) {
end = s.length() - 1;
} else {
while( ( end != s.length() - 1) && !( s[end] == '+' || s[end] == '-' || end == s.length() - 1) ){
end++;
}
end--;
}
lengths[i] = end - cut[i] + 1;
i++;
......@@ -388,6 +392,8 @@ gi::ex multiply_1level_master_addslave4( tensor3D_t& T, unsigned int size, MPI_C
std::vector<parameters_2_1_t> input;
std::vector<std::string> results; /* length and char* */
double t1 = getTime();
/* Build a list of argument sets */
for( a4 = 0 ; a4 < N ; a4++ ){
......@@ -402,6 +408,8 @@ gi::ex multiply_1level_master_addslave4( tensor3D_t& T, unsigned int size, MPI_C
symbols = all_symbols_3D( size );
double t2 = getTime();
/* Distribute the work */
while( input.size() > 0 ) {
......@@ -440,6 +448,8 @@ gi::ex multiply_1level_master_addslave4( tensor3D_t& T, unsigned int size, MPI_C
}
}
double t3 = getTime();
/* Wait until everyone is done */
running = np - 1; // all the slaves are running
......@@ -470,9 +480,18 @@ gi::ex multiply_1level_master_addslave4( tensor3D_t& T, unsigned int size, MPI_C
}
double t4 = getTime();
/* Add whatever I have left */
Tens = add_expressions_parall( results, symbols, pzero, comm );
double t5 = getTime();
std::cout << "Init: " << t2 - t1 << std::endl;
std::cout << "Loop: " << t3 - t2 << std::endl;
std::cout << "Fini: " << t4 - t3 << std::endl;
std::cout << "Add: " << t5 - t4 << std::endl;
#if DEBUG
std::cout << "Received " << receivedresults << " results" << 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