【问题标题】:PAPI (performance application programming) not working properly?PAPI(性能应用程序编程)不能正常工作?
【发布时间】:2012-07-27 20:46:43
【问题描述】:

我从网站上下载了 4.4 版,将其构建在我自己的目录中,并尝试编写一个小主程序,它一直告诉我 num_counters 为零。然后我查看了 ctests 并选择了 hwinfo.c,并从中提取了一些代码(和 testlib)并将其放入一个看起来像这样的小 main 中:

#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;
}

我使用以下方法构建了它:

g++ main.cpp -I/home/pchan/rabbit/papi/include /home/pchan/rabbit/papi/lib/libpapi.a

然后运行它:

./a.out

只是为了见证这个输出:

测试用例 hwinfo.c:检查 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
--------------------------------------------------------------------------------

我对正在发生的事情以及为什么这不起作用......这是什么症状以及我可以尝试解决什么问题?我的处理器是 Intel Xeon X5760,我的 uname -a 说:

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

【问题讨论】:

    标签: c performance performancecounter papi


    【解决方案1】:

    尝试“papi_avail -a”以了解您的 PC 支持什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多