1
+ #
2
+ # (C) Copyright 2024- ECMWF.
3
+ #
4
+ # This software is licensed under the terms of the Apache Licence Version 2.0
5
+ # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
+ # In applying this licence, ECMWF does not waive the privileges and immunities
7
+ # granted to it by virtue of its status as an intergovernmental organisation
8
+ # nor does it submit to any jurisdiction.
9
+ #
10
+
11
+ # Test basic implementation
12
+
13
+ ecbuild_add_executable( TARGET drhook_papi_basic
14
+ SOURCES drhook_papi_basic.F90
15
+ LIBS fiat
16
+ LINKER_LANGUAGE Fortran
17
+ CONDITION HAVE_DR_HOOK_PAPI
18
+ NOINSTALL )
19
+
20
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_basic
21
+ COMMAND drhook_papi_basic
22
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS
23
+ CONDITION HAVE_DR_HOOK_PAPI )
24
+
25
+ set_tests_properties (fiat_test_drhook_papi_basic
26
+ PROPERTIES PASS_REGULAR_EXPRESSION "Writing counter information of proc#1 into file" )
27
+
28
+
29
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_basic_valid_csv
30
+ TYPE SCRIPT
31
+ # Just making sure it's not an empty file
32
+ COMMAND "find"
33
+ ARGS "." "-name" "drhook.prof.0.csv" "-type" "f" "-size" "+100c"
34
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS
35
+ CONDITION HAVE_DR_HOOK_PAPI )
36
+
37
+ set_tests_properties (fiat_test_drhook_papi_basic_valid_csv
38
+ PROPERTIES DEPENDS fiat_test_drhook_papi_basic
39
+ FAIL_REGULAR_EXPRESSION "no matches found" )
40
+
41
+ # Test MPI implementation
42
+
43
+ ecbuild_add_executable( TARGET drhook_papi_mpi
44
+ SOURCES drhook_papi_mpi.F90
45
+ LIBS fiat
46
+ LINKER_LANGUAGE Fortran
47
+ CONDITION HAVE_DR_HOOK_PAPI AND HAVE_MPI
48
+ NOINSTALL )
49
+
50
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_mpi
51
+ COMMAND drhook_papi_mpi
52
+ MPI 5
53
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS
54
+ CONDITION HAVE_DR_HOOK_PAPI AND HAVE_MPI )
55
+
56
+
57
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_mpi_valid_csv
58
+ TYPE SCRIPT
59
+ # Just making sure it's not an empty file
60
+ # We have to do this weird thing with bash so that we can
61
+ # use a redirect. CMake tests are really basic...
62
+ COMMAND "bash"
63
+ ARGS "-c" "find . -name 'drhook.prof.[1-5].csv' -type f -size +100c | wc -l"
64
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS
65
+ CONDITION HAVE_DR_HOOK_PAPI AND HAVE_MPI )
66
+
67
+ set_tests_properties (fiat_test_drhook_papi_mpi_valid_csv
68
+ PROPERTIES DEPENDS fiat_test_drhook_papi_mpi
69
+ PASS_REGULAR_EXPRESSION "5" )
70
+
71
+ # Test user specified output file names
72
+
73
+ ecbuild_add_executable( TARGET drhook_papi_user_filename
74
+ SOURCES drhook_papi_user_filename.F90
75
+ LIBS fiat
76
+ LINKER_LANGUAGE Fortran
77
+ CONDITION HAVE_DR_HOOK_PAPI
78
+ NOINSTALL )
79
+
80
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_user_filename
81
+ COMMAND drhook_papi_user_filename
82
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS DR_HOOK_PROFILE=fiat_test_drhook_papi_user_filename
83
+ CONDITION HAVE_DR_HOOK_PAPI )
84
+
85
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_user_filename_valid_csv
86
+ TYPE SCRIPT
87
+ # Just making sure it's not an empty file
88
+ COMMAND "find"
89
+ ARGS "." "-name" "fiat_test_drhook_papi_user_filename.1.csv" "-type" "f"
90
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS
91
+ CONDITION HAVE_DR_HOOK_PAPI )
92
+
93
+ set_tests_properties (fiat_test_drhook_papi_user_filename_valid_csv
94
+ PROPERTIES DEPENDS fiat_test_drhook_papi_user_filename
95
+ FAIL_REGULAR_EXPRESSION "no matches found" )
96
+
97
+ # Test user specified counters
98
+
99
+ ecbuild_add_executable( TARGET drhook_papi_user_counters
100
+ SOURCES drhook_papi_user_counters.F90
101
+ LIBS fiat
102
+ LINKER_LANGUAGE Fortran
103
+ CONDITION HAVE_DR_HOOK_PAPI
104
+ NOINSTALL )
105
+
106
+ ecbuild_add_test( TARGET fiat_test_drhook_papi_user_counters
107
+ COMMAND drhook_papi_user_counters
108
+ ENVIRONMENT DR_HOOK=1 DR_HOOK_OPT=COUNTERS DR_HOOK_PAPI_COUNTERS=PAPI_TOT_INS DR_HOOK_PROFILE=fiat_test_drhook_papi_user_counters
109
+ CONDITION HAVE_DR_HOOK_PAPI )
0 commit comments