papi_1.c File Reference

Include dependency graph for papi_1.c:

Go to the source code of this file.

Defines

#define MAX_COUNTERS   256
#define NUMBER_COUNTERS_PER_ROW   8

Functions

void Do_Tests (void)
void Do_Low_Level_Tests (void)
void Do_High_Level_Tests (void)
void Do_Multiplex_Tests (void)
void Run_Cycle (const int pNumEvents)
void Zero_Local_Counters (long long *pCounters)
void FPUArith (void)
void List_PAPI_Events (const int pEventSet, int *pEvents, int *xNumEvents)
void Print_Native_Counters ()
void Print_Native_Counters_via_Buffer (const BGP_UPC_Read_Counters_Struct_t *pBuffer)
void Print_Native_Counters_for_PAPI_Counters (const int pEventSet)
void Print_Native_Counters_for_PAPI_Counters_From_List (const int *pEvents, const int pNumEvents)
void Print_PAPI_Counters (const int pEventSet, const long long *pCounters)
void Print_PAPI_Counters_From_List (const int *pEventList, const int pNumEvents, const long long *pCounters)
void Print_Counters (const int pEventSet)
void Print_Node_Info (void)
void Read_Native_Counters (const int pLength)
void Print_PAPI_Events (const int pEventSet)
void Print_Counter_Values (const long long *pCounters, const int pNumCounters)
void DumpInHex (const char *pBuffer, int pSize)
int main (int argc, char *argv[])

Variables

int PAPI_Events [MAX_COUNTERS]
long long PAPI_Counters [MAX_COUNTERS]
char Native_Buffer [BGP_UPC_MAXIMUM_LENGTH_READ_COUNTERS_STRUCTURE]
double x[32] ALIGN_L3_CACHE
const int NumEventsPerSet = MAX_COUNTERS
const int MaxPresetEventId = 104
const int MaxNativeEventId = 511

Define Documentation

#define MAX_COUNTERS   256

Definition at line 65 of file papi_1.c.

#define NUMBER_COUNTERS_PER_ROW   8

Definition at line 66 of file papi_1.c.


Function Documentation

void Do_High_Level_Tests ( void   ) 

Definition at line 1118 of file papi_1.c.

