I downloaded version 4.4 off the site, built it in my own directory and tried writing a small main which kept giving me that num_counters was zero. I then looked at ctests and picked hwinfo.c, and ripped out some of the code from it (and testlib) and threw it into a small main that looks like this:
#include <stdio.h>
#include <papi.h>
int main(int argc, char** argv)
{
int retval, i, j;
const PAPI_hw_info_t *hwinfo = NULL;
const PAPI_mh_info_t *mh;
retval = PAPI_library_init( PAPI_VER_CURRENT );
if ( retval != PAPI_VER_CURRENT )
cerr << "Failed at line " << __LINE__ << endl;
retval =
papi_print_header
( "Test case hwinfo.c: Check output of PAPI_get_hardware_info.\n",
&hwinfo );
if ( retval != PAPI_OK )
cerr << "Failed at line " << __LINE__ << endl;
}
I built this using the following:
g++ main.cpp -I/home/pchan/rabbit/papi/include /home/pchan/rabbit/papi/lib/libpapi.a
and ran it with:
./a.out
only to witness this output:
Test case hwinfo.c: Check output of PAPI_get_hardware_info.
--------------------------------------------------------------------------------
PAPI Version : 4.4.0.0
Vendor string and code : (0)
Model string and code : (0)
CPU Revision : 0.000000
CPU Megahertz : 0.000000
CPU Clock Megahertz : 0
CPUs per Node : 0
Total CPUs : 0
Number Hardware Counters : 0
Max Multiplex Counters : 0
--------------------------------------------------------------------------------
I'm a little lost on what is going on and why this isn't working...what is this symptomatic of and what can I try to fix it? My processor is Intel Xeon X5760 and my uname -a says:
Linux chanbox 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
try "papi_avail -a" to know what is supported on your PC.