int PAPI_ipc(float *rtime, float *ptime, long long * ins, float *ipc) { HighLevelInfo *state = NULL; int retval; if ((retval = _internal_check_state(&state)) != PAPI_OK) return (retval); return(_hl_rate_calls(rtime,ptime,ins,ipc,PAPI_TOT_INS,state)); }
/** @class PAPI_ipc * @brief Simplified call to get instructions per cycle, real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_ipc( float *rtime, float *ptime, long long *ins, float *ipc ); * * @param *rtime * total realtime since the first call * @param *ptime * total process time since the first call * @param *ins * total instructions since the first call * @param *ipc * incremental instructions per cycle since the last call * * @retval PAPI_EINVAL * The counters were already started by something other than PAPI_ipc(). * @retval PAPI_ENOEVNT * The floating point operations event does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_ipc() will initialize the PAPI High Level interface, * set up the counters to monitor PAPI_TOT_INS and PAPI_TOT_CYC events * and start the counters. * * Subsequent calls will read the counters and return total real time, * total process time, total instructions since the start of the * measurement and the IPC rate since the latest call to PAPI_ipc(). * * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() or other rate calls can safely be used. * * PAPI_ipc should return a ratio greater than 1.0, indicating instruction level * parallelism within the chip. The larger this ratio the more effeciently the program * is running. * * @see PAPI_flips() * @see PAPI_flops() * @see PAPI_epc() * @see PAPI_stop_counters() */ int PAPI_ipc( float *rtime, float *ptime, long long *ins, float *ipc ) { long long values[2] = { 0, 0 }; int events[2] = {PAPI_TOT_INS, PAPI_TOT_CYC}; int retval = 0; if ( rtime == NULL || ptime == NULL || ins == NULL || ipc == NULL ) return PAPI_EINVAL; retval = _hl_rate_calls( rtime, ptime, events, values, ins, ipc, HL_IPC ); return ( retval ); }
/** @class PAPI_flops * @brief Simplified call to get Mflops/s (floating point operation rate), real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_flops( float *rtime, float *ptime, long long *flpops, float *mflops ); * * @param *rtime * total realtime since the first call * @param *ptime * total process time since the first call * @param *flpops * total floating point operations since the first call * @param *mflops * incremental (Mega) floating point operations per seconds since the last call * * @retval PAPI_EINVAL * The counters were already started by something other than PAPI_flops(). * @retval PAPI_ENOEVNT * The floating point operations event does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_flops() will initialize the PAPI High Level interface, * set up the counters to monitor the PAPI_FP_OPS event and start the counters. * * Subsequent calls will read the counters and return total real time, * total process time, total floating point operations since the start of the * measurement and the Mflop/s rate since latest call to PAPI_flops(). * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() or other rate calls can safely be used. * * PAPI_flops returns information related to theoretical floating point operations * rather than simple instructions. It uses the PAPI_FP_OPS event which attempts to * 'correctly' account for, e.g., FMA undercounts and FP Store overcounts, etc. * * @see PAPI_flips() * @see PAPI_ipc() * @see PAPI_epc() * @see PAPI_stop_counters() */ int PAPI_flops( float *rtime, float *ptime, long long *flpops, float *mflops ) { int retval; int events = PAPI_FP_OPS; long long values = 0; if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL ) return PAPI_EINVAL; retval = _hl_rate_calls( rtime, ptime, &events, &values, flpops, mflops, HL_FLOP ); return ( retval ); }
/** @class PAPI_flips * @brief Simplified call to get Mflips/s (floating point instruction rate), real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_flips( float *rtime, float *ptime, long long *flpins, float *mflips ); * * @param *rtime * total realtime since the first call * @param *ptime * total process time since the first call * @param *flpins * total floating point instructions since the first call * @param *mflips * incremental (Mega) floating point instructions per seconds since the last call * * @retval PAPI_EINVAL * The counters were already started by something other than PAPI_flips(). * @retval PAPI_ENOEVNT * The floating point instructions event does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_flips() will initialize the PAPI High Level interface, * set up the counters to monitor the PAPI_FP_INS event and start the counters. * * Subsequent calls will read the counters and return total real time, * total process time, total floating point instructions since the start of the * measurement and the Mflip/s rate since latest call to PAPI_flips(). * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() or other rate calls can safely be used. * * PAPI_flips returns information related to floating point instructions using * the PAPI_FP_INS event. This is intended to measure instruction rate through the * floating point pipe with no massaging. * * @see PAPI_flops() * @see PAPI_ipc() * @see PAPI_epc() * @see PAPI_stop_counters() */ int PAPI_flips( float *rtime, float *ptime, long long *flpins, float *mflips ) { int retval; int events[1] = {PAPI_FP_INS}; long long values = 0; if ( rtime == NULL || ptime == NULL || flpins == NULL || mflips == NULL ) return PAPI_EINVAL; retval = _hl_rate_calls( rtime, ptime, events, &values, flpins, mflips, HL_FLIP ); return ( retval ); }
int PAPI_flops(float *rtime, float *ptime, long long * flpops, float *mflops) { HighLevelInfo *state = NULL; int retval; if ((retval = _internal_check_state(&state)) != PAPI_OK) return (retval); if ((retval = _hl_rate_calls(rtime, ptime, flpops, mflops, PAPI_FP_OPS, state)) != PAPI_OK) return (retval); return (PAPI_OK); }
/** @class PAPI_ipc * @brief Get instructions per cycle, real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_ipc( float *rtime, float *ptime, long long *ins, float *ipc ); * * @param *rtime * total realtime since the first PAPI_flops() call * @param *ptime * total process time since the first PAPI_flops() call * @param *ins * total instructions since the first call * @param *ipc * instructions per cycle achieved since the previous call * * @retval PAPI_EINVAL * The counters were already started by something other than: PAPI_ipc() * @retval PAPI_ENOEVNT * The total instructions or total cycles event does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_ipc() will initialize the PAPI High Level interface, * set up the counters to monitor PAPI_TOT_INS and PAPI_TOT_CYC events * and start the counters. * Subsequent calls will read the counters and return total real time, * total process time, total instructions since the start of the measurement * and the instructions per cycle rate since latest call to PAPI_ipc(). * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() can safely be used. * * @see PAPI_flops() PAPI_stop_counters() PAPI_set_opt() PAPI_flips() */ int PAPI_ipc( float *rtime, float *ptime, long long *ins, float *ipc ) { if ( rtime == NULL || ptime == NULL || ins == NULL || ipc == NULL ) return PAPI_EINVAL; HighLevelInfo *state = NULL; int retval; if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK ) return ( retval ); return _hl_rate_calls( rtime, ptime, ins, ipc, ( unsigned int ) PAPI_TOT_INS, state ); }
/** @class PAPI_flops * @brief Simplified call to get Mflops/s (floating point instruction rate), real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_flops( float *rtime, float *ptime, long long *flpops, float *mflops ); * * @param *rtime * total realtime since the first PAPI_flops() call * @param *ptime * total process time since the first PAPI_flops() call * @param *flpins * total floating point instructions since the first call * @param *rtime * total realtime since the first PAPI_flops() call * @param *ptime * total process time since the first PAPI_flops() call * @param *flpops * total floating point instructions since the first call * * @retval PAPI_EINVAL * The counters were already started by something other than: PAPI_flips() or PAPI_flops(). * @retval PAPI_ENOEVNT * The floating point operations, floating point instructions or total cycles * event does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_flops() will initialize the PAPI High Level interface, * set up the counters to monitor PAPI_FP_OPS and PAPI_TOT_CYC events * and start the counters. * Subsequent calls will read the counters and return total real time, * total process time, total floating point instructions since the start of the * measurement and the Mflop/s rate since latest call to PAPI_flops(). * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() can safely be used. * * @internal * The next three calls all use _hl_rate_calls() to return an instruction rate value. * PAPI_flops returns information related to floating point instructions using * the PAPI_FP_INS event. This is intended to measure instruction rate through the * floating point pipe with no massaging. * PAPI_flops return information related to theoretical floating point operations * rather than simple instructions. It uses the PAPI_FP_OPS event which attempts to * 'correctly' account for, e.g., FMA undercounts and FP Store overcounts, etc. * * @see PAPI_stop_counters() PAPI_ipc() PAPI_set_opt() */ int PAPI_flops( float *rtime, float *ptime, long long *flpops, float *mflops ) { if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL ) return PAPI_EINVAL; HighLevelInfo *state = NULL; int retval; if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK ) return ( retval ); if ( ( retval = _hl_rate_calls( rtime, ptime, flpops, mflops, ( unsigned int ) PAPI_FP_OPS, state ) ) != PAPI_OK ) return ( retval ); return ( PAPI_OK ); }
/** @class PAPI_epc * @brief Simplified call to get arbitrary events per cycle, real and processor time. * * @par C Interface: * \#include <papi.h> @n * int PAPI_epc( int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc ); * * @param event * event code to be measured (0 defaults to PAPI_TOT_INS) * @param *rtime * total realtime since the first call * @param *ptime * total process time since the first call * @param *ref * incremental reference clock cycles since the last call * @param *core * incremental core clock cycles since the last call * @param *evt * total events since the first call * @param *epc * incremental events per cycle since the last call * * @retval PAPI_EINVAL * The counters were already started by something other than PAPI_epc(). * @retval PAPI_ENOEVNT * One of the requested events does not exist. * @retval PAPI_ENOMEM * Insufficient memory to complete the operation. * * The first call to PAPI_epc() will initialize the PAPI High Level interface, * set up the counters to monitor the user specified event, PAPI_TOT_CYC, * and PAPI_REF_CYC (if it exists) and start the counters. * * Subsequent calls will read the counters and return total real time, * total process time, total event counts since the start of the * measurement and the core and reference cycle count and EPC rate since the * latest call to PAPI_epc(). * A call to PAPI_stop_counters() will stop the counters from running and then * calls such as PAPI_start_counters() or other rate calls can safely be used. * * PAPI_epc can provide a more detailed look at algorithm efficiency in light of clock * variability in modern cpus. MFLOPS is no longer an adequate description of peak * performance if clock rates can arbitrarily speed up or slow down. By allowing a * user specified event and reporting reference cycles, core cycles and real time, * PAPI_epc provides the information to compute an accurate effective clock rate, and * an accurate measure of computational throughput. * * @see PAPI_flips() * @see PAPI_flops() * @see PAPI_ipc() * @see PAPI_stop_counters() */ int PAPI_epc( int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc ) { long long values[3] = { 0, 0, 0 }; int events[3] = {PAPI_TOT_INS, PAPI_TOT_CYC, PAPI_REF_CYC}; int retval = 0; if ( rtime == NULL || ptime == NULL || ref == NULL ||core == NULL || evt == NULL || epc == NULL ) return PAPI_EINVAL; // if an event is provided, use it; otherwise use TOT_INS if (event != 0 ) events[0] = event; if ( PAPI_query_event( ( int ) PAPI_REF_CYC ) != PAPI_OK ) events[2] = 0; retval = _hl_rate_calls( rtime, ptime, events, values, evt, epc, HL_EPC ); *core = values[1]; *ref = values[2]; return ( retval ); }