01118                                {
01119   uint xEventId, xEventCode;
01120   int xRC, xNumEvents;
01121 
01122   printf("==>  Do_High_Level_Tests():  Beginning of the main body...\n");
01123 
01124   xRC = PAPI_num_counters();
01125   if (xRC == 256)
01126     printf("SUCCESS:  PAPI_num_counters returned 256 hardware counters...\n");
01127   else
01128     printf("FAILURE:  PAPI_num_counters failed, returned xRC=%d...\n", xRC);
01129 
01130   xRC = PAPI_num_components();
01131   if (xRC == 1)
01132     printf("SUCCESS:  PAPI_num_components returned 256 hardware counters...\n");
01133   else
01134     printf("FAILURE:  PAPI_num_components failed, returned xRC=%d...\n", xRC);
01135 
01136   xEventId = 0;
01137   while (xEventId < MaxPresetEventId) {
01138     xNumEvents = 0;
01139     while (xEventId <= MaxPresetEventId && xNumEvents < NumEventsPerSet) {
01140       xEventCode = xEventId | 0x80000000;
01141       xRC = PAPI_query_event(xEventCode);
01142       if (xRC == PAPI_OK) {
01143         switch(xEventCode) {
01144           case 0x80000003:
01145           case 0x80000004:
01146           case 0x80000005:
01147           case 0x80000007:
01148           case 0x80000008:
01149           case 0x8000000A:
01150           case 0x8000000B:
01151           case 0x8000000C:
01152           case 0x8000000D:
01153           case 0x8000000F:
01154           case 0x80000010:
01155           case 0x80000011:
01156           case 0x80000012:
01157           case 0x80000013:
01158           case 0x80000014:
01159           case 0x80000015:
01160           case 0x80000016:
01161           case 0x80000017:
01162           case 0x80000018:
01163           case 0x80000019:
01164           case 0x8000001A:
01165           case 0x8000001B:
01166           case 0x8000001D:
01167           case 0x8000001E:
01168           case 0x8000001F:
01169           case 0x80000020:
01170           case 0x80000021:
01171           case 0x80000022:
01172           case 0x80000023:
01173           case 0x80000024:
01174           case 0x80000025:
01175           case 0x80000026:
01176           case 0x80000027:
01177           case 0x80000028:
01178           case 0x80000029:
01179           case 0x8000002A:
01180           case 0x8000002B:
01181           case 0x8000002C:
01182           case 0x8000002D:
01183           case 0x8000002E:
01184           case 0x8000002F:
01185           case 0x80000031:
01186           case 0x80000032:
01187           case 0x80000033:
01188           case 0x80000037:
01189           case 0x80000038:
01190           case 0x80000039:
01191           case 0x8000003A:
01192           case 0x8000003D:
01193           case 0x80000042:
01194           case 0x80000045:
01195           case 0x80000046:
01196           case 0x80000048:
01197           case 0x8000004A:
01198           case 0x8000004B:
01199           case 0x8000004D:
01200           case 0x8000004E:
01201           case 0x80000050:
01202           case 0x80000051:
01203           case 0x80000053:
01204           case 0x80000054:
01205           case 0x80000056:
01206           case 0x80000057:
01207           case 0x80000059:
01208           case 0x8000005c:
01209           case 0x8000005f:
01210           case 0x80000061:
01211           case 0x80000062:
01212           case 0x80000063:
01213           case 0x80000064:
01214           case 0x80000065:
01215             printf("FAILURE:  Do_High_Level_Tests, preset event code %#8.8x added to list of events to be started, but should not be allowed...\n", xEventCode);
01216             break;
01217           default:
01218             printf("SUCCESS:  Do_High_Level_Tests, preset event code %#8.8x added to list of events to be started...\n", xEventCode);
01219         }
01220         PAPI_Events[xNumEvents] = xEventCode;
01221         xNumEvents++;
01222       }
01223       else {
01224         switch(xEventCode) {
01225           case 0x80000003:
01226           case 0x80000004:
01227           case 0x80000005:
01228           case 0x80000007:
01229           case 0x80000008:
01230           case 0x8000000A:
01231           case 0x8000000B:
01232           case 0x8000000C:
01233           case 0x8000000D:
01234           case 0x8000000F:
01235           case 0x80000010:
01236           case 0x80000011:
01237           case 0x80000012:
01238           case 0x80000013:
01239           case 0x80000014:
01240           case 0x80000015:
01241           case 0x80000016:
01242           case 0x80000017:
01243           case 0x80000018:
01244           case 0x80000019:
01245           case 0x8000001A:
01246           case 0x8000001B:
01247           case 0x8000001D:
01248           case 0x8000001E:
01249           case 0x8000001F:
01250           case 0x80000020:
01251           case 0x80000021:
01252           case 0x80000022:
01253           case 0x80000023:
01254           case 0x80000024:
01255           case 0x80000025:
01256           case 0x80000026:
01257           case 0x80000027:
01258           case 0x80000028:
01259           case 0x80000029:
01260           case 0x8000002A:
01261           case 0x8000002B:
01262           case 0x8000002C:
01263           case 0x8000002D:
01264           case 0x8000002E:
01265           case 0x8000002F:
01266           case 0x80000031:
01267           case 0x80000032:
01268           case 0x80000033:
01269           case 0x80000037:
01270           case 0x80000038:
01271           case 0x80000039:
01272           case 0x8000003A:
01273           case 0x8000003D:
01274           case 0x80000042:
01275           case 0x80000045:
01276           case 0x80000046:
01277           case 0x80000048:
01278           case 0x8000004A:
01279           case 0x8000004B:
01280           case 0x8000004D:
01281           case 0x8000004E:
01282           case 0x80000050:
01283           case 0x80000051:
01284           case 0x80000053:
01285           case 0x80000054:
01286           case 0x80000056:
01287           case 0x80000057:
01288           case 0x80000059:
01289           case 0x8000005c:
01290           case 0x8000005f:
01291           case 0x80000061:
01292           case 0x80000062:
01293           case 0x80000063:
01294           case 0x80000064:
01295           case 0x80000065:
01296             printf("SUCCESS:  Do_High_Level_Tests, preset event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
01297             break;
01298           default:
01299             printf("FAILURE:  Do_High_Level_Tests, preset event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
01300         }
01301       }
01302       xEventId++;
01303     }
01304     if (xNumEvents)
01305       Run_Cycle(xNumEvents);
01306   }
01307 
01308   xEventId = 0;
01309   while (xEventId < MaxNativeEventId) {
01310     xNumEvents = 0;
01311     while (xEventId <= MaxNativeEventId && xNumEvents < NumEventsPerSet) {
01312       xEventCode = xEventId | 0x40000000;
01313       xRC = PAPI_query_event(xEventCode);
01314       if (xRC == PAPI_OK) {
01315         switch(xEventCode) {
01316           case 0x4000005C:
01317           case 0x4000005D:
01318           case 0x4000005E:
01319           case 0x4000005F:
01320           case 0x40000060:
01321           case 0x40000061:
01322           case 0x40000062:
01323           case 0x40000063:
01324           case 0x40000064:
01325           case 0x4000007C:
01326           case 0x4000007D:
01327           case 0x4000007E:
01328           case 0x4000007F:
01329           case 0x40000080:
01330           case 0x40000081:
01331           case 0x40000082:
01332           case 0x40000083:
01333           case 0x40000084:
01334           case 0x400000D8:
01335           case 0x400000D9:
01336           case 0x400000DA:
01337           case 0x400000DB:
01338           case 0x400000DC:
01339           case 0x400000DD:
01340           case 0x400000FD:
01341           case 0x400000FE:
01342           case 0x40000198:
01343           case 0x40000199:
01344           case 0x4000019A:
01345           case 0x4000019B:
01346           case 0x4000019C:
01347           case 0x4000019D:
01348           case 0x4000019E:
01349           case 0x4000019F:
01350           case 0x400001A0:
01351           case 0x400001B8:
01352           case 0x400001B9:
01353           case 0x400001BA:
01354           case 0x400001BB:
01355           case 0x400001BC:
01356           case 0x400001BD:
01357           case 0x400001BE:
01358           case 0x400001BF:
01359           case 0x400001C0:
01360           case 0x400001D2:
01361           case 0x400001D3:
01362           case 0x400001D4:
01363           case 0x400001D5:
01364           case 0x400001D6:
01365           case 0x400001D7:
01366           case 0x400001E6:
01367           case 0x400001E7:
01368           case 0x400001E8:
01369           case 0x400001E9:
01370           case 0x400001EA:
01371           case 0x400001EB:
01372           case 0x400001FE:
01373             printf("FAILURE:  Do_High_Level_Tests, native event code %#8.8x added to list of events to be started, but should not be allowed...\n", xEventCode);
01374             break;
01375           default:
01376             printf("SUCCESS:  Do_High_Level_Tests, native event code %#8.8x added to list of events to be started...\n", xEventCode);
01377         }
01378         PAPI_Events[xNumEvents] = xEventCode;
01379         xNumEvents++;
01380       }
01381       else {
01382         switch(xEventCode) {
01383           case 0x4000005C:
01384           case 0x4000005D:
01385           case 0x4000005E:
01386           case 0x4000005F:
01387           case 0x40000060:
01388           case 0x40000061:
01389           case 0x40000062:
01390           case 0x40000063:
01391           case 0x40000064:
01392           case 0x4000007C:
01393           case 0x4000007D:
01394           case 0x4000007E:
01395           case 0x4000007F:
01396           case 0x40000080:
01397           case 0x40000081:
01398           case 0x40000082:
01399           case 0x40000083:
01400           case 0x40000084:
01401           case 0x400000D8:
01402           case 0x400000D9:
01403           case 0x400000DA:
01404           case 0x400000DB:
01405           case 0x400000DC:
01406           case 0x400000DD:
01407           case 0x400000FD:
01408           case 0x400000FE:
01409           case 0x40000198:
01410           case 0x40000199:
01411           case 0x4000019A:
01412           case 0x4000019B:
01413           case 0x4000019C:
01414           case 0x4000019D:
01415           case 0x4000019E:
01416           case 0x4000019F:
01417           case 0x400001A0:
01418           case 0x400001B8:
01419           case 0x400001B9:
01420           case 0x400001BA:
01421           case 0x400001BB:
01422           case 0x400001BC:
01423           case 0x400001BD:
01424           case 0x400001BE:
01425           case 0x400001BF:
01426           case 0x400001C0:
01427           case 0x400001D2:
01428           case 0x400001D3:
01429           case 0x400001D4:
01430           case 0x400001D5:
01431           case 0x400001D6:
01432           case 0x400001D7:
01433           case 0x400001E6:
01434           case 0x400001E7:
01435           case 0x400001E8:
01436           case 0x400001E9:
01437           case 0x400001EA:
01438           case 0x400001EB:
01439           case 0x400001FE:
01440             printf("SUCCESS:  Do_High_Level_Tests, native event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
01441             break;
01442           default:
01443             printf("FAILURE:  Do_High_Level_Tests, native event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
01444         }
01445       }
01446       xEventId++;
01447     }
01448     if (xNumEvents)
01449       Run_Cycle(xNumEvents);
01450   }
01451 
01452   float xRtime, xPtime, xMflips, xMflops, xIpc;
01453   long long xFlpins, xFlpops, xIns;
01454   long long values[3] = {PAPI_FP_INS, PAPI_FP_OPS, PAPI_TOT_CYC};
01455 
01456   xRC = PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
01457 
01458   if (xRC == PAPI_OK)
01459     printf("SUCCESS:  PAPI_flips started.\n");
01460   else
01461     printf("FAILURE:  PAPI_flips failed, returned xRC=%d...\n", xRC);
01462 
01463   FPUArith();
01464 
01465   xRC = PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
01466   if (xRC == PAPI_OK)
01467     printf("SUCCESS:  PAPI_flips Rtime=%e Ptime=%e, Flpins=%lld, Mflips=%e\n", xRtime, xPtime, xFlpins, xMflips);
01468   else
01469     printf("FAILURE:  PAPI_flips failed, returned xRC=%d...\n", xRC);
01470 
01471   FPUArith();
01472   FPUArith();
01473 
01474   xRC = PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
01475   if (xRC == PAPI_OK)
01476     printf("SUCCESS:  PAPI_flips Rtime=%e Ptime=%e, Flpins=%lld, Mflips=%e\n", xRtime, xPtime, xFlpins, xMflips);
01477   else
01478     printf("FAILURE:  PAPI_flips failed, returned xRC=%d...\n", xRC);
01479 
01480   xRC = PAPI_stop_counters(values, 3);
01481   if (xRC ==  PAPI_OK)
01482     printf("SUCCESS:  PAPI_stop_counters stopped counters.\n");
01483   else
01484     printf("FAILURE:  PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
01485 
01486 
01487   xRC = PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
01488   if (xRC == PAPI_OK)
01489     printf("SUCCESS:  PAPI_flops started.\n");
01490   else
01491     printf("FAILURE:  PAPI_flops failed, returned xRC=%d...\n", xRC);
01492 
01493   FPUArith();
01494  
01495   xRC = PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
01496   if (xRC == PAPI_OK)
01497     printf("SUCCESS:  PAPI_flops Rtime=%e Ptime=%e Flpops=%lld Mflops=%e\n", xRtime, xPtime, xFlpops, xMflops);
01498   else
01499     printf("FAILURE:  PAPI_flops failed, returned xRC=%d...\n", xRC);
01500 
01501   FPUArith();
01502   FPUArith();
01503 
01504   xRC = PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
01505   if (xRC == PAPI_OK)
01506     printf("SUCCESS:  PAPI_flops Rtime=%e Ptime=%e Flpops=%lld Mflops=%e\n", xRtime, xPtime, xFlpops, xMflops);
01507   else
01508     printf("FAILURE:  PAPI_flops failed, returned xRC=%d...\n", xRC);
01509 
01510   xRC = PAPI_stop_counters(values, 3);
01511   if (xRC ==  PAPI_OK)
01512     printf("SUCCESS:  PAPI_stop_counters stopped counters.\n");
01513   else
01514     printf("FAILURE:  PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
01515 
01516   xRC = PAPI_ipc(&xRtime, &xPtime, &xIns, &xIpc);
01517   if (xRC == PAPI_ENOEVNT)
01518     printf("SUCCESS:  PAPI_ipc, no event found...\n");
01519   else
01520     printf("FAILURE:  PAPI_ipc failed, returned xRC=%d...\n", xRC);
01521 
01522   printf("==>  Do_High_Level_Tests():  End of the main body...\n");
01523 
01524   return;
01525 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Do_Low_Level_Tests ( void   ) 

Definition at line 265 of file papi_1.c.

00265                               {
00266   int xRC, xEventSet, xEventCode, xState;
00267   long long xLLValue;
00268   char xName[256];
00269 
00270   printf("==>  Do_Low_Level_Tests():  Beginning of the main body...\n");
00271 
00272   /*
00273    * Low-level API tests...
00274    */
00275 
00276   xRC = PAPI_is_initialized();
00277   if (xRC == 1)
00278     printf("SUCCESS:  PAPI has been low-level initialized by main()...\n");
00279   else {
00280     printf("FAILURE:  PAPI has not been properly initialized by main(), xRC=%d, ending...\n", xRC);
00281     return;
00282   }
00283 
00284   /*
00285    * Print out the node information with respect to UPC units...
00286    */
00287   Print_Node_Info();
00288 
00289   /*
00290    * Zero the buffers for counters...
00291    */
00292   Zero_Local_Counters(PAPI_Counters);
00293   BGP_UPC_Read_Counters_Struct_t* xTemp;
00294   xTemp = (BGP_UPC_Read_Counters_Struct_t*)(void*)Native_Buffer;
00295   Zero_Local_Counters(xTemp->counter);
00296 
00297   /*
00298    * Start of real tests...
00299    */
00300   xLLValue = -1;
00301   xLLValue = PAPI_get_real_cyc();
00302   printf("PAPI_get_real_cyc:  xLLValue=%lld...\n", xLLValue);
00303 
00304   xLLValue = -1;
00305   xLLValue = PAPI_get_virt_cyc();
00306   printf("PAPI_get_virt_cyc:  xLLValue=%lld...\n", xLLValue);
00307 
00308   xLLValue = -1;
00309   xLLValue = PAPI_get_real_usec();
00310   printf("PAPI_get_real_usec:  xLLValue=%lld...\n", xLLValue);
00311 
00312   xLLValue = -1;
00313   xLLValue = PAPI_get_virt_usec();
00314   printf("PAPI_get_virt_usec:  xLLValue=%lld...\n", xLLValue);
00315 
00316   xRC = PAPI_num_hwctrs();
00317   if (xRC == 256)
00318     printf("SUCCESS:  PAPI_num_hwctrs returned 256 hardware counters...\n");
00319   else
00320     printf("FAILURE:  PAPI_num_hwctrs failed, returned xRC=%d...\n", xRC);
00321 
00322   *xName = 0;
00323   char* xEventName_1 = "PAPI_L3_LDM";
00324   xRC = PAPI_event_code_to_name(PAPI_L3_LDM, xName);
00325   if (xRC == PAPI_OK) {
00326     xRC = strcmp(xName,xEventName_1);
00327     if (!xRC)
00328       printf("SUCCESS:  PAPI_event_code_to_name for PAPI_L3_LDM...\n");
00329     else
00330       printf("FAILURE:  PAPI_event_code_to_name returned incorrect name, xName=%s\n", xName);
00331   }
00332   else
00333     printf("FAILURE:  PAPI_event_code_to_name failed, xRC=%d...\n", xRC);
00334 
00335   *xName = 0;
00336   char* xEventName_2 = "PNE_BGP_PU1_IPIPE_INSTRUCTIONS";
00337   xRC = PAPI_event_code_to_name(PNE_BGP_PU1_IPIPE_INSTRUCTIONS, xName);
00338   if (xRC == PAPI_OK) {
00339     xRC = strcmp(xName,xEventName_2);
00340     if (!xRC)
00341       printf("SUCCESS:  PAPI_event_code_to_name for PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
00342     else
00343       printf("FAILURE:  PAPI_event_code_to_name returned incorrect name, xName=%s\n", xName);
00344     }
00345   else
00346     printf("FAILURE:  PAPI_event_code_to_name failed, xRC=%d...\n", xRC);
00347 
00348   strcpy(xName,"PAPI_L3_LDM");
00349   xRC = PAPI_event_name_to_code(xName, &xEventCode);
00350   if (xRC == PAPI_OK)
00351     if (xEventCode == 0x8000000E)
00352       printf("SUCCESS:  PAPI_event_name_to_code for PAPI_L3_LDM...\n");
00353     else
00354       printf("FAILURE:  PAPI_event_name_to_code returned incorrect code, xEventCode=%d\n", xEventCode);
00355   else
00356     printf("FAILURE:  PAPI_event_name_to_code failed, xRC=%d...\n", xRC);
00357 
00358   strcpy(xName,"PNE_BGP_PU1_IPIPE_INSTRUCTIONS");
00359   xRC = PAPI_event_name_to_code(xName, &xEventCode);
00360   if (xRC == PAPI_OK)
00361     if (xEventCode == 0x40000027)
00362       printf("SUCCESS:  PAPI_event_name_to_code for PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
00363     else
00364       printf("FAILURE:  PAPI_event_name_to_code returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00365   else
00366     printf("FAILURE:  PAPI_event_name_to_code failed, xRC=%d...\n", xRC);
00367 
00368   xEventCode = 0x80000000;
00369   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00370   if (xRC == PAPI_OK)
00371     if (xEventCode == 0x80000001)
00372       printf("SUCCESS:  PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL, returned 0x80000001...\n");
00373     else
00374       printf("FAILURE:  PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00375   else
00376     printf("FAILURE:  PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00377 
00378   xEventCode = 0x80000002;
00379   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00380   if (xRC == PAPI_OK)
00381     if (xEventCode == 0x80000003)
00382       printf("SUCCESS:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL, returned 0x80000003...\n");
00383     else
00384       printf("FAILURE:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00385   else
00386     printf("FAILURE:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00387 
00388   xEventCode = 0x80000067;
00389   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00390   if (xRC == PAPI_OK)
00391     if (xEventCode == 0x80000068)
00392       printf("SUCCESS:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL, returned 0x80000068...\n");
00393     else
00394       printf("FAILURE:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00395   else
00396     printf("FAILURE:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00397 
00398   xEventCode = 0x80000068;
00399   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00400   if (xRC == PAPI_ENOEVNT)
00401     printf("SUCCESS:  PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_ALL, no next event...\n");
00402   else
00403     printf("FAILURE:  PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00404 
00405   xEventCode = 0x40000000;
00406   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00407   if (xRC == PAPI_OK)
00408     if (xEventCode == 0x40000001)
00409       printf("SUCCESS:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL, returned 0x40000001...\n");
00410     else
00411       printf("FAILURE:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00412   else
00413     printf("FAILURE:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00414 
00415   xEventCode = 0x40000001;
00416   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00417   if (xRC == PAPI_OK)
00418     if (xEventCode == 0x40000002)
00419       printf("SUCCESS:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL, returned 0x40000002...\n");
00420     else
00421       printf("FAILURE:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00422   else
00423     printf("FAILURE:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00424 
00425   xEventCode = 0x400000FC;
00426   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00427   if (xRC == PAPI_OK)
00428     if (xEventCode == 0x400000FF)
00429       printf("SUCCESS:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL, returned 0x400000FF...\n");
00430     else
00431       printf("FAILURE:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00432   else
00433     printf("FAILURE:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00434 
00435   xEventCode = 0x400001FD;
00436   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00437   if (xRC == PAPI_OK)
00438     if (xEventCode == 0x400001FF)
00439       printf("SUCCESS:  PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL, returned 0x400001FF...\n");
00440     else
00441       printf("FAILURE:  PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00442   else
00443     printf("FAILURE:  PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL failed, xRC=%d...\n", xRC);
00444 
00445   xEventCode = 0x400001FF;
00446   xRC = PAPI_enum_event(&xEventCode, PAPI_ENUM_ALL);
00447   if (xRC == PAPI_ENOEVNT)
00448     printf("SUCCESS:  PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_ALL, no next event...\n");
00449   else
00450     printf("FAILURE:  PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
00451 
00452   xEventCode = 0x80000000;
00453   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00454   if (xRC == PAPI_OK)
00455     if (xEventCode == 0x80000001)
00456       printf("SUCCESS:  PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_AVAIL, returned 0x80000001...\n");
00457     else
00458       printf("FAILURE:  PAPI_enum_event for 0x80000000PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00459   else
00460     printf("FAILURE:  PAPI_enum_event for 0x80000000PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00461 
00462   xEventCode = 0x80000002;
00463   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00464   if (xRC == PAPI_OK)
00465     if (xEventCode == 0x80000006)
00466       printf("SUCCESS:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL, returned 0x80000006...\n");
00467     else
00468       printf("FAILURE:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00469   else
00470     printf("FAILURE:  PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00471 
00472   xEventCode = 0x80000067;
00473   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00474   if (xRC == PAPI_OK)
00475     if (xEventCode == 0x80000068)
00476       printf("SUCCESS:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL, returned 0x80000068...\n");
00477     else
00478       printf("FAILURE:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00479   else
00480     printf("FAILURE:  PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00481 
00482   xEventCode = 0x80000068;
00483   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00484   if (xRC == PAPI_ENOEVNT)
00485     printf("SUCCESS:  PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_AVAIL, no next event...\n");
00486   else
00487     printf("FAILURE:  PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00488 
00489   xEventCode = 0x40000000;
00490   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00491   if (xRC == PAPI_OK)
00492     if (xEventCode == 0x40000001)
00493       printf("SUCCESS:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL, returned 0x40000001...\n");
00494     else
00495       printf("FAILURE:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00496   else
00497     printf("FAILURE:  PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00498 
00499   xEventCode = 0x40000001;
00500   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00501   if (xRC == PAPI_OK)
00502     if (xEventCode == 0x40000002)
00503       printf("SUCCESS:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL, returned 0x40000002...\n");
00504     else
00505       printf("FAILURE:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00506   else
00507     printf("FAILURE:  PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00508 
00509   printf("NOTE:  Might get two messages indicating invalid event id specified for 253 and 254.  These are OK...\n");
00510   xEventCode = 0x400000FC;
00511   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00512   if (xRC == PAPI_OK)
00513     if (xEventCode == 0x400000FF)
00514       printf("SUCCESS:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL, returned 0x400000FF...\n");
00515     else
00516       printf("FAILURE:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00517   else
00518     printf("FAILURE:  PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00519 
00520   printf("NOTE:  Might get one message indicating invalid event id specified for 510.  This is OK...\n");
00521   xEventCode = 0x400001FD;
00522   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00523   if (xRC == PAPI_OK)
00524     if (xEventCode == 0x400001FF)
00525       printf("SUCCESS:  PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL, returned 0x400001FF...\n");
00526     else
00527       printf("FAILURE:  PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
00528   else
00529     printf("FAILURE:  PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00530 
00531   xEventCode = 0x400001FF;
00532   xRC = PAPI_enum_event(&xEventCode, PAPI_PRESET_ENUM_AVAIL);
00533   if (xRC == PAPI_ENOEVNT)
00534     printf("SUCCESS:  PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_AVAIL, no next event...\n");
00535   else
00536     printf("FAILURE:  PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
00537 
00538   PAPI_dmem_info_t xDmemSpace;
00539   xRC = PAPI_get_dmem_info(&xDmemSpace);
00540   if (xRC == PAPI_OK) {
00541     DumpInHex((char*)&xDmemSpace, sizeof( PAPI_dmem_info_t));
00542     printf("SUCCESS:  PAPI_get_dmem_info...\n");
00543   }
00544   else
00545     printf("FAILURE:  PAPI_get_dmem_info failed, xRC=%d...\n", xRC);
00546 
00547   PAPI_event_info_t xInfoSpace;
00548   xRC = PAPI_get_event_info(PAPI_L3_LDM, &xInfoSpace);
00549   if (xRC == PAPI_OK) {
00550     DumpInHex((char*)&xInfoSpace, sizeof( PAPI_event_info_t));
00551     printf("SUCCESS:  PAPI_get_event_info for PAPI_L3_LDM...\n");
00552   }
00553   else
00554     printf("FAILURE:  PAPI_get_event_info failed for PAPI_L3_LDM, xRC=%d...\n", xRC);
00555 
00556   const PAPI_exe_info_t* xExeInfo = NULL;
00557   if ((xExeInfo = PAPI_get_executable_info()) != NULL) {
00558     DumpInHex((char*)xExeInfo, sizeof( PAPI_exe_info_t));
00559     printf("SUCCESS:  PAPI_get_executable_info...\n");
00560   }
00561   else
00562     printf("FAILURE:  PAPI_get_executable_info failed, returned null pointer...\n");
00563 
00564   const PAPI_hw_info_t* xHwInfo = NULL;
00565   if ((xHwInfo = PAPI_get_hardware_info()) != NULL) {
00566     DumpInHex((char*)xHwInfo, sizeof( PAPI_hw_info_t));
00567     printf("SUCCESS:  PAPI_get_hardware_info...\n");
00568   }
00569   else
00570     printf("FAILURE:  PAPI_get_hardware_info failed, returned null pointer...\n");
00571 
00572   const PAPI_shlib_info_t* xShLibInfo = NULL;
00573   if ((xShLibInfo = PAPI_get_shared_lib_info()) != NULL) {
00574     DumpInHex((char*)xShLibInfo, sizeof( PAPI_shlib_info_t));
00575     printf("SUCCESS:  PAPI_get_shared_lib_info...\n");
00576   }
00577   else
00578     printf("FAILURE:  PAPI_get_shared_lib_info failed, returned null pointer...\n");
00579 
00580   xEventSet = PAPI_NULL;
00581   xRC = PAPI_create_eventset(&xEventSet);
00582   if (xRC == PAPI_OK)
00583     printf("SUCCESS:  PAPI_create_eventset created...\n");
00584   else {
00585     printf("FAILURE:  PAPI_create_eventset failed, xRC=%d...\n", xRC);
00586     return;
00587   }
00588 
00589   printf("==>  No events should be in the event set...\n");
00590   Print_Counters(xEventSet);
00591 
00592   xRC = PAPI_num_events(xEventSet);
00593   if (xRC == 0)
00594     printf("SUCCESS:  PAPI_num_events returned 0...\n");
00595   else
00596     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00597 
00598   xRC = PAPI_add_event(xEventSet, PAPI_L1_DCM);
00599   if (xRC == PAPI_OK)
00600     printf("SUCCESS:  PAPI_add_event PAPI_L1_DCM...\n");
00601   else
00602     printf("FAILURE:  PAPI_add_event PAPI_L1_DCM failed, xRC=%d...\n", xRC);
00603 
00604   xRC = PAPI_num_events(xEventSet);
00605   if (xRC == 1)
00606     printf("SUCCESS:  PAPI_num_events returned 1...\n");
00607   else
00608     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00609 
00610   xRC = PAPI_add_event(xEventSet, PNE_BGP_PU3_L2_MEMORY_WRITES);
00611   if (xRC == PAPI_OK)
00612     printf("SUCCESS:  PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES...\n");
00613   else
00614     printf("FAILURE:  PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES failed, xRC=%d...\n", xRC);
00615 
00616   xRC = PAPI_num_events(xEventSet);
00617   if (xRC == 2)
00618     printf("SUCCESS:  PAPI_num_events returned 2...\n");
00619   else
00620     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00621 
00622   xRC = PAPI_add_event(xEventSet, BGP_PU3_L2_MEMORY_WRITES);
00623   if (xRC == PAPI_EINVAL)
00624     printf("SUCCESS:  PAPI_add_event BGP_PU3_L2_MEMORY_WRITES not allowed...\n");
00625   else
00626     printf("FAILURE:  PAPI_add_event BGP_PU3_L2_MEMORY_WRITES allowed, or failed incorrectly..., xRC=%d...\n", xRC);
00627 
00628   xRC = PAPI_num_events(xEventSet);
00629   if (xRC == 2)
00630     printf("SUCCESS:  PAPI_num_events returned 2...\n");
00631   else
00632     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00633 
00634   xRC = PAPI_add_event(xEventSet, 0x40000208);
00635   if (xRC == PAPI_ENOEVNT)
00636     printf("SUCCESS:  PAPI_add_event 0x40000208 not allowed...\n");
00637   else
00638     printf("FAILURE:  PAPI_add_event 0x40000208 allowed, or failed incorrectly..., xRC=%d...\n", xRC);
00639 
00640   xRC = PAPI_num_events(xEventSet);
00641   if (xRC == 2)
00642     printf("SUCCESS:  PAPI_num_events returned 2...\n");
00643   else
00644     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00645 
00646   xRC = PAPI_add_event(xEventSet, PAPI_L1_ICM);
00647   if (xRC == PAPI_OK)
00648     printf("SUCCESS:  PAPI_add_event PAPI_L1_ICM...\n");
00649   else
00650     printf("FAILURE:  PAPI_add_event PAPI_L1_ICM failed, xRC=%d...\n", xRC);
00651 
00652   xRC = PAPI_num_events(xEventSet);
00653   if (xRC == 3)
00654     printf("SUCCESS:  PAPI_num_events returned 3...\n");
00655   else
00656     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00657 
00658   xRC = PAPI_add_event(xEventSet, PAPI_L1_TCM);
00659   if (xRC == PAPI_OK)
00660     printf("SUCCESS:  PAPI_add_event PAPI_L1_TCM...\n");
00661   else
00662     printf("FAILURE:  PAPI_add_event PAPI_L1_TCM failed, xRC=%d...\n", xRC);
00663 
00664   xRC = PAPI_num_events(xEventSet);
00665   if (xRC == 4)
00666     printf("SUCCESS:  PAPI_num_events returned 4...\n");
00667   else
00668     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
00669 
00670   xRC = PAPI_add_event(xEventSet, PAPI_L1_DCM);
00671   if (xRC == PAPI_ECNFLCT)
00672     printf("SUCCESS:  PAPI_add_event, redundantly adding PAPI_L1_DCM not allowed...\n");
00673   else
00674     printf("FAILURE:  PAPI_add_event PAPI_L1_DCM failed incorrectly, xRC=%d...\n", xRC);
00675 
00676   xRC = PAPI_add_event(xEventSet, PNE_BGP_PU3_L2_MEMORY_WRITES);
00677   if (xRC == PAPI_ECNFLCT)
00678     printf("SUCCESS:  PAPI_add_event, redundantly adding PNE_BGP_PU3_L2_MEMORY_WRITES not allowed...\n");
00679   else
00680     printf("FAILURE:  PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES failed incorectly, xRC=%d...\n", xRC);
00681 
00682   printf("\n==>  All events added... Perform a read now...\n");
00683   xRC = PAPI_read(xEventSet, PAPI_Counters);
00684   if (xRC == PAPI_OK)
00685     printf("SUCCESS:  PAPI_read...\n");
00686   else
00687     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00688 
00689   printf("\n==>  Perform a reset now...\n");
00690   xRC = PAPI_reset(xEventSet);
00691   if (xRC == PAPI_OK)
00692     printf("SUCCESS:  PAPI_reset...\n");
00693   else
00694     printf("FAILURE:  PAPI_reset failed, xRC=%d...\n", xRC);
00695 
00696   printf("\n==>  Perform another read now...\n");
00697   xRC = PAPI_read(xEventSet, PAPI_Counters);
00698   if (xRC == PAPI_OK)
00699     printf("SUCCESS:  PAPI_read...\n");
00700   else
00701     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00702 
00703   printf("\n==>  Should be 4 counters below, preset, native, preset, and preset.  All counter values should be zero.\n");
00704   Print_Counters(xEventSet);
00705 
00706   printf("\n==>  Stop the UPC now...\n");
00707   xRC = PAPI_stop(xEventSet, PAPI_Counters);
00708   if (xRC == PAPI_ENOTRUN)
00709     printf("SUCCESS:  PAPI_stop, but not running...\n");
00710   else
00711     printf("FAILURE:  PAPI_stop failed incorectly, xRC=%d...\n", xRC);
00712 
00713   printf("\n==>  Start the UPC now...\n");
00714   xRC = PAPI_start(xEventSet);
00715   if (xRC == PAPI_OK)
00716     printf("SUCCESS:  PAPI_start...\n");
00717   else {
00718     printf("FAILURE:  PAPI_start failed, xRC=%d...\n", xRC);
00719     return;
00720   }
00721 
00722   printf("\n==>  Try to start it again...\n");
00723   xRC = PAPI_start(xEventSet);
00724   if (xRC == PAPI_EISRUN)
00725     printf("SUCCESS:  PAPI_start, but already running...\n");
00726   else
00727     printf("FAILURE:  PAPI_start failed incorectly, xRC=%d...\n", xRC);
00728 
00729   FPUArith();
00730 
00731   printf("\n==>  Stop the UPC after the arithmetic was performed...  The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the UPC(s) being stopped...\n");
00732   xRC = PAPI_stop(xEventSet, PAPI_Counters);
00733   if (xRC == PAPI_OK)
00734     printf("SUCCESS:  PAPI_stop...\n");
00735   else {
00736     printf("FAILURE:  PAPI_stop failed, xRC=%d...\n", xRC);
00737     return;
00738   }
00739   Print_Counters(xEventSet);
00740 
00741   printf("\n==>  Perform a read of the counters after performing arithmetic, UPC is stopped...  Values should be the same as right after the prior PAPI_Stop()...\n");
00742   xRC = PAPI_read(xEventSet, PAPI_Counters);
00743   if (xRC == PAPI_OK)
00744     printf("SUCCESS:  PAPI_read...\n");
00745   else
00746     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00747   Print_Counters(xEventSet);
00748 
00749   printf("\n==>  Zero local counters.  Perform a PAPI_accum, UPC is stopped...  Native values should be zero, and the local PAPI counters the same as the previous read...\n");
00750   Zero_Local_Counters(PAPI_Counters);
00751   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00752   if (xRC == PAPI_OK) {
00753     printf("SUCCESS:  PAPI_accum...\n");
00754   }
00755   else {
00756     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00757     return;
00758   }
00759   Print_Counters(xEventSet);
00760 
00761   printf("\n==>  Perform a PAPI_read, UPC is stopped...  All values should be zero...\n");
00762   xRC = PAPI_read(xEventSet, PAPI_Counters);
00763   if (xRC == PAPI_OK) {
00764     printf("SUCCESS:  PAPI_read...\n");
00765   }
00766   else {
00767     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00768     return;
00769   }
00770   Print_Counters(xEventSet);
00771 
00772   printf("\n==>  Perform a reset after performing arithmetic, UPC is stopped...  All values should be zero...\n");
00773   xRC = PAPI_reset(xEventSet);
00774   if (xRC == PAPI_OK) {
00775     printf("SUCCESS:  PAPI_reset...\n");
00776   }
00777   else {
00778     printf("FAILURE:  PAPI_reset failed, xRC=%d...\n", xRC);
00779     return;
00780   }
00781   Print_Counters(xEventSet);
00782 
00783   printf("\n==>  Perform another read of the counters after resetting the counters, UPC is stopped...  All values should be zero...\n");
00784   xRC = PAPI_read(xEventSet, PAPI_Counters);
00785   if (xRC == PAPI_OK)
00786     printf("SUCCESS:  PAPI_read...\n");
00787   else
00788     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00789   Print_Counters(xEventSet);
00790 
00791   printf("\n==>  Perform another PAPI_accum after resetting the counters, UPC is stopped...  All values should be zero...\n");
00792   Zero_Local_Counters(PAPI_Counters);
00793   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00794   if (xRC == PAPI_OK) {
00795     printf("SUCCESS:  PAPI_accum...\n");
00796   }
00797   else {
00798     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00799     return;
00800   }
00801   Print_Counters(xEventSet);
00802 
00803   printf("\n==>  Perform another PAPI_read after accumulating and resetting the UPC, UPC is stopped...  All values should be zero...\n");
00804   xRC = PAPI_read(xEventSet, PAPI_Counters);
00805   if (xRC == PAPI_OK) {
00806     printf("SUCCESS:  PAPI_read...\n");
00807   }
00808   else {
00809     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00810     return;
00811   }
00812   Print_Counters(xEventSet);
00813 
00814   printf("\n==>  Start the UPC again...\n");
00815   xRC = PAPI_start(xEventSet);
00816   if (xRC == PAPI_OK)
00817     printf("SUCCESS:  PAPI_start...\n");
00818   else {
00819     printf("FAILURE:  PAPI_start failed, xRC=%d...\n", xRC);
00820     return;
00821   }
00822 
00823   FPUArith();
00824 
00825   printf("\n==>  Get the state of the event set...\n");
00826   xRC = PAPI_state(xEventSet, &xState);
00827   if (xRC == PAPI_OK) {
00828     if (xState == PAPI_RUNNING) {
00829       printf("SUCCESS:  PAPI_state is RUNNING...\n");
00830     }
00831     else {
00832       printf("FAILURE:  PAPI_state failed, incorrect state, xState=%d...\n", xState);
00833     }
00834   }
00835   else {
00836     printf("FAILURE:  PAPI_state failed, xRC=%d...\n", xRC);
00837     return;
00838   }
00839 
00840   printf("\n==>  Perform a read of the counters, UPC is running...  The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the reads for the individual counter values...\n");
00841   xRC = PAPI_read(xEventSet, PAPI_Counters);
00842   if (xRC == PAPI_OK)
00843     printf("SUCCESS:  PAPI_read...\n");
00844   else
00845     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00846   Print_Counters(xEventSet);
00847 
00848   FPUArith();
00849 
00850   printf("\n==>  Perform another read of the counters, UPC is running...  Values should be increasing...\n");
00851   xRC = PAPI_read(xEventSet, PAPI_Counters);
00852   if (xRC == PAPI_OK)
00853     printf("SUCCESS:  PAPI_read...\n");
00854   else
00855     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00856   Print_Counters(xEventSet);
00857 
00858   FPUArith();
00859 
00860   printf("\n==>  Perform another read of the counters, UPC is running...  Values should continue increasing...\n");
00861   xRC = PAPI_read(xEventSet, PAPI_Counters);
00862   if (xRC == PAPI_OK)
00863     printf("SUCCESS:  PAPI_read...\n");
00864   else
00865     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00866   Print_Counters(xEventSet);
00867 
00868   printf("\n==>  Perform a reset after performing arithmetic, UPC is still running...  Native counter values should be less than prior read, but PAPI counter values should be identical to the prior read (local buffer was not changed)...\n");
00869   xRC = PAPI_reset(xEventSet);
00870   if (xRC == PAPI_OK) {
00871     printf("SUCCESS:  PAPI_reset...\n");
00872   }
00873   else {
00874     printf("FAILURE:  PAPI_reset failed, xRC=%d...\n", xRC);
00875     return;
00876   }
00877   Print_Counters(xEventSet);
00878 
00879   printf("\n==>  Zero local counters.  Perform a PAPI_accum, UPC is still running...\n");
00880   Zero_Local_Counters(PAPI_Counters);
00881   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00882   if (xRC == PAPI_OK) {
00883     printf("SUCCESS:  PAPI_accum...\n");
00884   }
00885   else {
00886     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00887     return;
00888   }
00889   Print_Counters(xEventSet);
00890 
00891   FPUArith();
00892 
00893   printf("\n==>  Accumulate local counters.  Perform a PAPI_accum, UPC is still running...  PAPI counters should show an increase from prior accumulate...\n");
00894   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00895   if (xRC == PAPI_OK) {
00896     printf("SUCCESS:  PAPI_accum...\n");
00897   }
00898   else {
00899     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00900     return;
00901   }
00902   Print_Counters(xEventSet);
00903 
00904   FPUArith();
00905 
00906   printf("\n==>  Accumulate local counters.  Perform another PAPI_accum, UPC is still running...  PAPI counters should show an increase from prior accumulate...\n");
00907   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00908   if (xRC == PAPI_OK) {
00909     printf("SUCCESS:  PAPI_accum...\n");
00910   }
00911   else {
00912     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00913     return;
00914   }
00915   Print_Counters(xEventSet);
00916 
00917   printf("\n==>  Zero local counters.  Perform a PAPI_accum, UPC is still running...  PAPI counters should be less than the prior accumulate...\n");
00918   Zero_Local_Counters(PAPI_Counters);
00919   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00920   if (xRC == PAPI_OK) {
00921     printf("SUCCESS:  PAPI_accum...\n");
00922   }
00923   else {
00924     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00925     return;
00926   }
00927   Print_Counters(xEventSet);
00928 
00929   printf("\n==>  Perform a PAPI_read, UPC is still running...  Native counters and PAPI counters should have both increased from prior accumulate...\n");
00930   xRC = PAPI_read(xEventSet, PAPI_Counters);
00931   if (xRC == PAPI_OK) {
00932     printf("SUCCESS:  PAPI_read...\n");
00933   }
00934   else {
00935     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00936     return;
00937   }
00938   Print_Counters(xEventSet);
00939 
00940   printf("\n==>  Perform a PAPI_write (not supported when UPC is running)...\n");
00941   xRC = PAPI_write(xEventSet, PAPI_Counters);
00942   if (xRC == PAPI_ECMP) {
00943     printf("SUCCESS:  PAPI_write, not allowed...\n");
00944   }
00945   else {
00946     printf("FAILURE:  PAPI_write failed, xRC=%d...\n", xRC);
00947     return;
00948   }
00949 
00950   printf("\n==>  Stop the UPC...  The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the UPC(s) being stopped...\n");
00951   xRC = PAPI_stop(xEventSet, PAPI_Counters);
00952   if (xRC == PAPI_OK)
00953     printf("SUCCESS:  PAPI_stop...\n");
00954   else {
00955     printf("FAILURE:  PAPI_stop failed, xRC=%d...\n", xRC);
00956     return;
00957   }
00958   Print_Counters(xEventSet);
00959 
00960   printf("\n==>  Perform a PAPI_read with the UPC stopped...\n");
00961   xRC = PAPI_read(xEventSet, PAPI_Counters);
00962   if (xRC == PAPI_OK)
00963     printf("SUCCESS:  PAPI_read...\n");
00964   else
00965     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00966 
00967   printf("\n==>  Should be same 4 counters below, with the same native and PAPI counters as after the PAPI_stop...\n");
00968   Print_Counters(xEventSet);
00969 
00970   printf("\n==>  Perform a PAPI_accum with the UPC stopped...  Native counters sould be zeroed, with the PAPI counters unchanged from prior read (with the UPC already stopped, the accumulate does not add any counter values to the local buffer)...\n");
00971   Zero_Local_Counters(PAPI_Counters);
00972   xRC = PAPI_accum(xEventSet, PAPI_Counters);
00973   if (xRC == PAPI_OK) {
00974     printf("SUCCESS:  PAPI_accum...\n");
00975   }
00976   else {
00977     printf("FAILURE:  PAPI_accum failed, xRC=%d...\n", xRC);
00978     return;
00979   }
00980   Print_Counters(xEventSet);
00981 
00982   printf("\n==>  Perform a PAPI_read with the UPC stopped...  Native and PAPI counters are zero...\n");
00983   xRC = PAPI_read(xEventSet, PAPI_Counters);
00984   if (xRC == PAPI_OK)
00985     printf("SUCCESS:  PAPI_read...\n");
00986   else
00987     printf("FAILURE:  PAPI_read failed, xRC=%d...\n", xRC);
00988   Print_Counters(xEventSet);
00989 
00990   printf("\n==>  Perform a reset, UPC is stopped...  Native and PAPI counters are zero...\n");
00991   xRC = PAPI_reset(xEventSet);
00992   if (xRC == PAPI_OK) {
00993     printf("SUCCESS:  PAPI_reset...\n");
00994   }
00995   else {
00996     printf("FAILURE:  PAPI_reset failed, xRC=%d...\n", xRC);
00997     return;
00998   }
00999   Print_Counters(xEventSet);
01000 
01001   printf("\n==>  Perform a PAPI_write, but only to local memory...\n");
01002   xRC = PAPI_write(xEventSet, PAPI_Counters);
01003   if (xRC == PAPI_OK) {
01004     printf("SUCCESS:  PAPI_write, but only to local memory...\n");
01005   }
01006   else {
01007     printf("FAILURE:  PAPI_write failed, xRC=%d...\n", xRC);
01008     return;
01009   }
01010 
01011   printf("\n==>  Get the state of the event set...\n");
01012   xRC = PAPI_state(xEventSet, &xState);
01013   if (xRC == PAPI_OK) {
01014     if (xState == PAPI_STOPPED) {
01015       printf("SUCCESS:  PAPI_state is STOPPED...\n");
01016     }
01017     else {
01018       printf("FAILURE:  PAPI_state failed, incorrect state, xState=%d...\n", xState);
01019     }
01020   }
01021   else {
01022     printf("FAILURE:  PAPI_state failed, xRC=%d...\n", xRC);
01023     return;
01024   }
01025 
01026   printf("\n==>  Get the multiplex status of the eventset...\n");
01027   xRC = PAPI_get_multiplex(xEventSet);
01028   if (xRC == PAPI_OK) {
01029     printf("SUCCESS:  PAPI_get_multiplex (NOTE:  The rest of the multiplex path is untested)...\n");
01030   }
01031   else {
01032     printf("FAILURE:  PAPI_get_multiplex failed, xRC=%d...\n", xRC);
01033     return;
01034   }
01035 
01036   printf("\n==>  Remove the events, and clean up the event set...\n");
01037   xRC = PAPI_remove_event(xEventSet, PNE_BGP_PU1_IPIPE_INSTRUCTIONS);
01038   if (xRC == PAPI_EINVAL)
01039     printf("SUCCESS:  PAPI_remove_event could not find PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
01040   else
01041     printf("FAILURE:  PAPI_remove_event PNE_BGP_PU1_IPIPE_INSTRUCTIONS failed, xRC=%d...\n", xRC);
01042 
01043   xRC = PAPI_remove_event(xEventSet, PAPI_L3_LDM);
01044   if (xRC == PAPI_EINVAL)
01045     printf("SUCCESS:  PAPI_remove_event could not find PAPI_L3_LDM...\n");
01046   else
01047     printf("FAILURE:  PAPI_remove_event PAPI_L3_LDM failed, xRC=%d...\n", xRC);
01048 
01049   xRC = PAPI_remove_event(xEventSet, PAPI_L1_TCM);
01050   if (xRC == PAPI_OK)
01051     printf("SUCCESS:  PAPI_remove_event PAPI_L1_TCM...\n");
01052   else
01053     printf("FAILURE:  PAPI_remove_event PAPI_L1_TCM failed, xRC=%d...\n", xRC);
01054 
01055   xRC = PAPI_num_events(xEventSet);
01056   if (xRC == 3)
01057     printf("SUCCESS:  PAPI_num_events returned 3...\n");
01058   else
01059     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
01060 
01061   xRC = PAPI_remove_event(xEventSet, PAPI_L1_ICM);
01062   if (xRC == PAPI_OK)
01063     printf("SUCCESS:  PAPI_remove_event PAPI_L1_ICM...\n");
01064   else
01065     printf("FAILURE:  PAPI_remove_event PAPI_L1_ICM failed, xRC=%d...\n", xRC);
01066 
01067   xRC = PAPI_num_events(xEventSet);
01068   if (xRC == 2)
01069     printf("SUCCESS:  PAPI_num_events returned 2...\n");
01070   else
01071     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
01072 
01073   xRC = PAPI_remove_event(xEventSet, PNE_BGP_PU3_L2_MEMORY_WRITES);
01074   if (xRC == PAPI_OK)
01075     printf("SUCCESS:  PAPI_remove_event PNE_BGP_PU3_L2_MEMORY_WRITES...\n");
01076   else
01077     printf("FAILURE:  PAPI_remove_event PNE_BGP_PU3_L2_MEMORY_WRITES failed, xRC=%d...\n", xRC);
01078 
01079   xRC = PAPI_num_events(xEventSet);
01080   if (xRC == 1)
01081     printf("SUCCESS:  PAPI_num_events returned 1...\n");
01082   else
01083     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
01084 
01085   xRC = PAPI_remove_event(xEventSet, PAPI_L1_DCM);
01086   if (xRC == PAPI_OK)
01087     printf("SUCCESS:  PAPI_remove_event PAPI_L1_DCM...\n");
01088   else
01089     printf("FAILURE:  PAPI_remove_event PAPI_L1_DCM failed, xRC=%d...\n", xRC);
01090 
01091   xRC = PAPI_num_events(xEventSet);
01092   if (xRC == 0)
01093     printf("SUCCESS:  PAPI_num_events returned 0...\n");
01094   else
01095     printf("FAILURE:  PAPI_num_events failed, returned xRC=%d...\n", xRC);
01096 
01097   xRC = PAPI_cleanup_eventset(xEventSet);
01098   if (xRC == PAPI_OK)
01099     printf("SUCCESS:  PAPI_cleanup_eventset...\n");
01100   else
01101     printf("FAILURE:  PAPI_cleanup_eventset failed, xRC=%d...\n", xRC);
01102 
01103   xRC = PAPI_destroy_eventset(&xEventSet);
01104   if (xRC == PAPI_OK)
01105     printf("SUCCESS:  PAPI_destroy_eventset...\n");
01106   else
01107     printf("FAILURE:  PAPI_destroy_eventset failed, xRC=%d...\n", xRC);
01108 
01109   printf("==>  Do_Low_Level_Tests():  End of the main body...\n");
01110 
01111   return;
01112 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Do_Multiplex_Tests ( void   ) 

Definition at line 1532 of file papi_1.c.

01532                               {
01533   int xRC;
01534 
01535   printf("==>  Do_Multiplex_Tests():  Beginning of the main body...\n");
01536 
01537   xRC = PAPI_multiplex_init();
01538   if (xRC == PAPI_OK)
01539     printf("SUCCESS:  PAPI_multiplex_init...\n");
01540   else
01541     printf("FAILURE:  PAPI_multiplex_init failed, returned xRC=%d...\n", xRC);
01542 
01543   printf("==>  Do_Multiplex_Tests():  End of the main body...\n");
01544 
01545   return;
01546 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Do_Tests ( void   ) 

Definition at line 244 of file papi_1.c.

00244                     {
00245   printf("==>  Do_Tests():  Beginning of the main body...\n");
00246 
00247   //  NOTE:  PAPI_library_init() has already been done for each participating node
00248   //         prior to calling this routine...
00249 
00250   Do_Low_Level_Tests();
00251   Do_High_Level_Tests();
00252   Do_Multiplex_Tests(); // NOTE:  Not supported...
00253   PAPI_shutdown();
00254 
00255   printf("==>  Do_Tests():  End of the main body...\n");
00256   fflush(stdout);
00257 
00258   return;
00259 }

Here is the call graph for this function:

Here is the caller graph for this function:

void DumpInHex ( const char *  pBuffer,
int  pSize 
)

Definition at line 2089 of file papi_1.c.

02089                                                {
02090 
02091   return;
02092 }

Here is the caller graph for this function:

void FPUArith ( void   ) 

Definition at line 1645 of file papi_1.c.

01645                     {
01646   int i;
01647 
01648   printf("\n==>  Start:  Performing arithmetic...\n");
01649   register unsigned int zero = 0;
01650   register double *x_p = &x[0];
01651 
01652   for ( i = 0; i < 32; i++ )
01653     x[i] = 1.0;
01654 
01655   // Single Hummer Instructions:
01656 
01657   #if 1
01658 
01659   asm volatile ("fabs       1,2");
01660   asm volatile ("fmr        1,2");
01661   asm volatile ("fnabs      1,2");
01662   asm volatile ("fneg       1,2");
01663 
01664   asm volatile ("fadd       1,2,3");
01665   asm volatile ("fadds      1,2,3");
01666   asm volatile ("fdiv       1,2,3");
01667   asm volatile ("fdivs      1,2,3");
01668   asm volatile ("fmul       1,2,3");
01669   asm volatile ("fmuls      1,2,3");
01670   asm volatile ("fres       1,2");
01671   asm volatile ("frsqrte    1,2");
01672   //asm volatile ("fsqrt      1,2");          // gives exception
01673   //asm volatile ("fsqrts     1,2");          // gives exception
01674   asm volatile ("fsub       1,2,3");
01675   asm volatile ("fsubs      1,2,3");
01676 
01677   asm volatile ("fmadd      3,4,5,6");
01678   asm volatile ("fmadds     3,4,5,6");
01679   asm volatile ("fmsub      3,4,5,6");
01680   asm volatile ("fmsubs     3,4,5,6");
01681   asm volatile ("fnmadd     3,4,5,6");
01682   asm volatile ("fnmadds    3,4,5,6");
01683   asm volatile ("fnmsub     3,4,5,6");
01684   asm volatile ("fnmsubs    3,4,5,6");
01685 
01686   //asm volatile ("fcfid      5,6");          // invalid instruction
01687   //asm volatile ("fctid      5,6");          // invalid instruction
01688   //asm volatile ("fctidz     5,6");          // invalid instruction
01689   asm volatile ("fctiw      5,6");
01690   asm volatile ("fctiwz     5,6");
01691   asm volatile ("frsp       5,6");
01692 
01693   asm volatile ("fcmpo   0,1,2");
01694   asm volatile ("fcmpu   0,1,2");
01695   asm volatile ("fsel    0,1,2,3");
01696 
01697   #endif
01698 
01699   #if 1
01700 
01701   asm volatile("fpadd             9,10,11");
01702   asm volatile("fpsub             9,10,11");
01703 
01704   #endif
01705 
01706 
01707   #if 1
01708 
01709   asm volatile("fpmul            23,24,25");
01710   asm volatile("fxmul            26, 27, 28");
01711   asm volatile("fxpmul           28, 29, 30");
01712   asm volatile("fxsmul            2, 3, 4");
01713   #endif
01714 
01715   #if 1
01716 
01717   asm volatile("fpmadd           10,11,12,13");
01718   asm volatile("fpmsub           18, 19, 20, 21");
01719   asm volatile("fpnmadd          26, 27, 28, 29");
01720   asm volatile("fpnmsub          16,17,18,19");
01721 
01722   asm volatile("fxmadd           10,11,12,13");
01723   asm volatile("fxmsub           18, 19, 20, 21");
01724   asm volatile("fxnmadd          26, 27, 28, 29");
01725   asm volatile("fxnmsub          16,17,18,19");
01726 
01727   asm volatile("fxcpmadd           10,11,12,13");
01728   asm volatile("fxcpmsub           18, 19, 20, 21");
01729   asm volatile("fxcpnmadd          26, 27, 28, 29");
01730   asm volatile("fxcpnmsub          16,17,18,19");
01731 
01732   asm volatile("fxcsmadd           10,11,12,13");
01733   asm volatile("fxcsmsub           18, 19, 20, 21");
01734   asm volatile("fxcsnmadd          26, 27, 28, 29");
01735   asm volatile("fxcsnmsub          16,17,18,19");
01736 
01737   asm volatile("fxcpnpma           1,2,3,4");
01738   asm volatile("fxcsnpma           5,6,7,8");
01739   asm volatile("fxcpnsma           9,10,11,12");
01740   asm volatile("fxcsnsma           3,4,5,6");
01741 
01742   asm volatile("fxcxnpma           9,10,11,12");
01743   asm volatile("fxcxnsma           8,9,10,11");
01744   asm volatile("fxcxma             3,4,5,6");
01745   asm volatile("fxcxnms            8,9,10,11");
01746 
01747   #endif
01748 
01749 
01750   #if 1
01751 
01752   asm volatile("fpre               12, 13");
01753   asm volatile("fprsqrte           15, 16");
01754   asm volatile("fpsel              17, 18, 19, 20");
01755   asm volatile("fpctiw             1,2");
01756   asm volatile("fpctiwz            3,4");
01757   asm volatile("fprsp              5,6");
01758   asm volatile("fscmp              1,2,3");
01759   asm volatile("fpmr               1,2");
01760   asm volatile("fpneg              1,2");
01761   asm volatile("fpabs              1,2");
01762   asm volatile("fpnabs             1,2");
01763   asm volatile("fsmr               1,2");
01764   asm volatile("fsneg              1,2");
01765   asm volatile("fsabs              1,2");
01766   asm volatile("fsnabs             1,2");
01767   asm volatile("fxmr               1,2");
01768   asm volatile("fsmfp              1,2");
01769   asm volatile("fsmtp              1,2");
01770 
01771   #endif
01772 
01773   #if 1
01774   asm volatile("lfdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01775   asm volatile("lfdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01776   asm volatile("lfsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01777   asm volatile("lfsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01778 
01779   asm volatile("lfsdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01780   asm volatile("lfsdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01781   asm volatile("lfssx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01782   asm volatile("lfssux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01783 
01784   asm volatile("lfpsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01785   asm volatile("lfpsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01786   asm volatile("lfxsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01787   asm volatile("lfxsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01788   #endif
01789 
01790   #if 1
01791   asm volatile("lfpdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01792   asm volatile("lfpdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01793   asm volatile("lfxdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01794   asm volatile("lfxdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01795   #endif
01796 
01797   #if 1
01798   asm volatile("stfdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01799   asm volatile("stfdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01800   asm volatile("stfsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01801   asm volatile("stfsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01802 
01803   asm volatile("stfsdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01804   asm volatile("stfsdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01805   asm volatile("stfssx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01806   //asm volatile("stfssux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01807 
01808   asm volatile("stfpsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01809   asm volatile("stfpsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01810   asm volatile("stfxsx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01811   asm volatile("stfxsux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01812   #endif
01813 
01814   #if 1
01815   asm volatile("stfpdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01816   asm volatile("stfpdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01817   asm volatile("stfxdx       16,%0,%1" : "+b"(x_p) : "b"(zero));
01818   asm volatile("stfxdux       16,%0,%1" : "+b"(x_p) : "b"(zero));
01819   #endif
01820   printf("==>  End:    Performing arithmetic...\n");
01821 
01822   return;
01823 }

Here is the caller graph for this function:

void List_PAPI_Events ( const int  pEventSet,
int *  pEvents,
int *  xNumEvents 
)

Definition at line 2075 of file papi_1.c.

02075                                                                           {
02076   int xRC = PAPI_list_events(pEventSet, pEvents, pNumEvents);
02077   if (xRC != PAPI_OK) {
02078     printf("FAILURE:  PAPI_list_events failed, returned xRC=%d...\n", xRC);
02079     exit(1);
02080   }
02081 
02082   return;
02083 }

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 105 of file papi_1.c.

00105                                   {
00106   _BGP_Personality_t personality;
00107   int pRank=0, pMode=-2, pCore=0, pEdge=1, xActiveCore=0, xActiveRank=0, xRC;
00108 
00109   /*
00110    * Check args, print test inputs.
00111    */
00112 
00113   if ( argc > 1 )
00114     sscanf(argv[1], "%d", &pRank);
00115   if ( argc > 2 )
00116     sscanf(argv[2], "%d", &pMode);
00117   if ( argc > 3 )
00118     sscanf(argv[3], "%d", &pCore);
00119   if ( argc > 4 )
00120     sscanf(argv[4], "%d", &pEdge);
00121 
00122 /*
00123  * Check for valid rank...
00124  */
00125   if ( pRank < 0 || pRank > 31 ) {
00126     printf("Invalid rank (%d) specified\n", pRank);
00127     exit(1);
00128   }
00129 /*
00130  * Check for valid mode...
00131  * Mode = -2 means use what was initialized by CNK
00132  * Mode = -1 means to initialize with the default
00133  * Mode = 0-3 means to initialize with mode 0-3
00134  */
00135   if ( pMode < -2 || pMode > 3 ) {
00136     printf("Invalid mode (%d) specified\n", pMode);
00137     exit(1);
00138   }
00139 /*
00140  * Check for valid core...
00141  */
00142   if ( pCore < 0 || pCore > 3 ) {
00143     printf("Invalid core (%d) specified\n", pCore);
00144     exit(1);
00145   }
00146 /*
00147  * Check for valid edge...
00148  * Edge = 1  means initialize with the default edge
00149  * Edge = 0  means initialize with level high
00150  * Edge = 4  means initialize with edge rise
00151  * Edge = 8  means initialize with edge fall
00152  * Edge = 12 means initialize with level low
00153  */
00154   if ( pEdge != 0 && pEdge != 1 && pEdge != 4 && pEdge != 8 && pEdge != 12 ) {
00155     printf("Invalid edge (%d) specified\n", pEdge);
00156     exit(1);
00157   }
00158 
00159 /*
00160  * Initialize the UPC environment...
00161  * NOTE:  Must do this from all 'ranks'...
00162  */
00163 //  BGP_UPC_Initialize();
00164   xRC = PAPI_library_init(PAPI_VER_CURRENT);
00165   if (xRC != 50921472) {
00166     printf("PAPI_library_init failed:  xRC=%d, ending...\n", xRC);
00167     exit(1);
00168   }
00169 
00170 /*
00171  * Only run if this is specified rank...
00172  */
00173 
00174   xRC = Kernel_GetPersonality(&personality, sizeof(_BGP_Personality_t));
00175   if (xRC !=0) {
00176     printf(" Kernel_GetPersonality returned %d\n",xRC) ;
00177     exit(xRC);
00178   }
00179   xActiveRank = personality.Network_Config.Rank;
00180   xActiveCore = Kernel_PhysicalProcessorID();
00181 
00182   printf("Rank %d, core %d reporting...\n", xActiveRank, xActiveCore);
00183 
00184   if (xActiveRank != pRank) {
00185     printf("Rank %d is not to run...  Exiting...\n", xActiveRank);
00186     exit(0);
00187   }
00188 
00189   if ( xActiveCore == pCore ) {
00190     printf("Program is to run on rank %d core %d, using mode= %d, edge= %d\n", pRank, xActiveCore, pMode, pEdge);
00191   }
00192   else {
00193     printf("Program is NOT to run on rank %d core %d...  Exiting...\n", pRank, xActiveCore);
00194     exit(0);
00195   }
00196 
00197 /*
00198  * Main processing...
00199  */
00200   printf("************************************************************\n");
00201   printf("* Configuration parameters used:                           *\n");
00202   printf("*   Rank = %d                                              *\n", pRank);
00203   printf("*   Mode = %d                                              *\n", pMode);
00204   printf("*   Core = %d                                              *\n", pCore);
00205   printf("*   Edge = %d                                              *\n", pEdge);
00206   printf("************************************************************\n\n");
00207 
00208   printf("Print config after PAPI_library_init...\n");
00209   BGP_UPC_Print_Config();
00210 
00211 /*
00212  * If we are to initialize, do so with user mode and edge...
00213  * Otherwise, use what was initialized by CNK...
00214  */
00215   if (pMode > -2) {
00216     BGP_UPC_Initialize_Counter_Config(pMode, pEdge);
00217     printf("UPC unit(s) initialized with mode=%d, edge=%d...\n", pMode, pEdge);
00218   }
00219 
00220   printf("Before running the main test procedure...\n");
00221   BGP_UPC_Print_Config();
00222   BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
00223 
00224 /*
00225  * Perform the main test procedure...
00226  */
00227   Do_Tests();
00228 
00229 /*
00230  * Print out final configuration and results...
00231  */
00232   printf("After running the main test procedure...\n");
00233   BGP_UPC_Print_Config();
00234   BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
00235 
00236   exit(0);
00237 }

Here is the call graph for this function:

void Print_Counter_Values ( const long long *  pCounters,
const int  pNumCounters 
)

Definition at line 1990 of file papi_1.c.

01990                                                                               {
01991   int i=0, j, xEnd;
01992   long long xCounters[NUMBER_COUNTERS_PER_ROW];
01993   printf("Print_Counter_Values:  Native_Buffer*=%p, pCounters*=%p\n", Native_Buffer, pCounters);
01994   printf("Number of Counters = %d\n", pNumCounters);
01995   if (pNumCounters) {
01996     printf("                     +0        +1        +2        +3        +4        +5        +6        +7\n");
01997     printf("---------------------------------------------------------------------------------------------\n");
01998     xEnd = (((pNumCounters-1)/NUMBER_COUNTERS_PER_ROW)*NUMBER_COUNTERS_PER_ROW)+NUMBER_COUNTERS_PER_ROW;
01999     while (i < xEnd) {
02000       for (j=0; j<NUMBER_COUNTERS_PER_ROW; j++) {
02001         if (i+j < pNumCounters) {
02002           xCounters[j] = pCounters[i+j];
02003         }
02004         else
02005           xCounters[j] = -1;
02006       }
02007       printf("Ctrs %3.3d-%3.3d:  %8lld  %8lld  %8lld  %8lld  %8lld  %8lld  %8lld  %8lld\n",
02008                i, i+7, xCounters[0], xCounters[1], xCounters[2], xCounters[3], xCounters[4],
02009                xCounters[5], xCounters[6], xCounters[7]);
02010       i += NUMBER_COUNTERS_PER_ROW;
02011     }
02012   }
02013 
02014   return;
02015 }

Here is the caller graph for this function:

void Print_Counters ( const int  pEventSet  ) 

Definition at line 1829 of file papi_1.c.

01829                                          {
01830   printf("\n***** Start Print Counter Values *****\n");
01831 //  Print_Native_Counters_via_Buffer((BGP_UPC_Read_Counters_Struct_t*)Native_Buffer);
01832 //  Print_Native_Counters();
01833   Print_Native_Counters_for_PAPI_Counters(pEventSet);
01834   Print_PAPI_Counters(pEventSet, PAPI_Counters);
01835   printf("\n*****  End Print Counter Values  *****\n");
01836 
01837   return;
01838 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_Native_Counters (  ) 

Definition at line 1845 of file papi_1.c.

01845                              {
01846   printf("\n***** Start Print of Native Counter Values *****\n");
01847   BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
01848   printf("*****  End Print of Native Counter Values  *****\n");
01849 
01850   return;
01851 }

Here is the caller graph for this function:

void Print_Native_Counters_for_PAPI_Counters ( const int  pEventSet  ) 

Definition at line 1858 of file papi_1.c.

01858                                                                   {
01859   printf("\n***** Start Print of Native Counter Values for PAPI Counters *****\n");
01860   int xNumEvents = PAPI_num_events(pEventSet);
01861   if (xNumEvents) {
01862     List_PAPI_Events(pEventSet, PAPI_Events, &xNumEvents);
01863     Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, xNumEvents);
01864   }
01865   else {
01866     printf("No events are present in the event set.\n");
01867   }
01868   printf("*****  End Print of Native Counter Values for PAPI Counters  *****\n");
01869 
01870   return;
01871 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_Native_Counters_for_PAPI_Counters_From_List ( const int *  pEvents,
const int  pNumEvents 
)

Definition at line 1877 of file papi_1.c.

01877                                                                                                  {
01878   int i, j, xRC;
01879   char xName[256];
01880   BGP_UPC_Event_Id_t xNativeEventId;
01881   PAPI_event_info_t xEventInfo;
01882 
01883 //  BGP_UPC_Print_Counter_Values(); // DLH
01884   for (i=0; i<pNumEvents; i++) {
01885     xRC = PAPI_event_code_to_name(PAPI_Events[i], xName);
01886     if (!xRC) {
01887       xRC = PAPI_get_event_info(PAPI_Events[i], &xEventInfo);
01888       if (xRC) {
01889         printf("FAILURE:  PAPI_get_event_info failed for %s, xRC=%d\n", xName, xRC);
01890         exit(1);
01891       }
01892       printf("\n     *** PAPI Counter Location %3.3d:  %#8.8x %s\n", i, PAPI_Events[i], xName);
01893       if (PAPI_Events[i] & 0x80000000) {
01894         // Preset event
01895         for (j=0; j<xEventInfo.count; j++) {
01896           xNativeEventId = (BGP_UPC_Event_Id_t)(xEventInfo.code[j]&0xBFFFFFFF);
01897 //          printf("Preset:  j=%d, xEventInfo.code[j]=%#8.8x, xNativeEventId=%#8.8x\n", j, xEventInfo.code[j], xNativeEventId);
01898           BGP_UPC_Print_Counter_Value(xNativeEventId, BGP_UPC_READ_EXCLUSIVE);
01899         }
01900       }
01901       else {
01902         // Native event
01903         xNativeEventId = (BGP_UPC_Event_Id_t)(PAPI_Events[i]&0xBFFFFFFF);
01904 //        printf("Native:  i=%d, PAPI_Events[i]=%#8.8x, xNativeEventId=%#8.8x\n", i, PAPI_Events[i], xNativeEventId);
01905         BGP_UPC_Print_Counter_Value(xNativeEventId, BGP_UPC_READ_EXCLUSIVE);
01906       }
01907     }
01908     else {
01909       printf("\n     *** PAPI Counter Location %3.3d:  Not mapped\n", i);
01910     }
01911   }
01912 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_Native_Counters_via_Buffer ( const BGP_UPC_Read_Counters_Struct_t *  pBuffer  ) 

Definition at line 1919 of file papi_1.c.

01919                                                                                      {
01920   Read_Native_Counters(BGP_UPC_MAXIMUM_LENGTH_READ_COUNTERS_STRUCTURE);
01921   printf("\n***** Start Print of Native Counter Values *****\n");
01922   printf("Elapsed Running Time (native) = %lld\n", (*pBuffer).elapsed_time);
01923 //  printf("Print_Native_Counters_via_Buffer:  Native_Buffer*=%p, pBuffer=%p, (*pBuffer).counter=%p\n", Native_Buffer, pBuffer, (*pBuffer).counter);
01924   Print_Counter_Values((long long*)(*pBuffer).counter, pBuffer->number_of_counters);
01925   printf("*****  End Print of Native Counter Values  *****\n");
01926 
01927   return;
01928 }

Here is the call graph for this function:

void Print_Node_Info ( void   ) 

Definition at line 2020 of file papi_1.c.

02020                            {
02021   Read_Native_Counters(BGP_UPC_MINIMUM_LENGTH_READ_COUNTERS_STRUCTURE);
02022   BGP_UPC_Read_Counters_Struct_t* xTemp;
02023   xTemp = (BGP_UPC_Read_Counters_Struct_t*)(void*)Native_Buffer;
02024   printf("***** Start Print of Node Information *****\n");
02025   printf("Rank = %d\n", xTemp->rank);
02026   printf("Core = %d\n", xTemp->core);
02027   printf("UPC Number = %d\n", xTemp->upc_number);
02028   printf("Number of Processes per UPC = %d\n", xTemp->number_processes_per_upc);
02029   printf("User Mode = %d\n", (int) xTemp->mode);
02030   printf("Location = %s\n", xTemp->location);
02031   printf("\n*****  End Print of Node Information *****\n\n");
02032 
02033   return;
02034 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_PAPI_Counters ( const int  pEventSet,
const long long *  pCounters 
)

Definition at line 1935 of file papi_1.c.

01935                                                                           {
01936   int i;
01937   char xName[256];
01938   printf("\n***** Start Print of PAPI Counter Values *****\n");
01939 //  printf("Print_PAPI_Counters:  PAPI_Counters*=%p, pCounters*=%p\n", PAPI_Counters, pCounters);
01940   int pNumEvents = PAPI_num_events(pEventSet);
01941   printf("Number of Counters = %d\n", pNumEvents);
01942   if (pNumEvents) {
01943     printf("    Calculated Value Location Event Number Event Name\n");
01944     printf("-------------------- -------- ------------ --------------------------------------------\n");
01945     List_PAPI_Events(pEventSet, PAPI_Events, &pNumEvents);
01946     for (i=0; i<pNumEvents; i++) {
01947       if (PAPI_event_code_to_name(PAPI_Events[i], xName)) {
01948         printf("PAPI_event_code_to_name failed on event code %d\n", PAPI_Events[i]);
01949         exit(1);
01950       }
01951       printf("%20llu      %3d   %#8.8x %s\n", pCounters[i], i, PAPI_Events[i], xName);
01952     }
01953   }
01954   printf("*****  End Print of PAPI Counter Values  *****\n");
01955 
01956   return;
01957 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_PAPI_Counters_From_List ( const int *  pEventList,
const int  pNumEvents,
const long long *  pCounters 
)

Definition at line 1964 of file papi_1.c.

01964                                                                                                             {
01965   int i;
01966   char xName[256];
01967   printf("\n***** Start Print of PAPI Counter Values *****\n");
01968   printf("Number of Counters = %d\n", pNumEvents);
01969   if (pNumEvents) {
01970     printf("    Calculated Value Location Event Number Event Name\n");
01971     printf("-------------------- -------- ------------ --------------------------------------------\n");
01972     for (i=0; i<pNumEvents; i++) {
01973       if (PAPI_event_code_to_name(pEventList[i], xName)) {
01974         printf("PAPI_event_code_to_name failed on event code %d\n", pEventList[i]);
01975         exit(1);
01976       }
01977       printf("%20llu      %3d   %#8.8x %s\n", pCounters[i], i, pEventList[i], xName);
01978     }
01979   }
01980   printf("*****  End Print of PAPI Counter Values  *****\n");
01981 
01982   return;
01983 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Print_PAPI_Events ( const int  pEventSet  ) 

Definition at line 2056 of file papi_1.c.

02056                                             {
02057   int i;
02058   char xName[256];
02059   int pNumEvents = PAPI_num_events(pEventSet);
02060   List_PAPI_Events(pEventSet, PAPI_Events, &pNumEvents);
02061   for (i=0; i<pNumEvents; i++) {
02062     if (!PAPI_event_code_to_name(PAPI_Events[i], xName))
02063       printf("PAPI Counter Location %3.3d:  %#8.8x %s\n", i, PAPI_Events[i], xName);
02064     else
02065       printf("PAPI Counter Location %3.3d:  Not mapped\n", i);
02066   }
02067 
02068   return;
02069 }

Here is the call graph for this function:

void Read_Native_Counters ( const int  pLength  ) 

Definition at line 2041 of file papi_1.c.

02041                                              {
02042 
02043   int xRC = BGP_UPC_Read_Counter_Values(Native_Buffer, pLength, BGP_UPC_READ_EXCLUSIVE);
02044   if (xRC < 0) {
02045     printf("FAILURE:  BGP_UPC_Read_Counter_Values failed, xRC=%d...\n", xRC);
02046     exit(1);
02047   }
02048 
02049   return;
02050 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Run_Cycle ( const int  pNumEvents  ) 

Definition at line 1549 of file papi_1.c.

01549                                      {
01550   int xRC;
01551 
01552 //  BGP_UPC_Zero_Counter_Values();
01553   Zero_Local_Counters(PAPI_Counters);
01554   xRC = PAPI_start_counters(PAPI_Events, pNumEvents);
01555   if (xRC == PAPI_OK)
01556     printf("SUCCESS:  PAPI_start_counters...\n");
01557   else
01558     printf("FAILURE:  PAPI_start_counters failed, returned xRC=%d...\n", xRC);
01559 
01560   Print_Native_Counters();
01561   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01562   FPUArith();
01563   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01564   Print_PAPI_Counters_From_List(PAPI_Events, pNumEvents, PAPI_Counters);
01565 
01566   FPUArith();
01567 
01568   xRC = PAPI_read_counters(PAPI_Counters, pNumEvents);
01569   if (xRC == PAPI_OK)
01570     printf("SUCCESS:  PAPI_read_counters...\n");
01571   else
01572     printf("FAILURE:  PAPI_read_counters failed, returned xRC=%d...\n", xRC);
01573 
01574   Print_Native_Counters();
01575   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01576   FPUArith();
01577   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01578   Print_PAPI_Counters_From_List(PAPI_Events, pNumEvents, PAPI_Counters);
01579   
01580   FPUArith();
01581 
01582   Zero_Local_Counters(PAPI_Counters);
01583   xRC = PAPI_accum_counters(PAPI_Counters, pNumEvents);
01584   if (xRC == PAPI_OK)
01585     printf("SUCCESS:  PAPI_accum_counters...\n");
01586   else
01587     printf("FAILURE:  PAPI_accum_counters failed, returned xRC=%d...\n", xRC);
01588 
01589   Print_Native_Counters();
01590   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01591   FPUArith();
01592   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01593   Print_PAPI_Counters_From_List(PAPI_Events, pNumEvents, PAPI_Counters);
01594 
01595   FPUArith();
01596 
01597   xRC = PAPI_read_counters(PAPI_Counters, pNumEvents);
01598   if (xRC == PAPI_OK)
01599     printf("SUCCESS:  PAPI_read_counters...\n");
01600   else
01601     printf("FAILURE:  PAPI_read_counters failed, returned xRC=%d...\n", xRC);
01602 
01603   Print_Native_Counters();
01604   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01605   FPUArith();
01606   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01607   Print_PAPI_Counters_From_List(PAPI_Events, pNumEvents, PAPI_Counters);
01608 
01609   FPUArith();
01610 
01611   xRC = PAPI_stop_counters(PAPI_Counters, pNumEvents);
01612   if (xRC == PAPI_OK)
01613     printf("SUCCESS:  PAPI_stop_counters...\n");
01614   else
01615     printf("FAILURE:  PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
01616 
01617   Print_Native_Counters();
01618   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01619   FPUArith();
01620   Print_Native_Counters_for_PAPI_Counters_From_List(PAPI_Events, pNumEvents);
01621   Print_PAPI_Counters_From_List(PAPI_Events, pNumEvents, PAPI_Counters);
01622 
01623   FPUArith();
01624 
01625   return;
01626 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Zero_Local_Counters ( long long *  pCounters  ) 

Definition at line 1633 of file papi_1.c.

01633                                                {
01634   int i;
01635   for (i=0; i<255; i++)
01636     pCounters[i] = 0;
01637 
01638   return;
01639 }

Here is the caller graph for this function:


Variable Documentation

double x [32] ALIGN_L3_CACHE

Definition at line 98 of file papi_1.c.

const int MaxNativeEventId = 511

Definition at line 103 of file papi_1.c.

const int MaxPresetEventId = 104

Definition at line 102 of file papi_1.c.

char Native_Buffer[BGP_UPC_MAXIMUM_LENGTH_READ_COUNTERS_STRUCTURE]

Definition at line 97 of file papi_1.c.

const int NumEventsPerSet = MAX_COUNTERS

Definition at line 101 of file papi_1.c.

long long PAPI_Counters[MAX_COUNTERS]

Definition at line 96 of file papi_1.c.

int PAPI_Events[MAX_COUNTERS]

Definition at line 95 of file papi_1.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1