Commit d4fccb09 authored by Enrico Calore's avatar Enrico Calore
Browse files

Resolved some compilation warnings,

tested with PAPI 5.5.1 (RAPL on KNL),
reduced execution time of the main.c example,
changed the default MAXPAPIEVENTS to 256
and added some "todos" as code comments
parent 170e6366
25/Mar/2017
Tested with PAPI 5.5.1 (RAPL on KNL)
Resolved some compilation warnings
Reduced execution time of the main.c example
Changed the default MAXPAPIEVENTS to 256
Added some "todos" as code comments
23/Jun/2016
Added the possibility to change the output filename
......
......@@ -6,16 +6,16 @@ PAPI_HOME=$(PAPIROOT)
PAPI_INCLUDE = $(PAPI_HOME)/include
PAPI_LIBRARY = -L$(PAPI_HOME)/lib -lpapi -Wl,-rpath,$(PAPI_HOME)/lib
all: papi-read
all: main
papi-read: main.o papi-read.o
$(CC) $(LFLAGS) -o papi-read papi-read.o main.o $(PAPI_LIBRARY)
main: main.o papi-read.o
$(CC) $(LFLAGS) -o main papi-read.o main.o $(PAPI_LIBRARY)
papi-read.o: papi-read.c
papi-read.o: papi-read.c papi-read.h
$(CC) $(CFLAGS) -I$(PAPI_INCLUDE) -c papi-read.c
main.o: main.c
$(CC) $(CFLAGS3) -c main.c
clean:
rm -f *~ *.o papi-read
rm -f *~ *.o main
......@@ -15,9 +15,9 @@ int main (void) {
{ // Function to be "profiled"
PAPI_reader_Marker(); // Place a marker where needed
sleep(30);
sleep(3);
PAPI_reader_Marker(); // Place a marker where needed
sleep(30);
sleep(3);
PAPI_reader_Marker(); // Place a marker where needed
}
......@@ -31,7 +31,7 @@ int main (void) {
PAPI_reader_Start();
{ // Other function to be "profiled"
sleep(60);
sleep(5);
}
PAPI_reader_Stop();
......
......@@ -33,9 +33,6 @@ static char events[MAXPAPICMPS][MAXPAPIEVENTS][BUFSIZ];
// Init time (acquired when PAPI_reader_Init is called)
static long long init_time;
// Start time (acquired when PAPI_reader_Start is called)
static long long start_time;
// Markers
static long long markers[MAXMARKERS];
static int markers_no;
......@@ -155,7 +152,7 @@ static void dump_results(const data_record* results,
long long timesteps,
int cmps_no) {
int i, j, k, cmp;
int i, j, k;
FILE *fp;
#ifdef DEBUG
......@@ -166,7 +163,7 @@ static void dump_results(const data_record* results,
if (fp == NULL) {
fprintf (stderr, "Error opening file: %s. \n", outputfilename);
exit ;
return;
}
// Print Header
......@@ -236,6 +233,7 @@ static int child_function (float freq, const char* papi_cmps) {
while ((pch != NULL) && (cmps_no<MAXPAPICMPS)){
papi_components[cmps_no] = (char*)malloc((strlen(pch)+1) * sizeof(char));
strcpy(papi_components[cmps_no], pch);
printf ("Added component: %s \n", papi_components[cmps_no]);
pch = strtok(NULL, " ,");
cmps_no++;
}
......@@ -282,11 +280,15 @@ static int child_function (float freq, const char* papi_cmps) {
exit(1);
}
#ifdef DEBUG
printf("Found %s component. \n", cmpinfo->name);
#endif
// Cycle over requested components
for (j=0; j < cmps_no; j++) {
if (strstr(cmpinfo->name, papi_components[j])) {
cid[j]=i;
printf("Found %s component at cid %d\n", papi_components[j], i);
printf("Found the requested component %s at cid %d\n", papi_components[j], i);
if (cmpinfo->disabled) {
fprintf(stderr,"No %s events found: %s\n", papi_components[j], cmpinfo->disabled_reason);
exit(1);
......@@ -294,6 +296,9 @@ static int child_function (float freq, const char* papi_cmps) {
}
}
//TODO: Print an error in the case a requested component is not found
//TODO: Exit with error in the case none of the requested components is found
} // end cycle over components
// ****************************************************
......
......@@ -26,7 +26,7 @@
// (MAXTIMESTEP * (MAXPAPICMPS * MAXPAPIEVENTS + 2)) * 8
#define MAXTIMESTEP 100000
#define MAXPAPICMPS 4
#define MAXPAPIEVENTS 128
#define MAXPAPIEVENTS 256
#define MAXMARKERS 1024
//#define DEBUG
......
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