Difference between revisions of "Modifying Programs for Use with PetaKit"
Jump to navigation
Jump to search
(New page: I'm working on a more generalized header for petakit stat collecting. pkit.h) |
(→printStats()) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | Modifying a program for compatibility with PetaKit is quite simple. All you need is your program's source code and access to the PetaKit repository | |
− | + | # Get the pkit.h and pkit.c files from the PetaKit directory of the CVS repository on Hopper and place them with your program's source. | |
+ | # Include pkit.h in your source, and make sure your makefile makes a .o of pkit.c and pkit.h | ||
+ | # At the beginning of your main function, type <code> startTimer(); </code> | ||
+ | #* This starts the timer for accurate wall time | ||
+ | # At the point in your code where all the most important pieces have finished running, place the expression <code> time = stopTimer() </code>. | ||
+ | # After that, include the printStats function, explained in the following section | ||
+ | |||
+ | ==printStats()== | ||
+ | printStats(program name,threads,style of parallelism,problem size,version number, time, cputime, number of additional variables to be printed ...) | ||
+ | |||
+ | #The first seven arguments to printStats() are required output that will be expected by the PetaKit data harvester. | ||
+ | #Next is the count of whatever other values you would like your program to print - most likely for debug purposes. | ||
+ | #*For each additional printout, specify two arguments: | ||
+ | #*#The label, which includes the type of the variable | ||
+ | #*#The variable itself. | ||
+ | |||
+ | Three general classes of variable are supported - | ||
+ | *s: string (stored as char*) | ||
+ | *i: integer (stored as long long int) | ||
+ | *d: double (stored as long double) | ||
+ | |||
+ | The first letter of the label is stripped and read as the variable type, so something like the number of timesteps would be input as: | ||
+ | iTIMESTEPS, (long long int) num_timesteps | ||
+ | |||
+ | This prints as | ||
+ | TIMESTEPS : <number of timesteps> | ||
+ | |||
+ | Here's an example of a call to printStats in an instance of John Conway's Game of Life written in c. | ||
+ | |||
+ | |||
+ | printStats("Life",life.size,"mpi",life.ncols * life.nrows, "1.3", time, 0, 3, "iCOLUMNS", (long long int) life.ncols, "iROWS", | ||
+ | (long long int)life.nrows, "iGENERATIONS", (long long int)life.generations); | ||
+ | |||
+ | And the output: | ||
+ | <nowiki>!~~~#**BEGIN RESULTS**#~~~!</nowiki> | ||
+ | PROGRAM : Life | ||
+ | HOSTNAME : Sam's Computer | ||
+ | THREADS : 1 | ||
+ | ARCH : mpi | ||
+ | PROBLEM_SIZE : 11025 | ||
+ | VERSION : 1.3 | ||
+ | CPUTIME : 0 | ||
+ | TIME : 3.979 | ||
+ | COLUMNS : 105 | ||
+ | ROWS : 105 | ||
+ | GENERATIONS : 1000 | ||
+ | <nowiki>!~~~#**END RESULTS**#~~~!</nowiki> |
Latest revision as of 11:45, 4 August 2010
Modifying a program for compatibility with PetaKit is quite simple. All you need is your program's source code and access to the PetaKit repository
- Get the pkit.h and pkit.c files from the PetaKit directory of the CVS repository on Hopper and place them with your program's source.
- Include pkit.h in your source, and make sure your makefile makes a .o of pkit.c and pkit.h
- At the beginning of your main function, type
startTimer();
- This starts the timer for accurate wall time
- At the point in your code where all the most important pieces have finished running, place the expression
time = stopTimer()
. - After that, include the printStats function, explained in the following section
printStats()
printStats(program name,threads,style of parallelism,problem size,version number, time, cputime, number of additional variables to be printed ...)
- The first seven arguments to printStats() are required output that will be expected by the PetaKit data harvester.
- Next is the count of whatever other values you would like your program to print - most likely for debug purposes.
- For each additional printout, specify two arguments:
- The label, which includes the type of the variable
- The variable itself.
- For each additional printout, specify two arguments:
Three general classes of variable are supported -
- s: string (stored as char*)
- i: integer (stored as long long int)
- d: double (stored as long double)
The first letter of the label is stripped and read as the variable type, so something like the number of timesteps would be input as:
iTIMESTEPS, (long long int) num_timesteps
This prints as
TIMESTEPS : <number of timesteps>
Here's an example of a call to printStats in an instance of John Conway's Game of Life written in c.
printStats("Life",life.size,"mpi",life.ncols * life.nrows, "1.3", time, 0, 3, "iCOLUMNS", (long long int) life.ncols, "iROWS", (long long int)life.nrows, "iGENERATIONS", (long long int)life.generations);
And the output:
!~~~#**BEGIN RESULTS**#~~~! PROGRAM : Life HOSTNAME : Sam's Computer THREADS : 1 ARCH : mpi PROBLEM_SIZE : 11025 VERSION : 1.3 CPUTIME : 0 TIME : 3.979 COLUMNS : 105 ROWS : 105 GENERATIONS : 1000 !~~~#**END RESULTS**#~~~!