/usr/share/doc/papi-examples/ftests/zeronamed.F is in papi-examples 5.3.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | #include "fpapi_test.h"
program zero
integer*8 values(10)
integer es, event
integer*8 uso, usn, cyco, cycn
integer domain, granularity
character*(PAPI_MAX_STR_LEN) domainstr, grnstr
character*(PAPI_MAX_STR_LEN) name
integer retval
Integer last_char
External last_char
integer tests_quiet, get_quiet
external get_quiet
tests_quiet = get_quiet()
es = PAPI_NULL
retval = PAPI_VER_CURRENT
call PAPIf_library_init(retval)
if ( retval.NE.PAPI_VER_CURRENT) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPI_library_init', retval)
end if
call PAPIf_query_named_event('PAPI_TOT_CYC', retval)
if (retval .NE. PAPI_OK) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_query_named_event: PAPI_TOT_CYC', retval)
end if
call PAPIf_query_named_event('PAPI_TOT_INS', retval)
if (retval .NE. PAPI_OK) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_query_named_event: PAPI_TOT_INS', retval)
end if
call PAPIf_create_eventset(es, retval)
if ( retval.NE.PAPI_OK) then
call ftest_fail( __FILE__, __LINE__,
. 'PAPIf_create_eventset', retval )
end if
call PAPIf_add_named_event( es, 'PAPI_TOT_CYC', retval )
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_add_event: PAPI_TOT_CYC', retval)
end if
call PAPIf_add_named_event( es, 'PAPI_TOT_INS', retval )
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_add_event: PAPI_TOT_INS', retval)
end if
call PAPIf_get_real_usec(uso)
call PAPIf_get_real_cyc(cyco)
call PAPIf_start(es, retval)
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_start', retval)
end if
call fdo_flops(NUM_FLOPS)
call PAPIf_stop(es, values(1), retval)
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_stop', retval)
end if
call PAPIf_get_real_usec(usn)
call PAPIf_get_real_cyc(cycn)
if (tests_quiet .EQ. 0) then
print *, "PAPI_{query, add, remove}_named_event API test."
print *, "-----------------------------------------------",
* "--------------------------"
end if
call PAPIf_get_domain(es, domain, PAPI_DEFDOM, retval)
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_get_domain', retval)
end if
call stringify_domain(domain, domainstr)
if (tests_quiet .EQ. 0) then
write (*,800) "Default domain is :", domain, domainstr
end if
call PAPIf_get_granularity(es, granularity, PAPI_DEFGRN,
* retval)
if ( retval .NE. PAPI_OK ) then
call ftest_fail(__FILE__, __LINE__,
. 'PAPIf_get_granularity',
* retval)
end if
call stringify_granularity(granularity, grnstr)
if (tests_quiet .EQ. 0) then
call PAPIf_event_code_to_name (event, name, retval)
write (*,800) "Default granularity is:", granularity, grnstr
800 format(a25, i3, " ", a70)
write (*,810) "Using", NUM_FLOPS,
$ " iterations of c = c + a * b"
810 format(a7, i9, a)
print *, "-----------------------------------------------",
* "--------------------------"
write (*,100) "Test type", 1
write (*,100) "PAPI_TOT_CYC", values(1)
write (*,100) "PAPI_TOT_INS", values(2)
write (*,100) "Real usec", usn-uso
write (*,100) "Real cycles", cycn-cyco
100 format(a13, ":", i12)
print *, "-----------------------------------------------",
* "--------------------------"
print *, "Verification: PAPI_TOT_CYC should be roughly ",
* "real_cycles"
endif
call ftests_pass(__FILE__)
end
|