PAPI - netlib.org
Transcript of PAPI - netlib.org
I C L
Title goes here 1
Performance Measurementwith PAPI
����������
������� ��������
��������������
������ ��!��
����������"
���������������
#$%�����&%�' PAPI
ThePerformance Application Programming Interface
�������������� ���������������� �
(���%�
� (����� !�"�������"!�����(���! ���)�����!"�
� #�����������������$�$%����&�"��������'��������!�'!�'�(��!�'�� ��� ����!�����!)���!�'�����"������$%����!""���������!�'*!��������� !�"�� �������"����������'���� ���� �'���� �"�����"������+
� $!�!�����#������������� ����&�"������,--***+������+��-
�������������� ���������������� .
*%�+��%�
� #����"��!���!����"!����������� !�"��!�'������ ��������
� #��"�!�!"����(��!����"!�����!�'������ �*��/��!'���������$0
� #����� �!��������� !�"�������'�1���� ����!�'�����!�"�
� #����� �!�������!�"����� ������������"!��'����')!"/�'��1���"� ���!�������"���2��
I C L
Title goes here 2
�������������� ���������������� �
,%��
� ����'����'!���������"�������!���� ������� !�"��!�!�����������
� 3���������'�1����������� ���4� ��� ������"������!""���
� ��!�'!�'�(!�����)��*����1��'�����!"!'� �"��!�'�����
� 5�"��!��1��'����������1�'���!�'*!���!�'�6�������������"������!""���
� 7������"��� ��� ���!����������!�� )������8$��!�"����"����
� �����'�" ����'�!�'��!���������
-�+��.�%/�*%�����0�1$�(��/%�2�� ���%2����1��
�� $�� ���
�������������� ���������������� �
*%�����0(���� $�� ���
� 7%����������4�"!�!��!�"����"���
9$�������'���"����!������
9:���������"����!���������������$0
9���"�!��1���;�"����
9��1��!����1�������"!"��� � ���
9�!"�����������!��'�)��*�����$0�
�������������� ���������������� ��
(���������3�� �%����4��
� #���"��"��������!�"������!�������� ��!��1�������!��������"!���'�!��������������+
� :�����������!�'����!���������������!����������
95!"����!�����!���������'�����*��/������ ��!����������'���������������������!�'�
9�����������!����!�����!���"����!������������!��������������1����"��"/�"�"��
�������������� ���������������� ��
��� ����+��56� ��%�
� #����$0�!��� ����������'�"��*��"��*!��!�)�!�"��*������!�'�"���������;�"���������"���������"�!��1����!������!���!��+
9%���������'�"��������*����������"�������;�"��'�'�*��������"����"���!��� ���)��"!�"���'+
96�� !������"���������!�'*!���"�������/����"��������)�!�"�����'�"����������!�'� �����+
�������������� ���������������� ��
7��%/�7�����56� ��%�
� �$0�'��! �"!�����;�"���������"������!������������!�'��)�"� ��!1!��!)������������'��������"���!��
9 ��������������!��'���������'�������� ���!��������!������1���������"�������!1���""��������"� �����'+
9 <����!�����'��������"��*��"�������"��������������'��! �"!������������;�"���������+
9 7���1!����!�'*!���"������ ����"�,�������"����������'�������"������"� �����'
I C L
Title goes here 3
�������������� ���������������� �=
(�%%&�� ��-)����(4
� .�)!��"����������������������+
� %�������!����7%���
� 6������������4�"!�!��
9 $��"���������!���!1�� ���������"����!�������!���"!���'�������������
�������������� ���������������� ��
�$������� � �����(�������
�������������� ���������������� ��
�$������� � ������(4�8�9
� � �$��'�"�'����������������"���������%4"!"��
93����!"�����,
�%���������*���������)���
93����!"�������"����,
�%������)������������*�!������������,�>�!�"���5;�+�0�����:� +�7��
�%������)�!�"����������)���
�������������� ���������������� �.
)��� �%��(���� %���1
�������������� ���������������� ��
� � �3��"�-3��*����'�"����
9?������*�������1����"������*�����������������
9>�!�"�����'�"������""����!�������������������)�"!���*�� ���*!�����������!�'�����)��!1!��!)��
9>�������������������;����������������"������������"�+�%��*������'!���)!��'�����������"+
�$������� � ������(4�8�9
�������������� ���������������� �@
� = �A�"�'�->�!�"�9���������"������)!��'��������)�!�"���!��+
9 %�������!���������'����)��������������������������!���"�����'������"������*����)��'��"!�'�'+
� � �%����"�����A���!�"�-7���'��9 %����"������!���'���!�"��'�*������"����!������!�'�����-��������������)�"� ��!1!��!)��+
9 7��! ����������,������ �����������!�����'����������������������"������!���������'��!��*��"������������B���"� ����'+�
�$������� � ������(4�8:��9
I C L
Title goes here 4
�������������� ���������������� ��
� � �5;�"�����0����
9�� ���������/������C�!'-����������� !���!1��!�� )����������!�'��������"�������;�"����!��!����1����� �+
9>�!�"������ ���"� ��"!���!��������1�'�)�!�"�������!�������������+
�$������� � ������(4�8�9
�������������� ���������������� ��
� . ��� �����'�%����"�����>�����!�'�7������0���
9#����%>����'�������"��������!���!1��)�������"�!��1�����;�"��'����"�'������! �����������!�'���!�+
9$��)�� ,����"!�����������������"�����������*��!�������!��������"������)����������!1������"!��'�!���;"������������������*����������������! ���'��+
�$������� � ������(4�8!9
)����������� ��%��(��/%�2�� ��
*�����2��
�������������� ���������������� ��
0���.�����%����
� � !���������������������!��"������������*��"��!����""����"���������"���"����!������!��'�����������"�����B����"����
� :����������������1������!"����!����"�����!�����)��*�����������"��������������"�-�)&�"��"�'��!�'���������"���"��������� !����������!��"�'����������'�������!�"����"���+
�������������� ���������������� �=
)��� �%���%�������3�� �%����4������
� 7���1!����!�'*!���"������'!�!,9 #��!��"�"���
9 #��!�������"�����
9 3��!��������������!�����
9 C�!'-�����������"�����
9 ��"������"����!�������!����'��
9 ��"������!���'�� *!��������� � ����!""���
� *!��������������"�
9 ���'�����!��)�!�"�������"������ �;�"��'
� �����'�"��'
�������������� ���������������� ��
�� $������*�2%�&�0����� $&
� 7�������,��6�4"����"��"�������'�������'�����!�'��!�'�����������"!�"�!�����
� C������ !�� �'!�!�"!"��,��� !�����4"����"!"�����'�������'�'!�!�!)������)������!��'���
� C�����"��'!�� �"!"��,��C!�������4 ������4"��� �"!"�����'�������'�'!�!�!�'������"������������1�'���� ���"!�� � ���+��
� �� ������� ���!1��C=�!�'��1���C��"!"���+
I C L
Title goes here 5
�������������� ���������������� ��
�� $������*�2%�&�0����� $&
� C�"!�� � ���,��:� ������������! ����'��!���������"�����
� 7� ���� � ���,��:� �������!���������'��)��!""����)����1���!�������"����"�����*��/+
� 5!"����1���������� � ��������!�"��������'"���!����;� !�����!����'������ !���'�� �����!���"����!���������1������1��+
�������������� ���������������� �.
�� $����� ���
� :� �������!���'�������!��(�'�!��!��!��!��������������*��"��!�������"!���������@�*��'�����+�������!�'!�!���� �������"��'���� �!���������1���"!"��������� ���"!�� � �����!���������"!"��������������"��'+
� �!"����"!��)���������9 ���������� ���
9 �������������������
� ������������""���*������������! �����������!�'!�!���� ���!������������������������"!"��+
�������������� ���������������� ��
�� $���%����%�
� ������*����� �����$0��!�����!�����!�'�����!��'����'!��������! ��"!"�������9����������������� *�����*����� �����$0���'!��������! ��1!��!)���
� "����"���������1��1���!��!������ �"�!��
9 ������������ *�����$0���'!���'�����"��1!��!)������!���""��������! ��"!"�������
� "����"���������1��1��� �'���"!��������'!�!����"�����!���
� 7���1!����!�'*!���"������ ����"�9 �!"��� ������!�'������!����
9 �!"����������1!��'!�����
�������������� ���������������� �@
�;<�����=������*�2%�&
� :� �������'�1�'�'�����������+
� #�������!��������� ���!���!��������1���!���!��!''���������'�)��!�����! �����������"!��!''���������'�)�������!�'*!��+9 #��� ������"��������'�!''�������!���"!"��'������������������������ ����������� �
9 �������������! �����������!�1���!��!''�������!����������������#C>��!���������""��+
� 7���1!����!�'*!���"������ ����",�#C>� �����
�������������� ���������������� ��
*�2%�&�;��� ��
� �$0��������,���"�"���
� C��"!"������,��4=�"�"���
� C��"!"��� �����!������'�)��C��"!"������,�@4���"�"���
� C��"!"��� �����!������'���� � !��� � ��������#C>� ���,����4����"�"���
� #C>� ������2��������������!'��������#C>,��D�����"�"���
� #C>� ������2���������!'����1���!���!��9 ��������,���'��'����� �����������"�"���
�������������� ���������������� =�
����%/�7��2�>��%�
� 6��� �(��"� �������*��"����
� %����!�����)�!����
� $������
� 6��� �(��)��"/�����"�'����!��'� ��!����;�"������� ��)�������!�'*!���"������'!�!����'���� ����*�������)�������"/���;���
� ��*!����;! ����"����"������!���1������!�E�
I C L
Title goes here 6
0���.����56�2���
�������������� ���������������� =�
56�2���?�*)(��-��@
� :%$��7��F
9�����!������������������ ������4!''����!''
9�������������
9����!'-����������
�������������� ���������������� ==
*)(��-��@�<�% �����1��2
�������������� ���������������� =�
56�2���?�)����(����2
� %�����$���� �$����%%�!�'�%%%
9%����'���;@.������"������'�"�'�������������'���6$�
90��������6$��!"��1��!��!����1����� �
9���C0������C�0�����3$0
9�����)����!�'*!���"����������.��)���"�"���"�����
�������������� ���������������� =�
(����2�))��� $�� ���
�������������� ���������������� =.
56�2���?�)����(����2
� %�����$���� ��
9%����'���;@.������"������'�"�'�������������'���6$�
90�������.�6$����������
90������@���!'��!�'�������������������
9=��C0������C�0�����3$0
9�@����)����!�'*!���"����������.��)���"�"���"�����
I C L
Title goes here 7
�������������� ���������������� =�
(����2���<�% �����1��2
�������������� ���������������� =@
56�2���?�)����)����2
� %�����%�!��
95$%���5;���"�����$!�!�����%����"������� ���� �'����
9�������������
9�� ��� �'�!�����
9����!'-����������
9=�)�!�"������
9���;���'�'����"���������!��������������
9�����������"���������!��������������
�������������� ���������������� =�
)����2G �(4�<�% �����1��2
L2 C
ache
Bus Controller
L3 C
ache
Sco
rebo
ard,
Pre
dica
te,
NaT
s, E
xcep
tions
Branch & PredicateRegisters
128 Integer Registers
128 FP Registers
BranchUnits
Integerand
MM Units
Dual-PortL1
DataCacheAnd
DTLB
ALA
T FloatingPointUnitsSIMDFMAC
BranchPrediction
IA-32Decode
AndControl
L1 Instruction CacheAnd
Fetch/Pre-fetch EngineITLB
Register Stack Engine / Re-Mapping
B B B M M I I F F
DecouplingBuffer
8 Bundles
�������������� ���������������� ��
56�2���?�)<*�(7#5-:
� %>:�$�*���=
9�����!���������������� ������4!''
9=���;�'�����������
9����!'-����������
9��)�!�"�-'���!�"�����
�������������� ���������������� ��
(7#5-:��(4�8!��9
FloatingPointUnit
FPU1
FloatingPointUnit
FPU2
LD/STUnit
LS1
FixedPointUnit
FXU2
LD/STUnit
LS2
FixedPointUnit
FXU1
FixedPointUnit
FXU3
Branch/Dispatch
Memory Mgmt UnitInstruction Cache
IU
BIU Bus Interface Unit: L2 Control, Clock
Memory Mgmt UnitData Cache
DU
L2 Cache1-16 MB 5XX Bus
Branch history table: 2048 entriesBranch target cache: 256 entries
32 KB, 128-way
64 KB, 128-way
32 Bytes 32 Bytes
32 Bytes @ 200 MHz = 6.4 GB/s 16 Bytes @100 MHz = 1.6 GB/s
�������������� ���������������� ��
56�2���?�)<*�(7#5-�
� %>:�$�*����
9�����!���������������� ������4!''
9����;�'�����������
9����!'-����������
9��)�!�"���;�"��������
9��"��'�����!�������������
9�����"������"���������"�����E
I C L
Title goes here 8
�������������� ���������������� �=
(7#5-��<�% �����1��2
�������������� ���������������� ��
(7#5-��(�% �%���%��
�������������� ���������������� ��
(7#5-��*�2%�&��� $��1
� C��%�!"��,�.�F>�-�"���H���4"���
� C��A�!"��,�=�F>�-�"���H���4"���
� C���!"��,��+��:>������'H���4"���
� C=��!"��,�=�:>����4"���
� :� ���,���9 �.�?>
�������������� ���������������� �.
(7#5-��*��� �$���*%����
�������������� ���������������� ��
(7#5-��*��� *%�����A%��
,����������1��%/�(�()
I C L
Title goes here 9
�������������� ���������������� ��
(�()��%�����)���/� �
� $�$%����1�'���������������!"�����������'�������"�������!�'*!��,
�+ #�����*���1���������!"�� !�!����!�'*!����1������������'�����'������"!���'�!����"���+�
�+ #���������1���������!"���� �������1�'�������!)�����������!���������!�'���!'�����"�����������!����"����'����������1����+
=+ ?�!���"!�����������1��!��(������� !����+
�������������� ���������������� ��
(�() )2���2����%�
�����
PAPI Low LevelPAPI High Level
Hardware Performance Counter
Operating System
Kernel Extension
PAPI MachineDependent Substrate� �����
����������
�������������
�������������� ���������������� ��
(�()�����-�����
� $�!���� �9 C��;-;@.�����'�*������
� 7�2������!�"�����C��;�/�������'��1����������'�*�
9 C��;-%�4.�
9 ������!���-0���!��+@
9 %>:��%I-$�*��=� ����!"��%>:������ ����/��
9 �?%�%7%I-:%$�
9 �� �!2�#�.�-����!�51.�J�51.�� 7�2�����6��'�1�"��'��1������ ��� �!2
9 ��!��#=5-0��"��
�������������� ���������������� ��
(�()�����)���/� �
� ��!�'�3����!��)��'����!�'�:!��!)�*�!����������'�*������
� #��'�*���!'�����*!��,
����,--�"�+"�+�/+�'-���&�"��-�!��-
�������������� ���������������� �=
(�()�(����5+��
� $������'���!�'!�'���������1�����'�� �'� ��������1!�������!����"!����������� !�"������
� A�����'�����!����'51���A���+�
� :!���'�����!��1���1��������!��1�����!����
97�������-!1!������������������$�$%���������1�����!1!��!)������!���!����
�������������� ���������������� ��
(����5+��
� $�$%��������������������1�����!�'��!��1���1����+
� $�������1�����!��� !��������� ��� )���"��! ������ !"��������"���"�'���������������!��!���"�!���!�'*!��������"�+
� 5;! ���,�#��!����"������������ �'� ����PAPI _TOT_CYC
� $�$%�!���������������������!�� !��)��'���1�'���� ������'��������!�'*!��� ����"�
� 5;! ���,�3��!����$�����%����"������������"��'����PAPI _FLOPS
I C L
Title goes here 10
�������������� ���������������� ��
(����;���1�/�%2�t est s/ avai l
Test case 8: Avai l abl e event s and har dwar e i nf or mat i on.- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Vendor st r i ng and code : Genui neI nt el ( - 1)Model st r i ng and code : Cel er on ( Mendoci no) ( 6)CPU r evi s i on : 10. 000000CPU Megaher t z : 366. 504944- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Name Code Avai l Der i v Descr i pt i on ( Not e)PAPI _L1_DCM 0x80000000 Yes No Level 1 dat a cache mi ssesPAPI _L1_I CM 0x80000001 Yes No Level 1 i nst r uct i on cache mi ssesPAPI _L2_DCM 0x80000002 No No Level 2 dat a cache mi ssesPAPI _L2_I CM 0x80000003 No No Level 2 i nst r uct i on cache mi ssesPAPI _L3_DCM 0x80000004 No No Level 3 dat a cache mi ssesPAPI _L3_I CM 0x80000005 No No Level 3 i nst r uct i on cache mi ssesPAPI _L1_TCM 0x80000006 Yes Yes Level 1 cache mi sses PAPI _L2_TCM 0x80000007 Yes No Level 2 cache mi sses PAPI _L3_TCM 0x80000008 No No Level 3 cache mi sses PAPI _CA_SNP 0x80000009 No No Request s f or a snoop PAPI _CA_SHR 0x8000000a No No Request s f or shar ed cache l i nePAPI _CA_CLN 0x8000000b No No Request s f or c l ean cache l i nePAPI _CA_I NV 0x8000000c No No Request s f or cache l i ne i nv....
����,--�"�+"�+�/+�'-���&�"��-�!��-�����-�� �K !�-�!��K�������+�� �
(�()�0�1$ ;�+���)���/� �
�������������� ���������������� ��
0�1$ ��+���)���/� �
� :�!�������!����"!���������! ����*!�����"�!���4�!���'� �!��� ����
� L�������!'��!��
� �!����������*�����1����$%
� ����*�������$�$%���������1����
� 5!�����������!�'������������!''�����!��"�'� ���!����*4��1��
�������������� ���������������� �@
0�1$ ��+����()
� ��������!"�$�$%K��!��K"������$�$%K��!'K"������$�$%K����K"������$�$%K!"" K"������$�$%K� K"������$�$%K�����
� 3����!��������!"�$�$%3K��!��K"������$�$%3K��!'K"������$�$%3K����K"������$�$%3K!"" K"������$�$%3K� K"������$�$%3K�����
�������������� ���������������� ��
0�1$ ��+���)���/� �������
• i nt PAPI _num_count er s( voi d)
9 %����!��(�� $�$%��������'�'
9 7������� )�������!�'*!���"������
• i nt PAPI _st ar t _count er s( i nt * event s, i nt l en)
9 %����!��(�� $�$%��������'�'
9 �������!���1��������*���������1���"������
9 ��!����"��������������1�������
• i nt PAPI _l i br ar y_i ni t ( i nt ver si on)
9 C�*4��1����������� ���"�����"!���'�)��!)�1�
�������������� ���������������� .�
�%��%����1�$���%����
• PAPI _st op_count er s( l ong_l ong * val s, i nt al en)
9 �����"�������!�'����"������1!�������!��!�
• PAPI _accum_count er s( l ong_l ong * val s, i nt al en)
9 �"" �!���"������������!��!��!�'������
• PAPI _r ead_count er s( l ong_l ong * val s, i nt al en)9 �����"������1!���������!��!��!�'�������"������
• PAPI _f l ops( f l oat * r t i me, f l oat * pt i me,l ong_l ong * f l pi ns, f l oat * mf l ops)
9 �!��"��"/�� ������"������ ���3$��������"����!���9 :����-�����"���!���"!��
I C L
Title goes here 11
�������������� ���������������� .�
(�()B/�%�
• i nt PAPI _f l ops( f l oat * r eal _t i me, f l oat * pr oc_t i me, l ong_l ong * f l pi ns, f l oat * mf l ops)
9 6�����*��"!�������'�'��$�$%K������)������!�'�!���������"�'�����*!������ ������
9 ��!�K�� ���������*!��4"��"/�� �)��*���������*��"!���
9 ���"K�� ���������M1���!�N��� ������� ���������"����*!��!"�!�����;�"����)��*���������*��"!���������!��������!���'�!����!�K�� ��)��)���������������� �!��� ����
9 ������ ����������!�����!���������������"�������;�"��'�)��*���������*��"!���
9 ����� �������:����-���!����)��*���������*��"!���
9 %��O������ PP�4������"�������!��������
�������������� ���������������� .�
(�()�0�1$ ��+���56�2���
l ong l ong val ues[ NUM_EVENTS] ;unsi gned i nt
Event s[ NUM_EVENTS] ={ PAPI _TOT_I NS, PAPI _TOT_CYC} ;
/ * St ar t t he count er s * /
PAPI _st ar t _count er s( ( i nt * ) Event s, NUM_EVENTS) ;
/ * What we ar e moni t or i ng… * /do_wor k( ) ;
/ * St op t he count er s and st or e t he r esul t s i n val ues * /
r et val = PAPI _st op_count er s( val ues, NUM_EVENTS) ;
�������������� ���������������� .=
-����� %��
Name Description PAPI_OK No error PAPI_EINVAL Invalid argument PAPI_ENOMEM Insufficient memory PAPI_ESYS A system/C library call failed. Check errno variable PAPI_ESBSTR Substrate returned an error. E.g. unimplemented feature PAPI_ECLOST Access to the counters was lost or interrupted PAPI_EBUG Internal error PAPI_ENOEVNT Hardware event does not exist PAPI_ECNFLCT Hardware event exists, but resources are exhausted PAPI_ENOTRUN Event or envent set is currently counting PAPI_EISRUN Events or event set is currently running PAPI_ENOEVST No event set available PAPI_ENOTPRESET Argument is not a preset PAPI_ENOCNTR Hardware does not support counters PAPI_EMISC Any other error occured
(�()�;%. ;�+���)���/� �
�������������� ���������������� .�
;%. ��+���)���/� �
� %�"��!��'�����"���"��!�'���"����!������1�������������1���$�$%�������!"�
� �)��������"�����������,--�"�+"�+�/+�'-���&�"��-�!��-�����-�� �K !�-�!��+�� �Q�
� 6)�!�������� !�����!)��������;�"�!)���!�'������!�'*!��
� #���!'4�!��
� 3��������! !)��
� :������;��
� �!��)!"/�����"�������1�����*
� $�������
�������������� ���������������� ..
;%. ��+���3�� �%����&
� C�)�!��������!��(!����
$�$%K��)�!��K������$�$%K����!'K������$�$%K ������;K������$�$%K���'�*�
� #� �����"�����
$�$%K��K��!�K��"��$�$%K��K1���K��"$�$%K��K��!�K"�"��$�$%K��K1���K"�"
� %�2������"�����
� :!�!� ������"�����
� �� ������"/
$�$%K��"/-$�$%K���"/
I C L
Title goes here 12
�������������� ���������������� .�
0%.����7��@������2�&�0������0���.�����%����
� $��)�� �,9 #����!�'*!���������!��!�� !���� )������)���+
9 #����!�'*!���"!��"����0�57�!�'�F57L5C� �'��+
9 #����!�'*!������'�����)��!""����'�)�� ������������!�������! ���� �+
9 :����������"�����������!'��!�'��$0�+
� �������,�:�'���������"��'���9 �!1��!�'�!"" �!�������"�������!�'*!��������.��)���1���!�����������*��������!'-���"���������'�����)��"/�+
9 7�����������"������"���������������!�'�(��������"������1!����*��������!'-���"������� ��+
9 7�!'��� !���"�,���!'��������!�'*!���"�������!�'�!''���� ��������.��)���2!���������!�'��'�)������/�����+
�������������� ���������������� .@
�$���%�%/�������1�(�()
� %���� ���!����������'"����1����!'
9 7�!'����!�'*!���"�������"!��)��"��!�
� L���1����!'�*�����"����������!/�����!"�
9 :���"��������"������������!�'���!'���"������
9 #�����"���������'�)��� !���"� �!��'�����;�"������� ��������!���!)���������
9 0���cost . exe ��� �!�����!���"����
�@��=��.����.��.����$�$%���!'�"�"���-"!��
��@�������==�������=���$�$%���!��-�����"�"���-�!��
:%$��7��F
%>:�$6�57=
��!��#=5
C��;-%�.�
C��;-;@.
�������������� ���������������� .�
5+����
� #����1��������"���!����/�������� !����
9 ��!����*4��1����!�'*!���"������������
9 :������"��������!'�"������1!���
9 #�����!�����������1��������������-���������
9 6����������������++��'� !�����!��!�������1�����*����������
� 51���������"!���1���!���������� !����������! ���!�'*!���"���������4�+
9 ����*����"���1�-�;"���1�� �!��� ����
�������������� ���������������� ��
5+�����7�����%�
� 51�������� !�!� ���$�$%K"��!��K�1��������$�$%K!''K�1���R�S��$�$%K�� K�1���R�S��$�$%K'������K�1������
� 51��������"������$�$%K��!����$�$%K������$�$%K��!'��$�$%K!""
� 51����������2���$�$%K2���K�1�����$�$%K����K�1�����+++�
�������������� ���������������� ��
��2����56�2���
#i ncl ude " papi . h”#def i ne NUM_EVENTS 2i nt Event s[ NUM_EVENTS] ={ PAPI _FP_I NS, PAPI _TOT_CYC} , Event Set ;
l ong_l ong val ues[ NUM_EVENTS] ;/ * I ni t i al i ze t he Li br ar y * /r et val = PAPI _l i br ar y_i ni t ( PAPI _VER_CURRENT) ;/ * Al l ocat e space f or t he new event set and do set up * /r et val = PAPI _cr eat e_event set ( &Event Set ) ;/ * Add Fl ops and t ot al cycl es t o t he event set * /r et val = PAPI _add_event s( &Event Set , Event s, NUM_EVENTS) ;/ * St ar t t he count er s * /r et val = PAPI _st ar t ( Event Set ) ;
do_wor k( ) ; / * What we want t o moni t or * /
/ * St op count er s and st or e r esul t s i n val ues * /r et val = PAPI _st op( Event Set , val ues) ;
�������������� ���������������� ��
������1����5+����
integer evset, statuscall papif_create_eventset(evset, status)
evsetstate: PAPI_STOPPED
I C L
Title goes here 13
�������������� ���������������� �=
�����1��+���%����5+����
integer evset , statuscall papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)
1. PAPI_TOT_CYC
evsetstate: PAPI_STOPPED
�������������� ���������������� ��
�����1��+���%����5+����
integer evset , statuscall papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)
1. PAPI_TOT_CYC2. PAPI_FP_INS
evsetstate: PAPI_STOPPED
�������������� ���������������� ��
�����1����5+����
integer evset , statuscall papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)1. PAPI_TOT_CYC
2. PAPI_FP_INS
evsetstate: PAPI_RUNNING
�������������� ���������������� �.
-�����1����5+����
integer evset , statusinteger*8 values(2)call papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)C do 1000000 flops in 500000 cyclescall papif_read(evset, values, status)C values contains the metrics in order of additionC values(1) = 500000C values(2) = 1000000
1. PAPI_TOT_CYC 500000
2. PAPI_FP_INS 1000000
evsetstate: PAPI_RUNNING
�������������� ���������������� ��
�%����1����5+����
integer evset , statusInteger*8 values(2)call papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)C do 100000 flops in 500000 cyclescall papif_read(evset, values, status)C values contains the metrics in order of additionC values(1) = 500000C values(2) = 100000call papif_stop(evset, values, status)
1. PAPI_TOT_CYC 500000
2. PAPI_FP_INS 100000
evsetstate: PAPI_STOPPED
�������������� ���������������� �@
-����1����5+����
integer evset , statusInteger*8 values(2)call papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)call papif_read(evset, values, status)call papif_stop(evset, values, status)C state can be either RUNNING or STOPPEDC to call resetcall papif_reset(evset, status)
1. PAPI_TOT_CYC 0
2. PAPI_FP_INS 0
evsetstate: PAPI_STOPPED
I C L
Title goes here 14
�������������� ���������������� ��
52�&��1����5+����
integer evset , statusInteger*8 values(2)call papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)call papif_read(evset, values, status)call papif_stop(evset, values, status)call papif_reset(evset, status)call papif_cleanup_eventset(evset, status)
evsetstate: PAPI_STOPPED
�������������� ���������������� @�
3�����1����5+����
integer evset , statusInteger*8 values(2)call papif_create_eventset(evset, status)call papif_add_event(evset, PAPI_TOT_CYC, status)call papif_add_event(evset, PAPI_FP_INS, status)call papif_start(evset, status)call papif_read(evset, values, status)call papif_stop(evset, values, status)call papif_reset(evset, status)call papif_cleanup_eventset(evset, status)call papif_destroy_eventset(evset, status)
evset
�������������� ���������������� @�
4��1�(�()�.�$��$����
� ������$�$%K��)�!��K��������'��������������2������!'��'�����������"����
� 3���$����!'�
r et val =PAPI _t hr ead_i ni t ( pt hr ead_sel f , 0) ;
� 6���:$
r et val =PAPI _t hr ead_i ni t ( omp_get _t hr ead_num, 0) ;
� 5!"������!'���������)�������"��!��������!���������!�'���!'���������*��"������
�������������� ���������������� @�
4��1�(�()�.�$�*������6��1
� :������;���!���*���� ��!����������� ����"���������!��!����������'�)�������!�'*!��+
� $�$%K ������;K����� �9����'�)��"!���'�!�����$�$%K��)�!��K����� ���������!��(�� ������;��
� $�$%K���K ������;����� O51������ H90��'�!����������1������ ���"��!��'����������� ������;���������!���1������
� #�������$�$%���� !���
�������������� ���������������� @=
)���.�$�*������6��1
� �� ����!���� ����������!�'*!��� ������;��+�
� 6����������!��'��B���$�$%�� ��� ����� ������;����������*!��+
� #��� �����1�������� ������;�������!���������! �����������������������+
�������������� ���������������� @�
*������6��%���56�2���
�����- ������;�+"
�����- ������;�K�����!'�+"
3�� �����$�$%����"��'�����)����,
I C L
Title goes here 15
�������������� ���������������� @�
A��+��5+��
� ����1����"���!)���)�������$0�"!��)��"����'��1������������������ !�"�����������$�$%��1���
� �! ��������!"��!��*�������������!���������1�����)��!��$04���"���"�)����!�����������'������!'��������$�$%��1����'���������
�������������� ���������������� @.
A��+��5+���56�2���
�����-�!��1�+"
������-�!��1�+3
3�� �����$�$%����"��'�����)����,
�%�����7+��/�%.���
���� ���(�%/����1
�������������� ���������������� @@
����C� ��%���%�����7+��/�%.
� $�$%����1�'�������!)���������"!������4'�����'��!�'�����*����!����"����'��1�����;"��'��!����"����'���������'+
� 3�������� ����!��'�������������"�������1�����*�!������6����1����$�$%��������!��������������������1!���� ���!�'�����!����!��� �������������!�'���+
�������������� ���������������� @�
(�()B%+��/�%.
� �������!��51��������"����!��*����������$�$%K��!��� B'�����)�����������������1�����*�
� #���51������� !��"���!��� ��������1������)����������� !��)��!���1�����*������+
i nt PAPI _over f l ow( i nt Event Set , i nt Event Code, i nt t hr eshol d, i nt f l ags, PAPI _over f l ow_handl er _t handl er )
�������������� ���������������� ��
7+��/�%.��%���56�2���
�����-�1�����*+"
�����-�1�����*K�����!'�+"
3�� �����$�$%����"��'�����)����,
I C L
Title goes here 16
�������������� ���������������� ��
���� ���(�%/����1
� $�$%����1�'���������������T7�4"� �!��)����;�"��������������)!��'����!���"�������1���+
� $�$%K������� �"��!����!�������! �����1�����*�"���������!����"����'��������������!����"!�����"�'�+
�������������� ���������������� ��
(�()B��%/��
i nt PAPI _pr of i l ( unsi gned shor t * buf , unsi gned i nt buf s i z, unsi gned l ong of f set , unsi gned scal e, i nt Event Set , i nt Event Code, i nt t hr eshol d, i nt f l ags)
�)�9 )��������)���(�)��������*��"������������! �"�����!��������'
��������9 ��!���!''���������������������)���������'
��"!���9 "����!"������!"������!����'�"!������*� "��� !���������������! �)����������!���������������)���������'
�������������� ���������������� �=
(�%/����1��%���56�2���
�����-�������+"
�����-��������+"
�����-�������K�����!'�+"
3�� �����$�$%����"��'�����)����,�%%��$�����(�()
�������������� ���������������� ��
(��/%2���
� �����"!������������� ����'�*����$�$%9 "!�������� �����
9 "!��� !�/K����� ����������
� �����"!����������!���'+��������"!���������/%2���� ���!���!�'����!�'��� ���!����������"����"��!�'����'���������� !��������!�U!1!�!������"���!����������!���"!��1��*+
� ��"���������"�'����!��!���������������"!��)��'����!��'�*�������"���"�"�����9 0����!�"!���������K����� �����V"����B
� 7�!�4�� ��'����!�������!"������
�������������� ���������������� �.
local machine
(��/%2���
App
perfometer
PerfGUI
I C L
Title goes here 17
�������������� ���������������� ��
machine A machine B
(��/%2���
App
perfometer
PerfGUI
�������������� ���������������� �@
Perfometerserver.
.
.
MPI application
machine B
(��/%2���
Process 1perfometer PerfGUI
Process 2perfometer
Process nperfometer
�������������� ���������������� ��
(��/%2���
����������
� ��� ��
� ������� �
��� � �� ���
��� �� ���
��� � ��������
�������������� ���������������� ���
(��/%2����(��������)���/� �
(��/%2������2%
�������������� ���������������� ���
�&��(�%/
� �����"!������������� ����'�*����$�$%9 "!�������� �����
9 "!��� !�/K����� ����������
� �����"!����������!���'+��������"!���������/%2���� ���!���!�'����!�'��� ���!����������"����"��!�'����'���������� !��������!�U!1!�!������"���!����������!���"!��1��*+
� ��"���������"�'����!��!���������������"!��)��'����!��'�*�������"���"�"�����9 0����!�"!���������K����� �����V"����B
� 7�!�4�� ��'����!�������!"������
I C L
Title goes here 18
�&��(�%/��2%
�������������� ���������������� ���
7$����%%��$�����(�()
� A55$-$�$%��$!"���"������! ��������� � � �� ����� ��������� �������� �
� #�0��������:!�������0����6���� ��������� � � �� ������������� ������������ � �����
� �1$!)�� �A!��7��'��0����%������� ������������ �� ���������� �� ���� �� ���� �� �������
� �!"����5'����'����:!;�$�!�/-0����%������� ��������� � � ����!�� ��� �� �� ���
� T�����������U!��������!�'�!�C�1�� ����C!) ���������� ���� ��� ������"��#�� ���������
� �������#���������?������67LC
�������������� ���������������� ���
3%��*%���)�/%�2��%�
� ����,--�"�+"�+�/+�'-���&�"��-�!��-
9����*!���!�'�'�" ���!����
97������"�� !����!��
9$!�����!�'��������!�����
9#���'4�!���������
9:!����������
�������������� ���������������� ��.
0%2�.%�����1�2��
� �� ��������������������� ���������� ��������������������������������������� ��������� ������ ������������������������������������������ ����������������� �������������� ����� ����������� ������ �� �������� ���� ����� ��������������������������� ������ �������������������� ��!��������� ��������� ��"#���������������� ������������������ �� �� �����$������ ����%#��������������������� ������������&� ��' ( )*+#�� � ����������������������������������������������$� �%�������������� � �� ���
�������� ��"�� ���������#�������� ������ ����������� �������� ���������� �����������������
�������������� ���������������� ���
0%2�.%���-�%�� �
&������������' ( )*+������� ������������#����� ���� ���������� �� �� ������ ������������������ �����#������������� ���������������� �����������"�� �,-��������,��� ��+#����������������������� ����� ����������������������� ���� �������������� ������������ ����