Exemple #1
0
int
IOUNIT_stop( hwd_context_t * ctx, hwd_control_state_t * ptr )
{
#ifdef DEBUG_BGQ
	printf( "IOUNIT_stop\n" );
#endif
	( void ) ctx;
	int retval;
	IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ptr;
	
	retval = Bgpm_Stop( this_state->EventGroup );
	CHECK_BGPM_ERROR( retval, "Bgpm_Stop" );
	
	return ( PAPI_OK );
}
Exemple #2
0
int
NWUNIT_stop( hwd_context_t * ctx, hwd_control_state_t * ptr )
{
#ifdef DEBUG_BGQ
	printf( "NWUNIT_stop\n" );
#endif
	( void ) ctx;
	int retval;
	NWUNIT_control_state_t * this_state = ( NWUNIT_control_state_t * ) ptr;
	
	retval = Bgpm_Stop( this_state->EventGroup );
	retval = _check_BGPM_error( retval, "Bgpm_Stop" );
	if ( retval < 0 ) return retval;

	return ( PAPI_OK );
}
Exemple #3
0
void multiplex(period,normalize)
{
    // initialize sw thread to use BGPM in sw thread distributed mode
    // Allows up to 12 simultaineous punit counter per thread when using only
    // 2 threads/core
    Bgpm_Init(BGPM_MODE_SWDISTRIB);
  
    // Create event set and add events needed to calculate CPI,
    int hEvtSet = Bgpm_CreateEventSet();

    // Multiplexing must be enabled prior to adding events to a Punit event set.
    // With Multiplexing active on Punit event set, we can have as many Punit events as we like,
    // regardless of Max Events. Muxing will create as many groups as needed to hold all the events,
    // but by default only assigns up to 5 events per group (And reserves the 6th counter to track the number of
    // cycles a group has been active).
    // However, a few of the core-wide attributes used by events must still remain consistent
    // (like the l1p mode associated with the l1p events)
    //
    // Parameters:
    // period-> number of cycles between multiplex switches. A value of 0 disables multiplexing for this thread,
    //     which means you must explicitly call Bgpm_SwitchMux to switch between groups.
    // normalize->Pass in BGPM_NORMAL or BGPM_NOTNORMAL to choose whether event counts
    //     reported by Bgpm_ReadEvent() or Bgpm_ReadEventList() will be scaled to the to the maximum number of cycles spent
    //     by any mux group.
    //     With BGPM_NOTNORMAL, Bgpm_ReadEvent() and Bgpm_ReadEventList() report the raw numbers and you may use
    //     Bgpm_GetMultiplex() and Bgpm_GetMuxEventElapsedCycles() to do your own normalization as desired.
    Bgpm_SetMultiplex2(hEvtSet, period, normalize, BGPMMuxMinEvts);

    Bgpm_AddEventList(hEvtSet, evtList, sizeof(evtList)/sizeof(unsigned) );

    Bgpm_Apply(hEvtSet);
    Bgpm_Start(hEvtSet);

    const int loops = 100;
    int i; 
    for (i=0; i<loops; i++) {
        CreateEvents();
        if(!period){Bgpm_SwitchMux(hEvtSet);} // Switching mutiplex is needed only in case of period=0.
    }

    Bgpm_Stop(hEvtSet);
    PrintCounts(hEvtSet);
    Bgpm_Disable();
}
Exemple #4
0
int
IOUNIT_reset( hwd_context_t * ctx, hwd_control_state_t * ptr )
{
#ifdef DEBUG_BGQ
	printf( "IOUNIT_reset\n" );
#endif
	( void ) ctx;
	int retval;
	IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ptr;

	/* we can't simply call Bgpm_Reset() since PAPI doesn't have the 
	 restriction that an EventSet has to be stopped before resetting is
	 possible. However, BGPM does have this restriction. 
	 Hence we need to stop, reset and start */
	retval = Bgpm_Stop( this_state->EventGroup );
	CHECK_BGPM_ERROR( retval, "Bgpm_Stop" );
	
	retval = Bgpm_ResetStart( this_state->EventGroup );
	CHECK_BGPM_ERROR( retval, "Bgpm_ResetStart" );
	
	return ( PAPI_OK );
}
Exemple #5
0
void tw_run(void) {
    tw_pe *me;

    late_sanity_check();

    me = setup_pes();

#ifdef USE_BGPM
    Bgpm_Init(BGPM_MODE_SWDISTRIB);

    // Create event set and add events needed to calculate CPI,
    int hEvtSet = Bgpm_CreateEventSet();

    // Change the type here to get the other performance monitor sets -- defaults to instList set
    // Sets need to be different because there are conflicts when mixing certain events.
    Bgpm_AddEventList(hEvtSet, instList, sizeof(instList)/sizeof(unsigned) );

    if( me->id == 0) {
        printf("***************************************************************************************** \n");
        printf("* NOTICE: Build configured with Blue Gene/Q specific, BGPM performance monitoring code!!* \n");
        printf("***************************************************************************************** \n");
    }

    Bgpm_Apply(hEvtSet);
    Bgpm_Start(hEvtSet);
#endif

    tw_sched_init(me);

    switch(g_tw_synchronization_protocol) {
        case SEQUENTIAL:    // case 1
            tw_scheduler_sequential(me);
            break;

        case CONSERVATIVE: // case 2
            tw_scheduler_conservative(me);
            break;

        case OPTIMISTIC:   // case 3
            tw_scheduler_optimistic(me);
            break;

        case OPTIMISTIC_DEBUG:  // case 4
            tw_scheduler_optimistic_debug(me);
            break;

        default:
            tw_error(TW_LOC, "No Synchronization Protocol Specified! \n");
    }

#ifdef USE_BGPM
    Bgpm_Stop(hEvtSet);

    if( me->id == 0 ) { // Have only RANK 0 output stats
        int i;
        uint64_t cnt;
        int numEvts = Bgpm_NumEvents(hEvtSet);
        printf("\n \n ================================= \n");
        printf( "Performance Counter Results:\n");
        printf("--------------------------------- \n");
        for (i=0; i<numEvts; i++) {
            Bgpm_ReadEvent(hEvtSet, i, &cnt);
            printf("   %40s = %20llu\n", Bgpm_GetEventLabel(hEvtSet, i), cnt);
        }
        printf("================================= \n");
    }
#endif
}