Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lorenz Huedepohl
ftimings
Commits
144ff848
Commit
144ff848
authored
Mar 12, 2015
by
Lorenz Huedepohl
Browse files
Add a stand-alone PAPI test program
parent
1d11c7f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
144ff848
...
...
@@ -55,7 +55,7 @@ ftimings_c_example_SOURCES = \
ftimings_c_example_LDADD
=
libftimings-@FTIMINGS_API_VERSION@-@FC@.la
ftimings_c_example_LINK
=
$(FCLINK)
-static
noinst_PROGRAMS
=
do_flops do_memory_transfer test_perf
noinst_PROGRAMS
=
do_flops do_memory_transfer test_perf
test_papi
do_flops_SOURCES
=
\
examples/do_flops.c
...
...
@@ -69,6 +69,10 @@ test_perf_SOURCES = \
ftimings/perf_memory_counter.c
test_perf_CPPFLAGS
=
-DTEST_PERF
test_papi_SOURCES
=
\
ftimings/papi.c
test_papi_CPPFLAGS
=
-DTEST_PAPI
# other files to distribute
filesdir
=
$(datadir)
/@PACKAGE@-@FC@/examples
files_DATA
=
examples/example.F90
...
...
ftimings/papi.c
View file @
144ff848
...
...
@@ -136,4 +136,33 @@ void ftimings_papi_counters(long long *flop, long long *cycles) {
*
cycles
=
0LL
;
}
}
#endif
#ifdef TEST_PAPI
#include
<assert.h>
static
void
print_papi_counters
(
int
event_set
)
{
long
long
flop_count
,
cycle_count
;
ftimings_papi_counters
(
&
flop_count
,
&
cycle_count
);
printf
(
"FLOP count: %lld, CPU cycles: %lld
\n
"
,
flop_count
,
cycle_count
);
printf
(
"FLOP/cycle: %g
\n\n
"
,
(
double
)
flop_count
/
(
double
)
cycle_count
);
}
double
w
;
int
main
(
int
argc
,
char
*
argv
[
argc
+
1
])
{
int
i
;
assert
(
ftimings_flop_init
());
print_papi_counters
(
event_set
);
w
=
1
.
5
;
for
(
i
=
0
;
i
<
1
<<
27
;
i
++
)
{
w
=
w
+
1
/
w
;
}
print_papi_counters
(
event_set
);
}
#endif
/* TEST_PAPI */
#endif
/* HAVE_LIBPAPI */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment