|
Packit |
577717 |
#include "fpapi_test.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
program second
|
|
Packit |
577717 |
implicit integer (p)
|
|
Packit |
577717 |
integer domain, granularity
|
|
Packit |
577717 |
character*(PAPI_MAX_STR_LEN) domainstr, grnstr
|
|
Packit |
577717 |
integer*8 values(10), max, min
|
|
Packit |
577717 |
integer es1, es2, es3
|
|
Packit |
577717 |
integer retval
|
|
Packit |
577717 |
|
|
Packit |
577717 |
Integer last_char
|
|
Packit |
577717 |
External last_char
|
|
Packit |
577717 |
integer tests_quiet, get_quiet
|
|
Packit |
577717 |
external get_quiet
|
|
Packit |
577717 |
#if (defined(sgi) && defined(host_mips))
|
|
Packit |
577717 |
integer id
|
|
Packit |
577717 |
integer*4 getuid
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#if (defined(sgi) && defined(host_mips))
|
|
Packit |
577717 |
id = getuid()
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
tests_quiet = get_quiet()
|
|
Packit |
577717 |
es1 = PAPI_NULL
|
|
Packit |
577717 |
es2 = PAPI_NULL
|
|
Packit |
577717 |
es3 = PAPI_NULL
|
|
Packit |
577717 |
|
|
Packit |
577717 |
retval = PAPI_VER_CURRENT
|
|
Packit |
577717 |
call PAPIf_library_init(retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_VER_CURRENT) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_library_init', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_query_event(PAPI_TOT_INS, retval)
|
|
Packit |
577717 |
if (retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_skip(__FILE__, __LINE__, 'PAPI_FP_INS', PAPI_ENOEVNT)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_create_eventset(es1, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_create_eventset',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es1, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es1, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_create_eventset(es2, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_create_eventset',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es2, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es2, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_create_eventset(es3, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_create_eventset',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es3, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_add_event( es3, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_add_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_set_event_domain(es1, PAPI_DOM_ALL, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_set_domain', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_set_event_domain(es2, PAPI_DOM_KERNEL, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_set_domain', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_set_event_domain(es3, PAPI_DOM_USER, retval)
|
|
Packit |
577717 |
if ( retval.NE.PAPI_OK) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_set_domain', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_start(es1, retval)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call fdo_flops(NUM_FLOPS)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (retval.eq.PAPI_OK) then
|
|
Packit |
577717 |
call PAPIf_stop(es1, values(1), retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_stop', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_start(es2, retval)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call fdo_flops(NUM_FLOPS)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (retval.eq.PAPI_OK) then
|
|
Packit |
577717 |
call PAPIf_stop(es2, values(3), retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_stop', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_start(es3, retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_start', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call fdo_flops(NUM_FLOPS)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_stop(es3, values(5), retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_stop', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_remove_event( es1, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_remove_event( es1, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_remove_event( es2, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_remove_event( es2, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_remove_event( es3, PAPI_TOT_INS, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
call PAPIf_remove_event( es3, PAPI_TOT_CYC, retval )
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_remove_event', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (tests_quiet .EQ. 0) then
|
|
Packit |
577717 |
print *, 'Test case 2: Non-overlapping start, stop, read',
|
|
Packit |
577717 |
*' for all 3 domains.'
|
|
Packit |
577717 |
print *, '-------------------------------------------------'//
|
|
Packit |
577717 |
* '------------------------------'
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_get_domain(es1, domain, PAPI_DEFDOM, retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_get_domain', retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call stringify_domain(domain, domainstr)
|
|
Packit |
577717 |
if (tests_quiet .EQ. 0) then
|
|
Packit |
577717 |
write (*,900) 'Default domain is:', domain, domainstr
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
900 format(a20, i3, ' ', a70)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call PAPIf_get_granularity(es1, granularity, PAPI_DEFGRN,
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
if ( retval .NE. PAPI_OK ) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPIf_get_granularity',
|
|
Packit |
577717 |
*retval)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call stringify_granularity(granularity, grnstr)
|
|
Packit |
577717 |
if (tests_quiet .EQ. 0) then
|
|
Packit |
577717 |
write (*,800) 'Default granularity is:', granularity, grnstr
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
800 format(a25, i3, ' ', a20)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if (tests_quiet .EQ. 0) then
|
|
Packit |
577717 |
print *, 'Using', NUM_FLOPS, ' iterations of c += b*c'
|
|
Packit |
577717 |
|
|
Packit |
577717 |
print *, '-------------------------------------------------'//
|
|
Packit |
577717 |
* '------------------------------'
|
|
Packit |
577717 |
|
|
Packit |
577717 |
print *, 'Test type : PAPI_DOM_ALL PAPI_DOM_KERNEL',
|
|
Packit |
577717 |
*' PAPI_DOM_USER'
|
|
Packit |
577717 |
write (*,200) 'PAPI_TOT_INS', values(1), values(3), values(5)
|
|
Packit |
577717 |
write (*,200) 'PAPI_TOT_CYC', values(2), values(4), values(6)
|
|
Packit |
577717 |
200 format(A15, ': ', I15, I15, I15)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
print *, '-------------------------------------------------'//
|
|
Packit |
577717 |
* '------------------------------'
|
|
Packit |
577717 |
|
|
Packit |
577717 |
print *, 'Verification:'
|
|
Packit |
577717 |
print *, 'Row 1 approximately equals N 0 N'
|
|
Packit |
577717 |
print *, 'Column 1 approximately equals column 2 plus column 3'
|
|
Packit |
577717 |
#if defined(sgi) && defined(host_mips)
|
|
Packit |
577717 |
print *
|
|
Packit |
577717 |
print *, '* IRIX requires root for PAPI_DOM_KERNEL',
|
|
Packit |
577717 |
*' and PAPI_DOM_ALL.'
|
|
Packit |
577717 |
print *, '* The first two columns will be invalid if not',
|
|
Packit |
577717 |
*' run as root for IRIX.'
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#if (defined(sgi) && defined(host_mips))
|
|
Packit |
577717 |
if (id.NE.0) then
|
|
Packit |
577717 |
min = NUM_FLOPS*0.9
|
|
Packit |
577717 |
max = NUM_FLOPS*1.1
|
|
Packit |
577717 |
if ((values(5) .lt. min) .OR. (values(5) .gt. max)) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_FP_INS', 1)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
else
|
|
Packit |
577717 |
min = values(5)*0.9
|
|
Packit |
577717 |
max = values(5)*1.1
|
|
Packit |
577717 |
if ((values(1) .lt. min) .OR. (values(1) .gt. max)) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_FP_INS', 1)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
min = values(2)*0.9
|
|
Packit |
577717 |
max = values(2)*1.1
|
|
Packit |
577717 |
if (((values(4)+values(6)) .lt. min) .OR.
|
|
Packit |
577717 |
* ((values(4)+values(6)) .gt. max)) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__, 'PAPI_TOT_CYC', 1)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
endif
|
|
Packit |
577717 |
#else
|
|
Packit |
577717 |
min = INT(REAL(values(5))*0.9)
|
|
Packit |
577717 |
max = INT(REAL(values(5))*1.1)
|
|
Packit |
577717 |
if ((values(1) .lt. min) .OR. (values(1) .gt. max)) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_FP_INS', 1)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
|
|
Packit |
577717 |
min = INT(REAL(values(2))*0.8)
|
|
Packit |
577717 |
max = INT(REAL(values(2))*1.2)
|
|
Packit |
577717 |
if (((values(4)+values(6)) .lt. min) .OR.
|
|
Packit |
577717 |
* ((values(4)+values(6)) .gt. max)) then
|
|
Packit |
577717 |
call ftest_fail(__FILE__, __LINE__,
|
|
Packit |
577717 |
. 'PAPI_TOT_CYC', 1)
|
|
Packit |
577717 |
end if
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
call ftests_pass(__FILE__)
|
|
Packit |
577717 |
end
|