23 #ifndef OpenMP_NOT_FOUND
32 testClasses[name] =
this;
37 cout <<
"Running test case " << name << std::endl;
40 for (
int param = parameters.size() - 1; param >= 0; --param ) {
41 if ( parameters[param]->enabled ) {
42 unsigned int steps = getStepsForParam ( param );
44 outname << name << param;
46 ofstream temp ( outname.str() );
48 for (
unsigned int step = 0; step < steps; ++step ) {
49 string params = getParamsString ( param, step );
51 call << path <<
"rambrain-performancetests " << repetitions <<
" " << name <<
" " << params <<
" 2> /dev/null";
52 cout <<
"Calling: " << call.str() << endl;
53 dummy |= system ( call.str().c_str() );
55 resultToTempFile ( param, step, temp );
58 if ( plotTimingStats ) {
59 handleTimingInfos ( param, step, repetitions );
65 stringstream gp_name, gp_exec;
66 gp_name << name << param <<
".gnuplot";
67 ofstream gnuplot ( gp_name.str() );
68 gp_exec <<
"gnuplot " << gp_name.str();
70 cout <<
"Generating output file " << outname.str() << endl;
71 gnuplot << generateGnuplotScript ( outname.str(), outname.str(), parameters[param]->name,
"Execution time [ms]", name, parameters[param]->deltaLog, parameters.size() - param );
74 cout <<
"Calling gnuplot and displaying result" << endl;
75 dummy |= system ( gp_exec.str().c_str() );
76 dummy |= system ( (
"convert -density 300 -resize 1920x " + outname.str() +
".eps -flatten " + outname.str() +
".png" ).c_str() );
78 dummy |= system ( (
"display " + outname.str() +
".png &" ).c_str() );
82 cerr <<
"An error in system calls occured..." << endl;
90 for (
auto it = testClasses.begin(); it != testClasses.end(); ++it ) {
93 test->
runTests ( repetitions, path );
95 cout <<
"Skipping test " << test->
name <<
" because it is disabled." << endl;
102 auto it = testClasses.find ( name );
103 if ( it != testClasses.end() ) {
107 cerr <<
"Test " << name <<
" not found " << endl;
113 for (
auto it = testClasses.begin(); it != testClasses.end(); ++it ) {
121 auto it = testClasses.find ( name );
122 if ( it != testClasses.end() ) {
123 testClasses.erase ( it );
125 cerr <<
"Test " << name <<
" not found " << endl;
131 for (
auto it = testClasses.begin(); it != testClasses.end(); ++it ) {
134 cout <<
"Test class " << test->
name <<
" is currently " << ( test->
enabled ?
"enabled" :
"disabled" ) <<
". ";
135 cout <<
"It has " << test->
parameters.size() <<
" parameters:" << endl;
142 cout << param->
steps << ( param->
deltaLog ?
" logarithmic" :
" linear" ) <<
" steps" << endl;
144 cout <<
"\tParameter variation is currently disabled" << endl;
154 auto it = testClasses.find ( name );
155 if ( it != testClasses.end() ) {
157 for (
unsigned int r = 0; r < repetitions; ++r ) {
158 cout <<
"Repetition " << ( r + 1 ) <<
" out of " << repetitions <<
" " <<
'\r';
160 int myOffset = offset;
164 if ( r == repetitions - 1 ) {
173 cerr <<
"Test " << name <<
" not found " << endl;
182 for (
int i = parameters.size() - 1; i >= 0; --i ) {
183 if ( i == varryParam ) {
184 ss << parameters[i]->valueAsString ( step );
186 ss << parameters[i]->valueAsString();
197 for (
int i = parameters.size() - 1; i >= 0; --i ) {
198 if ( i == varryParam ) {
199 ss <<
"#" << parameters[i]->valueAsString ( step );
201 ss <<
"#" << parameters[i]->valueAsString();
209 file << getParamsString ( varryParam, step,
"\t" );
210 ifstream test ( getTestOutfile ( varryParam, step ) );
212 while ( getline ( test, line ) ) {
213 if ( line.find (
'#' ) == string::npos ) {
214 vector<string> parts = splitString ( line,
'\t' );
215 file << parts[parts.size() - 2] <<
'\t';
222 stringstream ss ( in );
223 vector<string> parts;
225 while ( getline ( ss, part, delimiter ) ) {
226 parts.push_back ( part );
234 ss <<
"set terminal postscript eps enhanced color 'Helvetica,10'" << endl;
235 ss <<
"set output \"" << name <<
".eps\"" << endl;
236 ss <<
"set xlabel \"" << xlabel <<
"\"" << endl;
237 ss <<
"set ylabel \"" << ylabel <<
"\"" << endl;
238 ss <<
"set title \"" << title <<
"\"" << endl;
240 ss <<
"set log xy" << endl;
242 ss <<
"set log y" << endl;
244 ss << generateMyGnuplotPlotPart ( infile, paramColumn );
251 string outFile = getTestOutfile ( varryParam, step );
252 string timingFile = outFile +
"_stats";
253 string hitMissFile = outFile +
"_hm";
254 string tempFile = outFile +
"_timing";
255 if ( rename (
"rambrain-swapstats.log", timingFile.c_str() ) ) {
256 errmsgf (
"Could not rename swapstats log to %s", timingFile.c_str() );
259 ifstream testInFile ( outFile );
260 ifstream timingInFile ( timingFile );
261 ofstream timingTruncFile ( tempFile );
263 int initpos = timingInFile.tellg();
266 int measurements = 0, dataPoints = 0;
267 unsigned long long starttimes[repetitions];
268 for (
unsigned int r = 0; r < repetitions; ++r ) {
269 starttimes[r] = 0LLu;
272 while ( getline ( testInFile, testLine ) ) {
273 if ( testLine.find (
'#' ) == string::npos ) {
274 vector<string> testParts = splitString ( testLine,
'\t' );
277 const unsigned int runCols = 4;
279 timingInFile.seekg ( initpos );
280 for (
unsigned int r = 0; r < repetitions; ++r ) {
281 unsigned long long start = strtoull ( testParts[r * runCols + 1].c_str(), &buf, 10 );
282 unsigned long long end = strtoull ( testParts[r * runCols + 2].c_str(), &buf, 10 );
285 vector<vector<string>> relevantTimingParts = getRelevantTimingParts ( timingInFile, start, end );
288 timingInfosToFile ( timingTruncFile, relevantTimingParts, starttimes[r] );
289 dataPoints += relevantTimingParts.size();
295 timingInFile.close();
296 timingTruncFile.close();
299 ofstream gnuplot1 ( timingFile +
".gnuplot" ), gnuplot2 ( hitMissFile +
".gnuplot" );
300 cout <<
"Generating output files " << timingFile <<
" and " << hitMissFile << endl;
302 const int maxDataPoints = 50 * repetitions;
303 plotTimingInfos ( gnuplot1, timingFile, tempFile, measurements, repetitions, dataPoints <= maxDataPoints );
304 plotTimingHitMissInfos ( gnuplot2, hitMissFile, tempFile, measurements, repetitions, dataPoints <= maxDataPoints );
309 cout <<
"Calling gnuplot and displaying result" << endl;
311 dummy |= system ( (
"gnuplot " + timingFile +
".gnuplot" ).c_str() );
312 dummy |= system ( (
"convert -density 300 -resize 1920x " + timingFile +
".eps -flatten " + timingFile +
".png" ).c_str() );
313 if ( displayPlots ) {
314 dummy |= system ( (
"display " + timingFile +
".png &" ).c_str() );
317 dummy |= system ( (
"gnuplot " + hitMissFile +
".gnuplot" ).c_str() );
318 dummy |= system ( (
"convert -density 300 -resize 1920x " + hitMissFile +
".eps -flatten " + hitMissFile +
".png" ).c_str() );
319 if ( displayPlots ) {
320 dummy |= system ( (
"display " + hitMissFile +
".png &" ).c_str() );
324 cerr <<
"An error in system calls occured..." << endl;
330 vector<vector<string>> relevantTimingParts;
334 while ( getline ( in, timingLine ) ) {
335 if ( timingLine.find (
'#' ) == string::npos ) {
336 vector<string> timingParts = splitString ( timingLine,
'\t' );
338 unsigned long long current = strtoull ( timingParts[0].c_str(), &buf, 10 );
340 if ( current >= start && current <= end ) {
341 relevantTimingParts.push_back ( timingParts );
343 if ( current > end ) {
348 return relevantTimingParts;
353 out <<
"#Time since beginning [ms]\tSwappedOut [B]\tSwappedIn [B]\tMemory Used [B]\tSwap Used [B]\tHit / Miss" << endl;
354 if ( relevantTimingParts.size() > 0 ) {
356 if ( starttime == 0LLu ) {
357 starttime = strtoull ( relevantTimingParts.front() [0].c_str(), &buf, 10 );
359 for (
auto it = relevantTimingParts.begin(); it != relevantTimingParts.end(); ++it ) {
360 const unsigned long long relTime = strtoull ( ( *it ) [0].c_str(), &buf, 10 ) - starttime;
361 const double mbOut = strtod ( ( *it ) [2].c_str() , NULL ) /
mib;
362 const double mbIn = strtod ( ( *it ) [5].c_str(), NULL ) /
mib;
363 const string hitmiss = ( *it ) [7];
364 const double mbUsed = strtod ( ( *it ) [8].c_str(), NULL ) /
mib;
365 const double mbSwapped = strtod ( ( *it ) [10].c_str(), NULL ) /
mib;
367 out << relTime <<
" " << mbOut <<
" " << mbIn <<
" " << mbUsed <<
" " << mbSwapped <<
" " << hitmiss << endl;
370 out << 0 <<
" " << 0 <<
" " << 0 <<
" " << 0 <<
" " << 0 <<
" " << 0.0 << endl;
375 void performanceTest<>::plotTimingInfos ( ofstream &gnutemp,
const string &outname,
const string &dataFile,
unsigned int measurements,
unsigned int repetitions,
bool linesPoints )
377 gnutemp <<
"set terminal postscript eps enhanced color 'Helvetica,10'" << endl;
378 gnutemp <<
"set output \"" << outname <<
".eps\"" << endl;
379 gnutemp <<
"set xlabel \"Time [ms]\"" << endl;
380 gnutemp <<
"set ylabel \"Swap Movement [MB]\"" << endl;
381 gnutemp <<
"set title \"" << name <<
"\"" << endl;
382 gnutemp <<
"set key top left" << endl;
385 gnutemp <<
"set style data linespoints" << endl;
387 gnutemp <<
"set style data lines" << endl;
392 for (
unsigned int m = 0, s = 2; m < measurements; ++m, ++s ) {
393 int mrep = m * repetitions;
394 gnutemp <<
"'" << dataFile <<
"' every :::" << mrep <<
"::" << ( mrep + repetitions - 1 ) <<
" using 1:2 lt 1";
396 gnutemp <<
" pt " << s;
398 gnutemp <<
" lc " << c++ <<
" title \"" <<
"Swapped out: " << plotParts[m] <<
"\", \\" << endl;
400 gnutemp <<
"'" << dataFile <<
"' every :::" << mrep <<
"::" << ( mrep + repetitions - 1 ) <<
" using 1:3 lt 1";
402 gnutemp <<
" pt " << s;
404 gnutemp <<
" lc " << c++ <<
" title \"" <<
"Swapped in: " << plotParts[m] <<
"\", \\" << endl;
405 gnutemp <<
"'" << dataFile <<
"' every :::" << mrep <<
"::" << ( mrep + repetitions - 1 ) <<
" using 1:4 lt 2";
407 gnutemp <<
" pt " << s;
409 gnutemp <<
" lc " << c++ <<
" title \"" <<
"Main memory: " << plotParts[m] <<
"\", \\" << endl;
410 gnutemp <<
"'" << dataFile <<
"' every :::" << mrep <<
"::" << ( mrep + repetitions - 1 ) <<
" using 1:5 lt 2";
412 gnutemp <<
" pt " << s;
414 gnutemp <<
" lc " << c++ <<
" title \"" <<
"Swap memory:" << plotParts[m] <<
"\"";
415 if ( m != measurements - 1 ) {
424 gnutemp <<
"set terminal postscript eps enhanced color 'Helvetica,10'" << endl;
425 gnutemp <<
"set output \"" << outname <<
".eps\"" << endl;
426 gnutemp <<
"set xlabel \"Time [ms]\"" << endl;
427 gnutemp <<
"set ylabel \"Hit / Miss ratio\"" << endl;
428 gnutemp <<
"set title \"" << name <<
"\"" << endl;
429 gnutemp <<
"set log y" << endl;
432 gnutemp <<
"set style data linespoints" << endl;
434 gnutemp <<
"set style data lines" << endl;
439 for (
unsigned int m = 0, s = 2; m < measurements; ++m, ++s, ++c ) {
440 int mrep = m * repetitions;
441 gnutemp <<
"'" << dataFile <<
"' every :::" << mrep <<
"::" << ( mrep + repetitions - 1 ) <<
" using 1:6 lt 1";
443 gnutemp <<
" pt " << s;
445 gnutemp <<
" lc " << c <<
" title \"" << plotParts[m] <<
": Hit / Miss\", \\" << endl;
452 #define TESTSTATICS(name, commenttext) string name::comment = commenttext; \
455 #define TESTPARAM(param, minimum, maximum, nrsteps, log, meanvalue, paramname) parameter##param.min = minimum; \
456 parameter##param.max = maximum; \
457 parameter##param.steps = nrsteps; \
458 parameter##param.deltaLog = log; \
459 parameter##param.mean = meanvalue; \
460 parameter##param.name = paramname
464 TESTSTATICS ( matrixTransposeTest,
"Measurements of allocation and definition, transposition, deletion times" );
466 matrixTransposeTest::matrixTransposeTest() :
performanceTest<int, int> (
"MatrixTranspose" )
468 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
469 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
470 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
473 void matrixTransposeTest::actualTestMethod (
tester &test,
int param1,
int param2 )
486 managedPtr<double> *rows[size];
487 for (
unsigned int i = 0; i < size; ++i ) {
488 rows[i] =
new managedPtr<double> ( size );
489 adhereTo<double> rowloc ( *rows[i] );
490 double *rowdbl = rowloc;
491 for (
unsigned int j = 0; j < size; ++j ) {
492 rowdbl[j] = i * size + j;
499 for (
unsigned int i = 0; i < size; ++i ) {
500 adhereTo<double> rowloc1 ( *rows[i] );
501 double *rowdbl1 = rowloc1;
502 for (
unsigned int j = i + 1; j < size; ++j ) {
503 adhereTo<double> rowloc2 ( *rows[j] );
504 double *rowdbl2 = rowloc2;
506 double buffer = rowdbl1[j];
507 rowdbl1[j] = rowdbl2[i];
515 for (
unsigned int i = 0; i < size; ++i ) {
516 adhereTo<double> rowloc ( *rows[i] );
517 double *rowdbl = rowloc;
518 for (
unsigned int j = 0; j < size; ++j ) {
519 if ( rowdbl[j] != j * size + i ) {
520 printf (
"Failed check!\n" );
527 for (
unsigned int i = 0; i < size; ++i ) {
534 string matrixTransposeTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
537 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
538 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
539 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
540 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"" << endl;
545 TESTSTATICS ( matrixCleverTransposeTest,
"Measurements of allocation and definition, transposition, deletion times, but with a clever transposition algorithm" );
547 matrixCleverTransposeTest::matrixCleverTransposeTest() :
performanceTest<int, int> (
"MatrixCleverTranspose" )
549 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
550 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
551 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
554 void matrixCleverTransposeTest::actualTestMethod (
tester &test,
int param1,
int param2 )
567 managedPtr<double> *rows[size];
568 for (
unsigned int i = 0; i < size; ++i ) {
569 rows[i] =
new managedPtr<double> ( size );
570 adhereTo<double> rowloc ( *rows[i] );
571 double *rowdbl = rowloc;
572 for (
unsigned int j = 0; j < size; ++j ) {
573 rowdbl[j] = i * size + j;
580 unsigned int rows_fetch = memlines / 2 > size ? size : memlines / 2;
581 unsigned int n_blocks = size / rows_fetch + ( size % rows_fetch == 0 ? 0 : 1 );
583 adhereTo<double> *Arows[rows_fetch];
584 adhereTo<double> *Brows[rows_fetch];
586 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
587 for (
unsigned int ii = 0; ii <= jj; ii++ ) {
591 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
592 unsigned int j_lim = ( jj + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
593 unsigned int i_off = ii * rows_fetch;
594 unsigned int j_off = jj * rows_fetch;
597 for (
unsigned int i = 0; i < i_lim; ++i ) {
598 Arows[i] =
new adhereTo<double> ( *rows[i + i_off] );
600 for (
unsigned int j = 0; j < j_lim; ++j ) {
601 Brows[j] =
new adhereTo<double> ( *rows[j + j_off] );
604 for (
unsigned int j = 0; j < j_lim; j++ ) {
605 for (
unsigned int i = 0; i < ( jj == ii ? j : i_lim ); i++ ) {
607 double *Arowdb = *Arows[i];
608 double *Browdb = *Brows[j];
610 double inter = Arowdb[j_off + j];
611 Arowdb[j + j_off] = Browdb[ i + i_off];
612 Browdb[i + i_off] = inter;
616 for (
unsigned int i = 0; i < i_lim; ++i ) {
619 for (
unsigned int j = 0; j < j_lim; ++j ) {
628 for (
unsigned int i = 0; i < size; ++i ) {
629 adhereTo<double> rowloc ( *rows[i] );
630 double *rowdbl = rowloc;
631 for (
unsigned int j = 0; j < size; ++j ) {
632 if ( rowdbl[j] != j * size + i ) {
633 printf (
"Failed check!\n" );
640 for (
unsigned int i = 0; i < size; ++i ) {
647 string matrixCleverTransposeTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
650 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
651 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
652 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
653 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
657 TESTSTATICS ( matrixCleverTranspose2Test,
"Measurements of allocation and definition, transposition, deletion times, but with a clever transposition algorithm and same rows_fetch as openMP version" );
659 matrixCleverTranspose2Test::matrixCleverTranspose2Test() :
performanceTest<int, int> (
"MatrixCleverTranspose2" )
661 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
662 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
663 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
666 void matrixCleverTranspose2Test::actualTestMethod (
tester &test,
int param1,
int param2 )
679 managedPtr<double> *rows[size];
680 for (
unsigned int i = 0; i < size; ++i ) {
681 rows[i] =
new managedPtr<double> ( size );
682 adhereTo<double> rowloc ( *rows[i] );
683 double *rowdbl = rowloc;
684 for (
unsigned int j = 0; j < size; ++j ) {
685 rowdbl[j] = i * size + j;
692 unsigned int ompt = 2;
693 #ifndef OpenMP_NOT_FOUND
694 ompt = omp_get_max_threads();
696 unsigned int rows_fetch = memlines / ( 4 * ompt ) > size ? size : memlines / ( 4 * ompt );
697 unsigned int n_blocks = size / rows_fetch + ( size % rows_fetch == 0 ? 0 : 1 );
699 adhereTo<double> *Arows[rows_fetch];
700 adhereTo<double> *Brows[rows_fetch];
702 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
703 for (
unsigned int ii = 0; ii <= jj; ii++ ) {
707 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
708 unsigned int j_lim = ( jj + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
709 unsigned int i_off = ii * rows_fetch;
710 unsigned int j_off = jj * rows_fetch;
713 for (
unsigned int i = 0; i < i_lim; ++i ) {
714 Arows[i] =
new adhereTo<double> ( *rows[i + i_off] );
716 for (
unsigned int j = 0; j < j_lim; ++j ) {
717 Brows[j] =
new adhereTo<double> ( *rows[j + j_off] );
720 for (
unsigned int j = 0; j < j_lim; j++ ) {
721 for (
unsigned int i = 0; i < ( jj == ii ? j : i_lim ); i++ ) {
723 double *Arowdb = *Arows[i];
724 double *Browdb = *Brows[j];
726 double inter = Arowdb[j_off + j];
727 Arowdb[j + j_off] = Browdb[ i + i_off];
728 Browdb[i + i_off] = inter;
732 for (
unsigned int i = 0; i < i_lim; ++i ) {
735 for (
unsigned int j = 0; j < j_lim; ++j ) {
744 for (
unsigned int i = 0; i < size; ++i ) {
745 adhereTo<double> rowloc ( *rows[i] );
746 double *rowdbl = rowloc;
747 for (
unsigned int j = 0; j < size; ++j ) {
748 if ( rowdbl[j] != j * size + i ) {
749 printf (
"Failed check!\n" );
756 for (
unsigned int i = 0; i < size; ++i ) {
763 string matrixCleverTranspose2Test::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
766 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
767 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
768 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
769 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
774 #ifndef OpenMP_NOT_FOUND
775 TESTSTATICS ( matrixCleverTransposeOpenMPTest,
"Same as cleverTranspose, but with OpenMP" );
777 matrixCleverTransposeOpenMPTest::matrixCleverTransposeOpenMPTest() :
performanceTest<int, int> (
"MatrixCleverTransposeOpenMP" )
779 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
780 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
781 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
784 void matrixCleverTransposeOpenMPTest::actualTestMethod (
tester &test,
int param1,
int param2 )
797 managedPtr<double> *rows[size];
798 #pragma omp parallel for
799 for (
unsigned int i = 0; i < size; ++i ) {
800 rows[i] =
new managedPtr<double> ( size );
801 adhereTo<double> rowloc ( *rows[i] );
802 double *rowdbl = rowloc;
803 for (
unsigned int j = 0; j < size; ++j ) {
804 rowdbl[j] = i * size + j;
812 unsigned int ompt = 2;
813 #ifndef OpenMP_NOT_FOUND
814 ompt = omp_get_max_threads();
816 unsigned int rows_fetch = memlines / ( 4 * ompt ) > size ? size : memlines / ( 4 * ompt );
817 unsigned int n_blocks = size / rows_fetch + ( size % rows_fetch == 0 ? 0 : 1 );
820 #pragma omp parallel for
821 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
822 for (
unsigned int ii = 0; ii <= jj; ii++ ) {
826 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
827 unsigned int j_lim = ( jj + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
828 unsigned int i_off = ii * rows_fetch;
829 unsigned int j_off = jj * rows_fetch;
832 adhereTo<double> *Arows[rows_fetch];
833 adhereTo<double> *Brows[rows_fetch];
834 for (
unsigned int i = 0; i < i_lim; ++i ) {
835 Arows[i] =
new adhereTo<double> ( *rows[i + i_off], true );
837 for (
unsigned int j = 0; j < j_lim; ++j ) {
838 Brows[j] =
new adhereTo<double> ( *rows[j + j_off], true );
840 for (
unsigned int j = 0; j < j_lim; j++ ) {
841 for (
unsigned int i = 0; i < ( jj == ii ? j : i_lim ); i++ ) {
843 double *Arowdb, *Browdb;
852 double inter = Arowdb[j_off + j];
853 Arowdb[j + j_off] = Browdb[ i + i_off];
854 Browdb[i + i_off] = inter;
857 for (
unsigned int i = 0; i < i_lim; ++i ) {
860 for (
unsigned int j = 0; j < j_lim; ++j ) {
870 for (
unsigned int i = 0; i < size; ++i ) {
871 adhereTo<double> rowloc ( *rows[i] );
872 double *rowdbl = rowloc;
873 for (
unsigned int j = 0; j < size; ++j ) {
874 if ( rowdbl[j] != j * size + i ) {
875 printf (
"Failed check!\n" );
882 #pragma omp parallel for
883 for (
unsigned int i = 0; i < size; ++i ) {
889 string matrixCleverTransposeOpenMPTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
892 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
893 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
894 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
895 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
901 TESTSTATICS ( matrixCleverBlockTransposeTest,
"Same as cleverTranspose, but with blockwise multiplication" );
903 matrixCleverBlockTransposeTest::matrixCleverBlockTransposeTest() :
performanceTest<int, int> (
"MatrixCleverBlockTranspose" )
905 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
906 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
907 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
910 void matrixCleverBlockTransposeTest::actualTestMethod (
tester &test,
int param1,
int param2 )
924 unsigned int rows_fetch = sqrt ( memlines * size / 2 );
925 unsigned int blocksize = rows_fetch * rows_fetch;
927 unsigned int n_blocks = size / rows_fetch + ( size % rows_fetch == 0 ? 0 : 1 );
931 #define blockIdx(x,y) ((x/rows_fetch)*n_blocks+y/rows_fetch)
932 #define inBlockX(x,y) (x%rows_fetch)
933 #define inBlockY(x,y) (y%rows_fetch)
934 #define inBlockIdx(x,y) (inBlockX(x,y)*rows_fetch+inBlockY(x,y))
936 managedPtr<double> *rows[n_blocks * n_blocks];
937 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
938 for (
unsigned int ii = 0; ii < n_blocks; ii++ ) {
939 rows[ii * n_blocks + jj] =
new managedPtr<double> ( blocksize );
940 adhereTo<double> adh ( *rows[ii * n_blocks + jj] );
941 double *locPtr = adh;
942 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
943 unsigned int j_lim = rows_fetch;
944 for (
unsigned int i = 0; i < i_lim; i++ ) {
945 for (
unsigned int j = 0; j < j_lim; j++ ) {
946 locPtr[i * rows_fetch + j] = ( ii * rows_fetch + i ) * size + ( j + rows_fetch * jj );
953 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
954 for (
unsigned int ii = 0; ii <= jj; ii++ ) {
958 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
959 unsigned int j_lim = ( jj + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
962 adhereTo<double> aBlock ( *rows[ii * n_blocks + jj] );
963 adhereTo<double> bBlock ( *rows[jj * n_blocks + ii] );
965 double *aLoc = aBlock;
966 double *bLoc = bBlock;
968 for (
unsigned int j = 0; j < j_lim; j++ ) {
969 for (
unsigned int i = 0; i < ( jj == ii ? j : i_lim ); i++ ) {
971 double inter = aLoc[i * rows_fetch + j];
972 aLoc[i * rows_fetch + j] = bLoc[j * rows_fetch + i];
973 bLoc[j * rows_fetch + i] = inter;
982 for (
unsigned int i = 0; i < size; ++i ) {
983 for (
unsigned int j = 0; j < size; ++j ) {
984 unsigned int blckidx = blockIdx ( i, j );
985 unsigned int inblck = inBlockIdx ( i, j );
986 adhereTo<double> adh ( *rows[blckidx] );
988 if ( loc[inblck] != j * size + i ) {
989 printf (
"Failed check!\n" );
996 for (
unsigned int i = 0; i < n_blocks * n_blocks; ++i ) {
1003 string matrixCleverBlockTransposeTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1006 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1007 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
1008 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1009 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1014 #ifndef OpenMP_NOT_FOUND
1015 TESTSTATICS ( matrixCleverBlockTransposeOpenMPTest,
"Same as cleverTranspose, but with OpenMP and blockwise multiplication" );
1017 matrixCleverBlockTransposeOpenMPTest::matrixCleverBlockTransposeOpenMPTest() :
performanceTest<int, int> (
"MatrixCleverBlockTransposeOpenMP" )
1019 TESTPARAM ( 1, 10, 8000, 20,
true, 4000,
"Matrix size per dimension" );
1020 TESTPARAM ( 2, 1000, 10000, 20,
true, 2000,
"Matrix rows in main memory" );
1021 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Transposition",
"Deletion"} );
1024 void matrixCleverBlockTransposeOpenMPTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1039 unsigned int ompt = 2;
1040 #ifndef OpenMP_NOT_FOUND
1041 ompt = omp_get_max_threads();
1043 unsigned int rows_fetch = sqrt ( memlines * size / 2 / ompt );
1044 unsigned int blocksize = rows_fetch * rows_fetch;
1046 unsigned int n_blocks = size / rows_fetch + ( size % rows_fetch == 0 ? 0 : 1 );
1050 #define blockIdx(x,y) ((x/rows_fetch)*n_blocks+y/rows_fetch)
1051 #define inBlockX(x,y) (x%rows_fetch)
1052 #define inBlockY(x,y) (y%rows_fetch)
1053 #define inBlockIdx(x,y) (inBlockX(x,y)*rows_fetch+inBlockY(x,y))
1055 managedPtr<double> *rows[n_blocks * n_blocks];
1057 managedMemory::defaultManager->setOutOfSwapIsFatal (
false );
1058 #pragma omp parallel for schedule(dynamic)
1059 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
1060 for (
unsigned int ii = 0; ii < n_blocks; ii++ ) {
1061 rows[ii * n_blocks + jj] =
new managedPtr<double> ( blocksize );
1062 adhereTo<double> adh ( *rows[ii * n_blocks + jj] );
1063 double *locPtr = adh;
1064 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
1065 unsigned int j_lim = rows_fetch;
1066 for (
unsigned int i = 0; i < i_lim; i++ ) {
1067 for (
unsigned int j = 0; j < j_lim; j++ ) {
1068 locPtr[i * rows_fetch + j] = ( ii * rows_fetch + i ) * size + ( j + rows_fetch * jj );
1075 #pragma omp parallel for ordered schedule(dynamic)
1076 for (
unsigned int jj = 0; jj < n_blocks; jj++ ) {
1078 for (
unsigned int ii = 0; ii <= jj; ii++ ) {
1082 unsigned int i_lim = ( ii + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
1083 unsigned int j_lim = ( jj + 1 == n_blocks && size % rows_fetch != 0 ? size % rows_fetch : rows_fetch );
1086 adhereTo<double> aBlock ( *rows[ii * n_blocks + jj] );
1087 adhereTo<double> bBlock ( *rows[jj * n_blocks + ii] );
1089 double *aLoc, *bLoc;
1095 for (
unsigned int j = 0; j < j_lim; j++ ) {
1096 for (
unsigned int i = 0; i < ( jj == ii ? j : i_lim ); i++ ) {
1098 double inter = aLoc[i * rows_fetch + j];
1099 aLoc[i * rows_fetch + j] = bLoc[j * rows_fetch + i];
1100 bLoc[j * rows_fetch + i] = inter;
1109 for (
unsigned int i = 0; i < size; ++i ) {
1110 for (
unsigned int j = 0; j < size; ++j ) {
1111 unsigned int blckidx = blockIdx ( i, j );
1112 unsigned int inblck = inBlockIdx ( i, j );
1113 adhereTo<double> adh ( *rows[blckidx] );
1115 if ( loc[inblck] != j * size + i ) {
1116 printf (
"Failed check!\n" );
1123 #pragma omp parallel for
1124 for (
unsigned int i = 0; i < n_blocks * n_blocks; ++i ) {
1131 string matrixCleverBlockTransposeOpenMPTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1134 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1135 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Transposition\", \\" << endl;
1136 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1137 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1143 TESTSTATICS ( matrixMultiplyTest,
"Matrix multiplication with matrices being stored in columns / rows" );
1145 matrixMultiplyTest::matrixMultiplyTest() :
performanceTest<int, int> (
"MatrixMultiply" )
1147 TESTPARAM ( 1, 10, 6000, 20,
true, 4000,
"Matrix size per dimension" );
1148 TESTPARAM ( 2, 4000, 15000, 20,
true, 6000,
"Matrix rows in main memory" );
1149 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Multiplication",
"Deletion"} );
1152 void matrixMultiplyTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1166 managedPtr<double> *rowsA[size];
1167 managedPtr<double> *colsB[size];
1168 managedPtr<double> *rowsC[size];
1170 rowsA[i] =
new managedPtr<double> ( size );
1171 colsB[i] =
new managedPtr<double> ( size );
1172 rowsC[i] =
new managedPtr<double> ( size );
1174 adhereTo<double> adhRowA ( *rowsA[i] );
1175 adhereTo<double> adhColB ( *colsB[i] );
1176 adhereTo<double> adhRowC ( *rowsC[i] );
1178 double *rowA = adhRowA;
1179 double *colB = adhColB;
1180 double *rowC = adhRowC;
1194 adhereTo<double> adhRowA ( *rowsA[i] );
1195 adhereTo<double> adhRowC ( *rowsC[i] );
1196 double *rowA = adhRowA;
1197 double *rowC = adhRowC;
1199 adhereTo<double> adhColB ( *colsB[j] );
1200 double *colB = adhColB;
1204 erg += rowA[k] * colB[k];
1218 adhereTo<double> adhRowC ( *rowsC[i] );
1220 double *rowC = adhRowC;
1223 if ( rowC[j] != val ) {
1224 printf (
"Failed check!\n" );
1240 string matrixMultiplyTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1243 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1244 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Multiplication\", \\" << endl;
1245 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1246 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1251 #ifndef OpenMP_NOT_FOUND
1252 TESTSTATICS ( matrixMultiplyOpenMPTest,
"Matrix multiplication with matrices being stored in columns / rows" );
1254 matrixMultiplyOpenMPTest::matrixMultiplyOpenMPTest() :
performanceTest<int, int> (
"MatrixMultiplyOpenMP" )
1256 TESTPARAM ( 1, 10, 6000, 20,
true, 4000,
"Matrix size per dimension" );
1257 TESTPARAM ( 2, 4000, 15000, 20,
true, 6000,
"Matrix rows in main memory" );
1258 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Multiplication",
"Deletion"} );
1261 void matrixMultiplyOpenMPTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1275 managedPtr<double> *rowsA[size];
1276 managedPtr<double> *colsB[size];
1277 managedPtr<double> *rowsC[size];
1279 #pragma omp parallel for
1281 rowsA[i] =
new managedPtr<double> ( size );
1282 colsB[i] =
new managedPtr<double> ( size );
1283 rowsC[i] =
new managedPtr<double> ( size );
1285 adhereTo<double> adhRowA ( *rowsA[i] );
1286 adhereTo<double> adhColB ( *colsB[i] );
1287 adhereTo<double> adhRowC ( *rowsC[i] );
1289 double *rowA = adhRowA;
1290 double *colB = adhColB;
1291 double *rowC = adhRowC;
1304 adhereTo<double> adhRowA ( *rowsA[i] );
1305 adhereTo<double> adhRowC ( *rowsC[i] );
1306 double *rowA = adhRowA;
1307 double *rowC = adhRowC;
1308 #pragma omp parallel for
1310 adhereTo<double> adhColB ( *colsB[j] );
1311 double *colB = adhColB;
1315 erg += rowA[k] * colB[k];
1329 adhereTo<double> adhRowC ( *rowsC[i] );
1331 double *rowC = adhRowC;
1334 if ( rowC[j] != val ) {
1335 printf (
"Failed check!\n" );
1342 #pragma omp parallel for
1352 string matrixMultiplyOpenMPTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1355 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1356 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Multiplication\", \\" << endl;
1357 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1358 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1364 TESTSTATICS ( matrixCopyTest,
"Copy one matrix onto another" );
1366 matrixCopyTest::matrixCopyTest() :
performanceTest<int, int> (
"MatrixCopy" )
1368 TESTPARAM ( 1, 100, 10000, 20,
true, 5000,
"Matrix size per dimension" );
1369 TESTPARAM ( 2, 100, 10000, 20,
true, 5000,
"Matrix rows in main memory" );
1370 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Copy",
"Deletion"} );
1373 void matrixCopyTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1387 managedPtr<double> *A[size];
1388 managedPtr<double> *B[size];
1391 A[i] =
new managedPtr<double> ( size );
1392 B[i] =
new managedPtr<double> ( size );
1394 adhereTo<double> adhA ( *A[i] );
1407 adhereTo<double> adhA ( *A[i] );
1408 adhereTo<double> adhB ( *B[i] );
1422 adhereTo<double> adhB ( *B[i] );
1428 printf (
"Failed check!\n" );
1443 string matrixCopyTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1446 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1447 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Copy\", \\" << endl;
1448 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1449 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1454 #ifndef OpenMP_NOT_FOUND
1455 TESTSTATICS ( matrixCopyOpenMPTest,
"Copy one matrix onto another" );
1457 matrixCopyOpenMPTest::matrixCopyOpenMPTest() :
performanceTest<int, int> (
"MatrixCopyOpenMP" )
1459 TESTPARAM ( 1, 100, 10000, 20,
true, 5000,
"Matrix size per dimension" );
1460 TESTPARAM ( 2, 100, 10000, 20,
true, 5000,
"Matrix rows in main memory" );
1461 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Copy",
"Deletion"} );
1464 void matrixCopyOpenMPTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1478 managedPtr<double> *A[size];
1479 managedPtr<double> *B[size];
1481 #pragma omp parallel for
1483 A[i] =
new managedPtr<double> ( size );
1484 B[i] =
new managedPtr<double> ( size );
1486 adhereTo<double> adhA ( *A[i] );
1498 #pragma omp parallel for
1500 adhereTo<double> adhA ( *A[i] );
1501 adhereTo<double> adhB ( *B[i] );
1514 #pragma omp parallel for
1516 adhereTo<double> adhB ( *B[i] );
1522 printf (
"Failed check!\n" );
1529 #pragma omp parallel for
1538 string matrixCopyOpenMPTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1541 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1542 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Copy\", \\" << endl;
1543 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1544 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1550 TESTSTATICS ( matrixDoubleCopyTest,
"Copy one matrix onto another and back" );
1552 matrixDoubleCopyTest::matrixDoubleCopyTest() :
performanceTest<int, int> (
"MatrixDoubleCopy" )
1554 TESTPARAM ( 1, 100, 10000, 20,
true, 5000,
"Matrix size per dimension" );
1555 TESTPARAM ( 2, 100, 10000, 20,
true, 5000,
"Matrix rows in main memory" );
1556 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Copy",
"Deletion"} );
1559 void matrixDoubleCopyTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1573 managedPtr<double> *A[size];
1574 managedPtr<double> *B[size];
1577 A[i] =
new managedPtr<double> ( size );
1578 B[i] =
new managedPtr<double> ( size );
1580 adhereTo<double> adhA ( *A[i] );
1593 adhereTo<double> adhA ( *A[i] );
1594 adhereTo<double> adhB ( *B[i] );
1606 adhereTo<double> adhA ( *A[i] );
1607 adhereTo<double> adhB ( *B[i] );
1621 adhereTo<double> adhB ( *B[i] );
1622 adhereTo<double> adhA ( *A[i] );
1627 if ( a[j] != j || b[j] != j ) {
1628 printf (
"Failed check!\n" );
1643 string matrixDoubleCopyTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1646 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1647 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Copy\", \\" << endl;
1648 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1649 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1654 #ifndef OpenMP_NOT_FOUND
1655 TESTSTATICS ( matrixDoubleCopyOpenMPTest,
"Copy one matrix onto another and back" );
1657 matrixDoubleCopyOpenMPTest::matrixDoubleCopyOpenMPTest() :
performanceTest<int, int> (
"MatrixDoubleCopyOpenMP" )
1659 TESTPARAM ( 1, 100, 10000, 20,
true, 5000,
"Matrix size per dimension" );
1660 TESTPARAM ( 2, 100, 10000, 20,
true, 5000,
"Matrix rows in main memory" );
1661 plotParts = vector<string> ( {
"Allocation \\\\& Definition",
"Copy",
"Deletion"} );
1664 void matrixDoubleCopyOpenMPTest::actualTestMethod (
tester &test,
int param1,
int param2 )
1678 managedPtr<double> *A[size];
1679 managedPtr<double> *B[size];
1681 #pragma omp parallel for
1683 A[i] =
new managedPtr<double> ( size );
1684 B[i] =
new managedPtr<double> ( size );
1686 adhereTo<double> adhA ( *A[i] );
1698 #pragma omp parallel for
1700 adhereTo<double> adhA ( *A[i] );
1701 adhereTo<double> adhB ( *B[i] );
1712 #pragma omp parallel for
1714 adhereTo<double> adhA ( *A[i] );
1715 adhereTo<double> adhB ( *B[i] );
1728 #pragma omp parallel for
1730 adhereTo<double> adhA ( *A[i] );
1731 adhereTo<double> adhB ( *B[i] );
1735 if ( a[j] != j || b[j] != j ) {
1736 printf (
"Failed check!\n" );
1743 #pragma omp parallel for
1752 string matrixDoubleCopyOpenMPTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1755 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"Allocation \\\\& Definition\", \\" << endl;
1756 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Copy\", \\" << endl;
1757 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Deletion\", \\" << endl;
1758 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1764 TESTSTATICS ( measureThroughputTest,
"Measures throughput under load" );
1766 measureThroughputTest::measureThroughputTest() :
performanceTest<int, int> (
"MeasureThroughput" )
1768 TESTPARAM ( 1, 1024, 1024000, 20,
true, 1024000,
"Byte size per used chunk" );
1769 TESTPARAM ( 2, 1, 200, 20,
true, 100,
"percentage of array that will be written to" );
1770 plotParts = vector<string> ( {
"Set Use",
"Prepare",
"Calculation"} );
1771 plotTimingStats =
false;
1775 void measureThroughputTest::actualTestMethod (
tester &test,
int bytesize ,
int load )
1780 managedPtr<char> ptr[3] = {managedPtr<char> ( bytesize ), managedPtr<char> ( bytesize ), managedPtr<char> ( bytesize ) };
1781 adhereTo<char> *adh[3];
1783 float rewritetimes = load < 0 ? 1 : ( float ) load / 100.;
1784 int iterations = 10000;
1786 adh[0] =
new adhereTo<char> ( ptr[0] );
1788 std::chrono::duration<double> allSetuse ( 0 );
1789 std::chrono::duration<double> allPrepare ( 0 );
1790 std::chrono::duration<double> allCalc ( 0 );
1792 using namespace std::chrono;
1794 double rewritetimesmin = rewritetimes;
1795 unsigned int iter[3];
1798 for (
int i = 0; i < iterations; ++i ) {
1799 unsigned int use = ( i % 3 );
1800 unsigned int prepare = ( ( i + 1 ) % 3 );
1805 high_resolution_clock::time_point t0 = high_resolution_clock::now();
1806 char *loc = * ( adh[use] );
1807 high_resolution_clock::time_point t1 = high_resolution_clock::now();
1808 if ( i != iterations - 1 ) {
1809 adh[prepare] =
new adhereTo<char> ( ptr[prepare] , true );
1811 high_resolution_clock::time_point t2 = high_resolution_clock::now();
1813 for (
int r = 0; r < rewritetimes * bytesize; r++ ) {
1814 loc[r % bytesize] = r * i;
1816 high_resolution_clock::time_point t3 = high_resolution_clock::now();
1818 std::chrono::duration<double> setuse = duration_cast<duration<double>> ( t1 - t0 );;
1819 std::chrono::duration<double> preparet = duration_cast<duration<double>> ( t2 - t1 );
1820 std::chrono::duration<double> calc = duration_cast<duration<double>> ( t3 - t2 );
1822 rewritetimes *= ( preparet + setuse ) > calc ? 1.01 : .99;
1826 rewritetimesmin = rewritetimes < rewritetimesmin ? rewritetimes : rewritetimesmin;
1829 allSetuse += setuse;
1830 allPrepare += preparet;
1836 for (
int x = 0; x < 3; ++x ) {
1837 adhereTo<char> glue ( ptr[x] );
1839 for (
int r = 0; r < rewritetimesmin * bytesize; r++ )
1840 if ( loc[r % bytesize] != (
char ) ( r * iter[x] ) ) {
1841 errmsgf (
"Failed check! %d %d %d", x, iter[x], loc[r % bytesize] );
1850 string measureThroughputTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1853 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines title \"SetUse\", \\" << endl;
1854 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Prepare\", \\" << endl;
1855 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Calculation\", \\" << endl;
1856 ss <<
"'" << file <<
"' using " << paramColumn <<
":($5*100/($3+$4+$5)) with lines title \"busy time in \%\", \\" << endl;
1857 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines title \"Total\"";
1862 TESTSTATICS ( measurePreemptiveSpeedupTest,
"Measures preemptive vs non preemptive runtime" );
1864 measurePreemptiveSpeedupTest::measurePreemptiveSpeedupTest() :
performanceTest<int, int> (
"MeasurePreemptiveSpeedup" )
1866 TESTPARAM ( 1, 1024, 1024000, 20,
true, 10240,
"Byte size per used chunk" );
1867 TESTPARAM ( 2, 1, 200, 20,
true, 100,
"percentage of array that will be written to" );
1868 plotParts = vector<string> ( {
"Set Use",
"Prepare",
"Calculation", \
1869 "Set Use *",
"Prepare *",
"Calculation *"
1871 plotTimingStats =
false;
1874 void measurePreemptiveSpeedupTest::actualTestMethod (
tester &test,
int bytesize ,
int load )
1876 unsigned int numel = 1024;
1880 managedPtr<char> *ptr[numel];
1881 for (
unsigned int n = 0; n < numel; ++n ) {
1882 ptr[n] =
new managedPtr<char> ( bytesize );
1885 float rewritetimes = load < 0 ? 1 : ( float ) load / 100.;
1886 int iterations = 10230;
1889 double rewritetimesmin = rewritetimes;
1890 unsigned int iter[numel];
1893 std::chrono::duration<double> allSetuse ( 0 );
1894 std::chrono::duration<double> allPrepare ( 0 );
1895 std::chrono::duration<double> allCalc ( 0 );
1897 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
true );
1898 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveUnloading (
true );
1900 using namespace std::chrono;
1901 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
true );
1902 for (
int i = 0; i < iterations; ++i ) {
1903 unsigned int use = ( i % numel );
1906 high_resolution_clock::time_point t0 = high_resolution_clock::now();
1907 adhereTo<char> glue ( ptr[use] );
1908 high_resolution_clock::time_point t1 = high_resolution_clock::now();
1910 high_resolution_clock::time_point t2 = high_resolution_clock::now();
1912 for (
int r = 0; r < rewritetimes * bytesize; r++ ) {
1913 loc[r % bytesize] = r * i;
1915 high_resolution_clock::time_point t3 = high_resolution_clock::now();
1917 std::chrono::duration<double> setuse = duration_cast<duration<double>> ( t1 - t0 );
1918 std::chrono::duration<double> preparet = duration_cast<duration<double>> ( t2 - t1 );
1919 std::chrono::duration<double> calc = duration_cast<duration<double>> ( t3 - t2 );
1921 rewritetimes *= ( preparet + setuse ) > calc ? 1.01 : .99;
1924 rewritetimesmin = rewritetimes < rewritetimesmin ? rewritetimes : rewritetimesmin;
1927 allSetuse += setuse;
1928 allPrepare += preparet;
1936 std::chrono::duration<double> allSetuse2 ( 0 );
1937 std::chrono::duration<double> allPrepare2 ( 0 );
1938 std::chrono::duration<double> allCalc2 ( 0 );
1940 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
false );
1941 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveUnloading (
false );
1942 for (
int i = 0; i < iterations; ++i ) {
1943 unsigned int use = ( i % numel );
1946 high_resolution_clock::time_point t0 = high_resolution_clock::now();
1947 adhereTo<char> glue ( ptr[use] );
1948 high_resolution_clock::time_point t1 = high_resolution_clock::now();
1950 high_resolution_clock::time_point t2 = high_resolution_clock::now();
1952 for (
int r = 0; r < rewritetimes * bytesize; r++ ) {
1953 loc[r % bytesize] = r * i;
1955 high_resolution_clock::time_point t3 = high_resolution_clock::now();
1957 std::chrono::duration<double> setuse = duration_cast<duration<double>> ( t1 - t0 );
1958 std::chrono::duration<double> preparet = duration_cast<duration<double>> ( t2 - t1 );
1959 std::chrono::duration<double> calc = duration_cast<duration<double>> ( t3 - t2 );
1961 rewritetimes *= ( preparet + setuse ) > calc ? 1.01 : .99;
1964 rewritetimesmin = rewritetimes < rewritetimesmin ? rewritetimes : rewritetimesmin;
1967 allSetuse2 += setuse;
1968 allPrepare2 += preparet;
1973 for (
unsigned int x = 0; x < numel; ++x ) {
1974 adhereTo<char> glue ( ptr[x] );
1976 for (
int r = 0; r < rewritetimesmin * bytesize; r++ )
1977 if ( loc[r % bytesize] != (
char ) ( r * iter[x] ) ) {
1978 errmsgf (
"Failed check! %d %d %d", x, iter[x], loc[r % bytesize] );
1986 for (
unsigned int n = 0; n < numel; ++n ) {
1991 string measurePreemptiveSpeedupTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
1994 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines lt 1 lc 1 title \"adhereTo<>\", \\" << endl;
1995 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines lt 1 lc 2 title \"type *ptr = glue\", \\" << endl;
1996 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines lt 1 lc 3 title \"Calculation\", \\" << endl;
1997 ss <<
"'" << file <<
"' using " << paramColumn <<
":(100-($5*100/($3+$4+$5))) with lines lt 1 lc 4 title \"idle time in \%\", \\" << endl;
1998 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines lt 1 lc 5 title \"Total\", \\" << endl;
1999 ss <<
"'" << file <<
"' using " << paramColumn <<
":6 with lines lt 2 lc 1 title \"adhereTo<> *\", \\" << endl;
2000 ss <<
"'" << file <<
"' using " << paramColumn <<
":7 with lines lt 2 lc 2 title \"type *ptr = glue *\", \\" << endl;
2001 ss <<
"'" << file <<
"' using " << paramColumn <<
":8 with lines lt 2 lc 3 title \"Calculation *\", \\" << endl;
2002 ss <<
"'" << file <<
"' using " << paramColumn <<
":(100-($8*100/($6+$7+$8))) with lines lt 2 lc 4 title \"idle time * in \%\", \\" << endl;
2003 ss <<
"'" << file <<
"' using " << paramColumn <<
":($6+$7+$8) with lines lt 2 lc 5 title \"Total *\"";
2008 TESTSTATICS ( measureExplicitAsyncSpeedupTest,
"Measures runtime of preemptive versus non preemptive with explicite asynchronous preparation" );
2010 measureExplicitAsyncSpeedupTest::measureExplicitAsyncSpeedupTest() :
performanceTest<int, int> (
"MeasureExplicitAsyncSpeedup" )
2012 TESTPARAM ( 1, 1024, 1024000, 20,
true, 10240,
"Byte size per used chunk" );
2013 TESTPARAM ( 2, 1, 200, 20,
true, 100,
"percentage of array that will be written to" );
2014 plotParts = vector<string> ( {
"Set Use",
"Prepare",
"Calculation",
"Deletion", \
2015 "Set Use *",
"Prepare *",
"Calculation *",
"Deletion *"
2017 plotTimingStats =
false;
2020 void measureExplicitAsyncSpeedupTest::actualTestMethod (
tester &test,
int bytesize ,
int load )
2022 unsigned int numel = 1024;
2026 managedPtr<char> *ptr[numel];
2027 for (
unsigned int n = 0; n < numel; ++n ) {
2028 ptr[n] =
new managedPtr<char> ( bytesize );
2031 float rewritetimes = load < 0 ? 1 : ( float ) load / 100.;
2032 int iterations = 10230;
2035 double rewritetimesmin = rewritetimes;
2036 unsigned int iter[numel];
2039 std::chrono::duration<double> allSetuse ( 0 );
2040 std::chrono::duration<double> allPrepare ( 0 );
2041 std::chrono::duration<double> allCalc ( 0 );
2042 using namespace std::chrono;
2043 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
true );
2044 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveUnloading (
true );
2045 for (
int i = 0; i < iterations; ++i ) {
2046 unsigned int use = ( i % numel );
2050 high_resolution_clock::time_point t0 = high_resolution_clock::now();
2051 adhereTo<char> glue ( *ptr[use] );
2052 high_resolution_clock::time_point t1 = high_resolution_clock::now();
2054 high_resolution_clock::time_point t2 = high_resolution_clock::now();
2056 for (
int r = 0; r < rewritetimes * bytesize; r++ ) {
2057 loc[r % bytesize] = r * i;
2059 high_resolution_clock::time_point t3 = high_resolution_clock::now();
2061 std::chrono::duration<double> setuse = duration_cast<duration<double>> ( t1 - t0 );;
2062 std::chrono::duration<double> preparet = duration_cast<duration<double>> ( t2 - t1 );
2063 std::chrono::duration<double> calc = duration_cast<duration<double>> ( t3 - t2 );
2065 rewritetimes *= ( preparet + setuse ) > calc ? 1.01 : .99;
2068 allSetuse += setuse;
2069 allPrepare += preparet;
2077 std::chrono::duration<double> allSetuse2 ( 0 );
2078 std::chrono::duration<double> allPrepare2 ( 0 );
2079 std::chrono::duration<double> allCalc2 ( 0 );
2080 std::chrono::duration<double> allDel ( 0 );
2082 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
false );
2083 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveUnloading (
false );
2084 adhereTo <char> *adharr[numel];
2085 adharr[0] =
new adhereTo<char> ( *ptr[0] );
2087 for (
int i = 0; i < iterations; ++i ) {
2088 unsigned int use = ( i % numel );
2089 unsigned int prepare = ( ( i + 1 ) % numel );
2093 high_resolution_clock::time_point t0 = high_resolution_clock::now();
2094 if ( i != iterations - 1 ) {
2095 adharr[prepare] =
new adhereTo<char> ( *ptr[prepare] );
2097 high_resolution_clock::time_point t1 = high_resolution_clock::now();
2098 char *loc = *adharr[use];
2099 high_resolution_clock::time_point t2 = high_resolution_clock::now();
2101 for (
int r = 0; r < rewritetimes * bytesize; r++ ) {
2102 loc[r % bytesize] = r * i;
2104 high_resolution_clock::time_point t3 = high_resolution_clock::now();
2106 high_resolution_clock::time_point t4 = high_resolution_clock::now();
2107 std::chrono::duration<double> setuse = duration_cast<duration<double>> ( t1 - t0 );;
2108 std::chrono::duration<double> preparet = duration_cast<duration<double>> ( t2 - t1 );
2109 std::chrono::duration<double> calc = duration_cast<duration<double>> ( t3 - t2 );
2110 std::chrono::duration<double> del = duration_cast<duration<double>> ( t4 - t3 );
2112 rewritetimes *= ( preparet + setuse ) > calc ? 1.01 : .99;
2115 rewritetimesmin = rewritetimes < rewritetimesmin ? rewritetimes : rewritetimesmin;
2118 allSetuse2 += setuse;
2119 allPrepare2 += preparet;
2125 for (
unsigned int x = 0; x < numel; ++x ) {
2126 adhereTo<char> glue ( *ptr[x] );
2128 for (
int r = 0; r < rewritetimesmin * bytesize; r++ )
2129 if ( loc[r % bytesize] != (
char ) ( r * iter[x] ) ) {
2130 errmsgf (
"Failed check! %d %d %d", x, iter[x], loc[r % bytesize] );
2139 for (
unsigned int n = 0; n < numel; ++n ) {
2145 string measureExplicitAsyncSpeedupTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
2148 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":3 with lines lt 1 lc 1 title \"adhereTo<>\", \\" << endl;
2149 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines lt 1 lc 2 title \"type *ptr = glue\", \\" << endl;
2150 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines lt 1 lc 3 title \"Calculation\", \\" << endl;
2151 ss <<
"'" << file <<
"' using " << paramColumn <<
":(100-($5*100/($3+$4+$5))) with lines lt 1 lc 5 title \"idle time in \%\", \\" << endl;
2152 ss <<
"'" << file <<
"' using " << paramColumn <<
":($3+$4+$5) with lines lt 1 lc 6 title \"Total\", \\" << endl;
2153 ss <<
"'" << file <<
"' using " << paramColumn <<
":6 with lines lt 2 lc 1 title \"adhereTo<> *\", \\" << endl;
2154 ss <<
"'" << file <<
"' using " << paramColumn <<
":7 with lines lt 2 lc 2 title \"type *ptr = glue *\", \\" << endl;
2155 ss <<
"'" << file <<
"' using " << paramColumn <<
":8 with lines lt 2 lc 3 title \"Calculation *\", \\" << endl;
2156 ss <<
"'" << file <<
"' using " << paramColumn <<
":9 with lines lt 2 lc 4 title \"adhereTo<> deletion *\", \\" << endl;
2157 ss <<
"'" << file <<
"' using " << paramColumn <<
":(100-($8*100/($6+$7+$8+$9))) with lines lt 2 lc 5 title \"idle time * in \%\", \\" << endl;
2158 ss <<
"'" << file <<
"' using " << paramColumn <<
":($6+$7+$8+$9) with lines lt 2 lc 6 title \"Total *\"";
2163 TESTSTATICS ( measureConstSpeedupTest,
"Measures runtime of const versus non-const usage of swapped data without preemptive" );
2165 measureConstSpeedupTest::measureConstSpeedupTest() :
performanceTest<int> (
"MeasureConstSpeedup" )
2167 TESTPARAM ( 1, 1024, 10240, 20,
true, 324,
"Byte size of data block" );
2168 plotParts = vector<string> ( {
"Non-Const Swap In",
"Non-Const Swap out",
"Const Swap In",
"Const Swap out"} );
2169 plotTimingStats =
true;
2172 void measureConstSpeedupTest::actualTestMethod (
tester &test,
int kbytesize )
2174 const unsigned int nBlocks = 1024;
2175 const unsigned int nDummyBlocks = nBlocks;
2182 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveLoading (
false );
2183 ( ( cyclicManagedMemory * ) managedMemory::defaultManager )->setPreemptiveUnloading (
false );
2186 managedPtr<char> *realData[nBlocks];
2187 for (
unsigned int n = 0; n < nBlocks; ++n ) {
2188 realData[n] =
new managedPtr<char> ( kbytesize );
2189 managedPtr<char> *data ( realData[n] );
2190 ADHERETOLOC (
char, data, loc );
2191 for (
int i = 0; i < kbytesize; ++i ) {
2192 loc[i] = i + n * kbytesize;
2197 managedPtr<char> *dummyData[nDummyBlocks];
2198 for (
unsigned int n = 0; n < nDummyBlocks; ++n ) {
2199 dummyData[n] =
new managedPtr<char> ( kbytesize );
2200 managedPtr<char> *data ( dummyData[n] );
2201 ADHERETOLOC (
char, data, loc );
2202 for (
int i = 0; i < kbytesize; ++i ) {
2203 loc[i] = n * nDummyBlocks + i;
2209 long long int sum = 0ull;
2210 for (
unsigned int n = 0; n < nBlocks; ++n ) {
2211 managedPtr<char> *data ( realData[n] );
2212 ADHERETOLOC (
char, data, loc );
2213 for (
int i = 0; i < kbytesize; ++i ) {
2221 for (
unsigned int n = 0; n < nDummyBlocks; ++n ) {
2222 managedPtr<char> *data ( dummyData[n] );
2223 ADHERETOLOC (
char, data, loc );
2224 for (
int i = 0; i < kbytesize; ++i ) {
2232 for (
unsigned int n = 0; n < nBlocks; ++n ) {
2233 managedPtr<char> *data ( realData[n] );
2234 ADHERETOLOCCONST (
char, data, loc );
2235 for (
int i = 0; i < kbytesize; ++i ) {
2243 for (
unsigned int n = 0; n < nDummyBlocks; ++n ) {
2244 managedPtr<char> *data ( dummyData[n] );
2245 ADHERETOLOC (
char, data, loc );
2246 for (
int i = 0; i < kbytesize; ++i ) {
2253 for (
unsigned int n = 0; n < nBlocks; ++n ) {
2254 managedPtr<char> *data ( realData[n] );
2255 ADHERETOLOC (
char, data, loc );
2256 for (
int i = 0; i < kbytesize; ++i ) {
2257 if ( loc[i] != static_cast<char> ( i + n * kbytesize ) ) {
2258 errmsgf (
"Failed check! %d %d %d", n, i, loc[i] );
2265 for (
unsigned int n = 0; n < nBlocks; ++n ) {
2268 for (
unsigned int n = 0; n < nDummyBlocks; ++n ) {
2269 delete dummyData[n];
2273 string measureConstSpeedupTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
2276 ss <<
"plot '" << file <<
"' using " << paramColumn <<
":2 with lines title \"Non-Const Swap In\", \\" << endl;
2277 ss <<
"'" << file <<
"' using " << paramColumn <<
":3 with lines title \"Non-Const Swap Out\", \\" << endl;
2278 ss <<
"'" << file <<
"' using " << paramColumn <<
":4 with lines title \"Const Swap In\", \\" << endl;
2279 ss <<
"'" << file <<
"' using " << paramColumn <<
":5 with lines title \"Const Swap out\"";
2284 TESTSTATICS ( demonstrateDecayTest,
"Should plot regeneration of hits over misses ratio" );
2286 demonstrateDecayTest::demonstrateDecayTest() :
performanceTest<int> (
"DemonstrateDecay" )
2288 TESTPARAM ( 1, 1024, 1024, 1,
true, 1024,
"Dummy pararameter" );
2289 plotParts = vector<string> ( {
"Element allocation",
"Consecutive Access",
"Random Access",
"Regenerating Access"} );
2290 plotTimingStats =
true;
2293 void demonstrateDecayTest::actualTestMethod (
tester &test,
int kbytesize )
2295 const unsigned int n_el = 100240;
2296 const unsigned int efac = 10;
2297 const unsigned int memsize = n_el *
sizeof ( char ) / 2;
2298 const unsigned int swapsize = n_el *
sizeof ( char ) * 3;
2303 managedPtr<char> randomAccess[n_el];
2304 managedPtr<char> consecutiveAccess[n_el];
2310 for (
unsigned int n = 0; n < n_el * efac; ++n ) {
2311 adhereTo<char> glue ( consecutiveAccess[n % n_el] );
2317 for (
unsigned int n = 0; n < n_el * efac; ++n ) {
2318 unsigned int idx = test.
random ( (
int ) n_el - 1 );
2319 adhereTo<char> glue ( randomAccess[idx] );
2326 for (
unsigned int n = 0; n < n_el * efac; ++n ) {
2327 adhereTo<char> glue ( consecutiveAccess[n % n_el] );
2335 string demonstrateDecayTest::generateMyGnuplotPlotPart (
const string &file ,
int paramColumn )
vector< testParameterBase * > parameters
void resizeMemory(global_bytesize memory)
Simple setter.
void addTimeMeasurement()
Saves the current timestamp.
void resizeSwap(global_bytesize memory)
Simple setter.
void addExternalTime(std::chrono::duration< double >)
Add a duration to the timing list.
virtual void runTests(unsigned int repetitions, const string &path="./")
Run this performance test with all given parameter variations and handle data collection and plotting...
void setSeed(unsigned int seed=time(NULL))
Set a new seed for random number generation.
int random(int max) const
Get a random number (integer)
void startNewTimeCycle()
Starts a new cycle of time measurements.
virtual void actualTestMethod(tester &test, char **arguments, int &offset, unsigned int argumentscount)=0
Contains the actual test code.
virtual string valueAsString()=0
Cast the encapsulated parameter to a string and return it's mean value.
Derived performance test classes which take parameter types as template arguments.
A basic class to be used by tests. Provides helper methods and functionality e.g. time measurements...
rambrainConfig config
You will find the object in managedMemory.cpp as we have to define it in some 'used' file in the link...
TESTSTATICS(matrixTransposeTest,"Measurements of allocation and definition, transposition, deletion times")
Base class for all performance tests which itself does not contain any parameters.
A base class to encapsulate parameters for performance tests.
const global_bytesize mib