Auto sync2gitlab import of papi-5.6.0-14.el8.src.rpm

This commit is contained in:
James Antill 2022-05-26 12:39:14 -04:00
parent 583e5bf584
commit 5a6229be6b
11 changed files with 1878 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/papi-5.6.0.tar.gz

1
EMPTY
View File

@ -1 +0,0 @@

382
papi-bz1908126.patch Normal file
View File

@ -0,0 +1,382 @@
commit 77ee6b54f4080ca27b7efcb4c91679d0f1e090b5
Author: Anthony Castaldo <TonyCastaldo@icl.utk.edu>
Date: Fri Jan 24 10:25:36 2020 -0500
New libpfm4 contains "aliased" pmus for backward compatibility,
amd64_fam17h == amd64_fam17h_zen1; this causes us to put BOTH pmus
into the PMUs supported string and double the events in native_avail.
This update recognizes when aliases exist (the names must be hard-coded)
and uses only one of the most recent name.
diff --git a/src/components/perf_event/pe_libpfm4_events.c b/src/components/perf_event/pe_libpfm4_events.c
index 3b5f8d13f..3262608cd 100644
--- a/src/components/perf_event/pe_libpfm4_events.c
+++ b/src/components/perf_event/pe_libpfm4_events.c
@@ -31,6 +31,9 @@
// used to step through the attributes when enumerating events
static int attr_idx;
+/* alias flags to handle amd_fam17h, amd_fam17h_zen1 both present PMUs*/
+static int amd64_fam17h_zen1_present = 0;
+
/** @class find_existing_event
* @brief looks up an event, returns it if it exists
*
@@ -482,7 +485,13 @@ static struct native_event_t *allocate_native_event(
*
* @returns returns a libpfm event number
* @retval PAPI_ENOEVENT Could not find an event
- *
+ * Operational note: _pe_libpfm4_init() must be called first to set
+ * flags for synonymous PMUs. At this writing only
+ * amd64_fam17h_zen1_present is defined.
+ * Operational note: We indirectly return the pmu_idx within the
+ * event data; the calling code uses that to set
+ * pmu_idx for subsequent calls. All we do is find
+ * the next valid pmu, if any.
*/
static int
@@ -511,6 +520,12 @@ get_first_event_next_pmu(int pmu_idx, int pmu_type)
break;
}
+ if ((ret==PFM_SUCCESS) && amd64_fam17h_zen1_present && strcmp(pinfo.name, "amd64_fam17h") == 0) {
+ /* Skip as if invalid; we want the PMU amd64_fam17h_zen1 instead. */
+ pmu_idx++;
+ continue;
+ }
+
if ((ret==PFM_SUCCESS) && pmu_is_present_and_right_type(&pinfo,pmu_type)) {
pidx=pinfo.first_event;
@@ -1159,6 +1174,35 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
event_table->default_pmu.size = sizeof(pfm_pmu_info_t);
retval=pfm_get_pmu_info(0, &(event_table->default_pmu));
+ SUBDBG("Prescan for aliases.")
+ /* We have to see if we have aliases in there as separate PMUs, */
+ /* we don't want both PMUs with all the events duplicated. */
+ /* For aliases, either is valid alone, but if both are present */
+ /* specify a preference in the code. */
+ /* Alias: amd64_fam17h_zen1 over amd64_fam17h. */
+ /* Alias flags are static ints global to this file. */
+ i=0;
+ while(1) {
+ memset(&pinfo,0,sizeof(pfm_pmu_info_t));
+ pinfo.size = sizeof(pfm_pmu_info_t);
+ retval=pfm_get_pmu_info(i, &pinfo);
+
+ /* We're done if we hit an invalid PMU entry */
+ /* We can't check against PFM_PMU_MAX as that might not */
+ /* match if libpfm4 is dynamically linked */
+
+ if (retval==PFM_ERR_INVAL) {
+ break;
+ }
+
+ if ( (retval==PFM_SUCCESS) && (pinfo.name != NULL) &&
+ (pmu_is_present_and_right_type(&pinfo,pmu_type)) &&
+ (strcmp(pinfo.name,"amd64_fam17h_zen1") == 0) ) {
+ amd64_fam17h_zen1_present = 1;
+ }
+ i++;
+ }
+
SUBDBG("Detected pmus:\n");
i=0;
while(1) {
@@ -1177,6 +1221,12 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
if ((retval==PFM_SUCCESS) && (pinfo.name != NULL) &&
(pmu_is_present_and_right_type(&pinfo,pmu_type))) {
+ /* skip if it is amd64_fam17h and zen1 is also present. */
+ if (strcmp(pinfo.name,"amd64_fam17h") == 0 && amd64_fam17h_zen1_present) {
+ i++;
+ continue;
+ }
+
SUBDBG("\t%d %s %s %d\n",i,
pinfo.name,pinfo.desc,pinfo.type);
@@ -1193,11 +1243,9 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
/* Hack to have "default core" PMU */
if ( (pinfo.type==PFM_PMU_TYPE_CORE) &&
strcmp(pinfo.name,"ix86arch")) {
-
- SUBDBG("\t %s is default\n",pinfo.name);
- memcpy(&(event_table->default_pmu),
- &pinfo,sizeof(pfm_pmu_info_t));
- found_default++;
+ memcpy(&(event_table->default_pmu),
+ &pinfo,sizeof(pfm_pmu_info_t));
+ found_default++;
}
}
commit 79fe2a025afb8acb317032030c8847c9cbfd0162
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Tue Jan 5 13:45:34 2021 +0900
Get model_string for ARM processor from pfm_get_pmu_info() function
On ARM processors, the model_string does not appear in /proc/cpuinfo.
Instead of looking at the /proc/cpuinfo information, you can look at the lscpu command information at the following URL:.
https://github.com/google/cpu_features/issues/26
http://suihkulokki.blogspot.com/2018/02/making-sense-of-proccpuinfo-on-arm.html
The libpfm4 library identifies the ARM processor type from the "CPU implement" and "CPU part" in the /proc/cpuinfo information.
The papi library can use the pfm_get_pmu_info() function from the libpfm4 library to obtain a string identifying the ARM processor type.
diff --git a/src/components/perf_event/pe_libpfm4_events.c b/src/components/perf_event/pe_libpfm4_events.c
index a84819cc0..744851ff0 100644
--- a/src/components/perf_event/pe_libpfm4_events.c
+++ b/src/components/perf_event/pe_libpfm4_events.c
@@ -1149,6 +1149,7 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
pfm_err_t retval = PFM_SUCCESS;
pfm_pmu_info_t pinfo;
+ unsigned int strSize;
/* allocate the native event structure */
event_table->num_native_events=0;
@@ -1247,6 +1248,13 @@ _pe_libpfm4_init(papi_vector_t *component, int cidx,
&pinfo,sizeof(pfm_pmu_info_t));
found_default++;
}
+ if ( (pinfo.type==PFM_PMU_TYPE_CORE) &&
+ ( _papi_hwi_system_info.hw_info.vendor == PAPI_VENDOR_ARM)) {
+ if (strlen(_papi_hwi_system_info.hw_info.model_string) == 0) {
+ strSize = sizeof(_papi_hwi_system_info.hw_info.model_string);
+ strncpy( _papi_hwi_system_info.hw_info.model_string, pinfo.desc, strSize - 1);
+ }
+ }
}
if (pmu_type==PMU_TYPE_UNCORE) {
commit 85003c716d76eff47607fa0967537c6cf63d8348
Author: Steve Walk <swalk.cavium@gmail.com>
Date: Fri Jun 8 15:50:50 2018 -0400
enable Cavium ThunderX2 support
diff --git a/src/papi_events.csv b/src/papi_events.csv
index bb11f61d3..46827f180 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1841,6 +1841,31 @@ PRESET,PAPI_L2_DCR,NOT_DERIVED,L2D_READ_ACCESS
PRESET,PAPI_L2_DCW,NOT_DERIVED,L2D_WRITE_ACCESS
PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_READ_REFILL
PRESET,PAPI_L2_STM,NOT_DERIVED,L2D_WRITE_REFILL
+
+#####################
+# ARM ThunderX2 #
+#####################
+CPU,arm_thunderx2
+#
+PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED
+PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CYCLES
+PRESET,PAPI_FP_INS,NOT_DERIVED,VFP_SPEC
+PRESET,PAPI_VEC_INS,NOT_DERIVED,ASE_SPEC
+PRESET,PAPI_BR_INS,NOT_DERIVED,BR_RETIRED
+PRESET,PAPI_LD_INS,NOT_DERIVED,LD_RETIRED
+PRESET,PAPI_SR_INS,NOT_DERIVED,ST_RETIRED
+PRESET,PAPI_L1_DCA,DERIVED_ADD,L1D_CACHE_RD,L1D_CACHE_WR
+PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
+PRESET,PAPI_L1_DCR,NOT_DERIVED,L1D_CACHE_RD
+PRESET,PAPI_L1_DCW,NOT_DERIVED,L1D_CACHE_WR
+PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
+PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL
+PRESET,PAPI_L2_DCH,NOT_DERIVED,L2D_CACHE
+PRESET,PAPI_L2_DCM,NOT_DERIVED,L2D_CACHE_REFILL
+PRESET,PAPI_L2_DCR,NOT_DERIVED,L2D_CACHE_RD
+PRESET,PAPI_L2_DCW,NOT_DERIVED,L2D_CACHE_WR
+PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_CACHE_REFILL_RD
+
#
CPU,mips_74k
#
commit 9a44d82928ed17ba2ff21eb88b89c5829d0ea30e
Author: Steve Kaufmann <steven.kaufmann@hpe.com>
Date: Wed Jun 24 14:08:08 2020 -0400
Added PAPI preset support for Fujitsu A64FX.
Signed-off-by: Heike Jagode <jagode@icl.utk.edu>
diff --git a/src/papi_events.csv b/src/papi_events.csv
index 8e96adfbd..1b5c15542 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1877,6 +1877,21 @@ PRESET,PAPI_L2_DCR,NOT_DERIVED,L2D_CACHE_RD
PRESET,PAPI_L2_DCW,NOT_DERIVED,L2D_CACHE_WR
PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_CACHE_REFILL_RD
+#########################
+# ARM Fujitsu A64FX #
+#########################
+CPU,arm_a64fx
+#
+PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED
+PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CYCLES
+PRESET,PAPI_FP_INS,NOT_DERIVED,VFP_SPEC
+PRESET,PAPI_VEC_INS,NOT_DERIVED,ASE_SPEC
+PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
+PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
+PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL
+PRESET,PAPI_L2_DCH,NOT_DERIVED,L2D_CACHE
+PRESET,PAPI_L2_DCM,NOT_DERIVED,L2D_CACHE_REFILL
+
#
CPU,mips_74k
#
commit b87ac4beda096086e0040f8ec1b44c4791a9739c
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Mon Dec 14 14:06:22 2020 +0900
Corrected typo for A64FX support (PAPI_L2_DCH is a typo of PAPI_L2_DCA)
diff --git a/src/papi_events.csv b/src/papi_events.csv
index fd75f9371..164f05641 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1937,7 +1937,7 @@ PRESET,PAPI_VEC_INS,NOT_DERIVED,ASE_SPEC
PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL
-PRESET,PAPI_L2_DCH,NOT_DERIVED,L2D_CACHE
+PRESET,PAPI_L2_DCA,NOT_DERIVED,L2D_CACHE
PRESET,PAPI_L2_DCM,NOT_DERIVED,L2D_CACHE_REFILL
#
commit 869864f813f0681b5c9a4b65de2135c8708a2afb
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Mon Dec 14 19:34:59 2020 +0900
Add or modify various A64FX support events, including floating point events (PAPI_FP_OPS, PAPI_SP_OPS, PAPI_DP_OPS).
diff --git a/src/papi_events.csv b/src/papi_events.csv
index 164f05641..9192b1041 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1930,15 +1930,46 @@ PRESET,PAPI_L2_LDM,NOT_DERIVED,L2D_CACHE_REFILL_RD
#########################
CPU,arm_a64fx
#
+PRESET,PAPI_PRF_DM,DERIVED_SUB,L2D_CACHE_REFILL_PRF,L2D_CACHE_MIBMCH_PRF
+PRESET,PAPI_MEM_SCY,NOT_DERIVED,LD_COMP_WAIT_L2_MISS
+PRESET,PAPI_STL_ICY,DERIVED_ADD,STALL_FRONTEND,STALL_BACKEND
+PRESET,PAPI_STL_CCY,NOT_DERIVED,0INST_COMMIT
+PRESET,PAPI_FUL_CCY,DERIVED_SUB,CPU_CYCLES,0INST_COMMIT,1INST_COMMIT,2INST_COMMIT,3INST_COMMIT,4INST_COMMIT
+PRESET,PAPI_HW_INT,DERIVED_ADD,EXC_IRQ,EXC_FIQ
+PRESET,PAPI_BR_MSP,NOT_DERIVED,BR_MIS_PRED
+PRESET,PAPI_BR_PRC,DERIVED_SUB,BR_PRED,BR_MIS_PRED
+PRESET,PAPI_FMA_INS,NOT_DERIVED,FP_FMA_SPEC
PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED
PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CYCLES
PRESET,PAPI_FP_INS,NOT_DERIVED,VFP_SPEC
+PRESET,PAPI_LD_INS,NOT_DERIVED,LD_SPEC
+PRESET,PAPI_SR_INS,NOT_DERIVED,ST_SPEC
+PRESET,PAPI_BR_INS,NOT_DERIVED,BR_PRED
PRESET,PAPI_VEC_INS,NOT_DERIVED,ASE_SPEC
+PRESET,PAPI_RES_STL,NOT_DERIVED,STALL_BACKEND
+PRESET,PAPI_LST_INS,NOT_DERIVED,LDST_SPEC
+PRESET,PAPI_SYC_INS,DERIVED_ADD,ISB_SPEC,DSB_SPEC,DMB_SPEC
+PRESET,PAPI_L1_DCA,NOT_DERIVED,L1D_CACHE
+PRESET,PAPI_L1_DCH,DERIVED_SUB,L1D_CACHE,L1D_CACHE_REFILL
PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
+PRESET,PAPI_L1_ICH,DERIVED_SUB,L1I_CACHE,L1I_CACHE_REFILL
PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL
+PRESET,PAPI_L1_TCA,DERIVED_ADD,L1D_CACHE,L1I_CACHE
+PRESET,PAPI_L1_TCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|-|,L1D_CACHE,L1D_CACHE_REFILL,L1I_CACHE,L1I_CACHE_REFILL
+PRESET,PAPI_L1_TCM,DERIVED_ADD,L1D_CACHE_REFILL,L1I_CACHE_REFILL
PRESET,PAPI_L2_DCA,NOT_DERIVED,L2D_CACHE
-PRESET,PAPI_L2_DCM,NOT_DERIVED,L2D_CACHE_REFILL
+PRESET,PAPI_L2_DCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|+|,L2D_CACHE,L2D_CACHE_REFILL,L2D_SWAP_DM,L2D_CACHE_MIBMCH_PRF
+PRESET,PAPI_L2_DCM,DERIVED_SUB,L2D_CACHE_REFILL,L2D_SWAP_DM,L2D_CACHE_MIBMCH_PRF
+PRESET,PAPI_L2_TCA,NOT_DERIVED,L2D_CACHE
+PRESET,PAPI_L2_TCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|+|,L2D_CACHE,L2D_CACHE_REFILL,L2D_SWAP_DM,L2D_CACHE_MIBMCH_PRF
+PRESET,PAPI_L2_TCM,DERIVED_SUB,L2D_CACHE_REFILL,L2D_SWAP_DM,L2D_CACHE_MIBMCH_PRF
+PRESET,PAPI_TLB_DM,NOT_DERIVED,L2D_TLB_REFILL
+PRESET,PAPI_TLB_IM,NOT_DERIVED,L2I_TLB_REFILL
+PRESET,PAPI_TLB_TL,DERIVED_ADD,L2D_TLB_REFILL,L2I_TLB_REFILL
+PRESET,PAPI_FP_OPS,DERIVED_POSTFIX,N0|512|128|/|*|N1|+|,FP_SCALE_OPS_SPEC,FP_FIXED_OPS_SPEC
+PRESET,PAPI_SP_OPS,DERIVED_POSTFIX,N0|512|128|/|*|N1|+|,FP_SP_SCALE_OPS_SPEC,FP_SP_FIXED_OPS_SPEC
+PRESET,PAPI_DP_OPS,DERIVED_POSTFIX,N0|512|128|/|*|N1|+|,FP_DP_SCALE_OPS_SPEC,FP_DP_FIXED_OPS_SPEC
#
CPU,mips_74k
commit 7a3c22763ef2ba00a2b8cb069c3501f35ecb13de
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Tue Dec 15 13:43:43 2020 +0900
modify PAPI_FP_INS and PAPI_VEC_INS for A64FX supports
diff --git a/src/papi_events.csv b/src/papi_events.csv
index 9192b1041..7b4ceb674 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1941,11 +1941,11 @@ PRESET,PAPI_BR_PRC,DERIVED_SUB,BR_PRED,BR_MIS_PRED
PRESET,PAPI_FMA_INS,NOT_DERIVED,FP_FMA_SPEC
PRESET,PAPI_TOT_INS,NOT_DERIVED,INST_RETIRED
PRESET,PAPI_TOT_CYC,NOT_DERIVED,CPU_CYCLES
-PRESET,PAPI_FP_INS,NOT_DERIVED,VFP_SPEC
+PRESET,PAPI_FP_INS,NOT_DERIVED,FP_SPEC
PRESET,PAPI_LD_INS,NOT_DERIVED,LD_SPEC
PRESET,PAPI_SR_INS,NOT_DERIVED,ST_SPEC
PRESET,PAPI_BR_INS,NOT_DERIVED,BR_PRED
-PRESET,PAPI_VEC_INS,NOT_DERIVED,ASE_SPEC
+PRESET,PAPI_VEC_INS,NOT_DERIVED,SIMD_INST_RETIRED
PRESET,PAPI_RES_STL,NOT_DERIVED,STALL_BACKEND
PRESET,PAPI_LST_INS,NOT_DERIVED,LDST_SPEC
PRESET,PAPI_SYC_INS,DERIVED_ADD,ISB_SPEC,DSB_SPEC,DMB_SPEC
commit 530d4763fb8e6dd52109387bd58c8c1305fd6b63
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Fri Feb 12 15:01:21 2021 +0900
remove PAPI_L1_DCA and PAPI_L1_DCH for a64fx
There seems to be a problem with PAPI_L1_DCA and PAPI_L1_DCH for a64fx that prefetch overcounts.
I delete (comment out) PAPI_L1_DCA and PAPI_L1_DCH for a64fx from the papi_events.csv file.
I will issue the pullrequest again once I have identified how to handle the overcount.
diff --git a/src/papi_events.csv b/src/papi_events.csv
index 7b4ceb674..0f5ec8344 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1949,8 +1949,8 @@ PRESET,PAPI_VEC_INS,NOT_DERIVED,SIMD_INST_RETIRED
PRESET,PAPI_RES_STL,NOT_DERIVED,STALL_BACKEND
PRESET,PAPI_LST_INS,NOT_DERIVED,LDST_SPEC
PRESET,PAPI_SYC_INS,DERIVED_ADD,ISB_SPEC,DSB_SPEC,DMB_SPEC
-PRESET,PAPI_L1_DCA,NOT_DERIVED,L1D_CACHE
-PRESET,PAPI_L1_DCH,DERIVED_SUB,L1D_CACHE,L1D_CACHE_REFILL
+#PRESET,PAPI_L1_DCA,NOT_DERIVED,L1D_CACHE
+#PRESET,PAPI_L1_DCH,DERIVED_SUB,L1D_CACHE,L1D_CACHE_REFILL
PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
PRESET,PAPI_L1_ICH,DERIVED_SUB,L1I_CACHE,L1I_CACHE_REFILL
commit 340f68940234f2db181147fc249907b4f1293e62
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Tue Feb 16 17:16:24 2021 +0900
remove PAPI_L1_TCA and PAPI_L1_TCH for a64fx
PAPI_L1_TCA and PAPI_L1_TCH for a64fx measure L1D_CACHE just like PAPI_L1_DCA and PAPI_L1_DCH,
so I delete (comment out) PAPI_L1_TCA and PAPI_L1_TCH for a64fx from the papi_events.csv file.
diff --git a/src/papi_events.csv b/src/papi_events.csv
index 0f5ec8344..4ef647959 100644
--- a/src/papi_events.csv
+++ b/src/papi_events.csv
@@ -1955,8 +1955,8 @@ PRESET,PAPI_L1_DCM,NOT_DERIVED,L1D_CACHE_REFILL
PRESET,PAPI_L1_ICA,NOT_DERIVED,L1I_CACHE
PRESET,PAPI_L1_ICH,DERIVED_SUB,L1I_CACHE,L1I_CACHE_REFILL
PRESET,PAPI_L1_ICM,NOT_DERIVED,L1I_CACHE_REFILL
-PRESET,PAPI_L1_TCA,DERIVED_ADD,L1D_CACHE,L1I_CACHE
-PRESET,PAPI_L1_TCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|-|,L1D_CACHE,L1D_CACHE_REFILL,L1I_CACHE,L1I_CACHE_REFILL
+#PRESET,PAPI_L1_TCA,DERIVED_ADD,L1D_CACHE,L1I_CACHE
+#PRESET,PAPI_L1_TCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|-|,L1D_CACHE,L1D_CACHE_REFILL,L1I_CACHE,L1I_CACHE_REFILL
PRESET,PAPI_L1_TCM,DERIVED_ADD,L1D_CACHE_REFILL,L1I_CACHE_REFILL
PRESET,PAPI_L2_DCA,NOT_DERIVED,L2D_CACHE
PRESET,PAPI_L2_DCH,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|+|,L2D_CACHE,L2D_CACHE_REFILL,L2D_SWAP_DM,L2D_CACHE_MIBMCH_PRF

43
papi-divzero.patch Normal file
View File

@ -0,0 +1,43 @@
commit 7a6ae407b62615d3ffa9b0d2ac17771b7fc63056
Author: Vince Weaver <vince@deater.net>
Date: Thu Sep 27 23:47:58 2018 -0400
perf_event: avoid floating point exception if running is 0
The perf_event interface isn't supposed to return 0 for running, but
it happens occasionally. So be sure not to divide by zero if this
happens. This makes the rdpmc code match the generic perf code in this
case.
This is in response to bitbucket issue #52
diff --git a/src/components/perf_event/perf_event.c b/src/components/perf_event/perf_event.c
index 7fd753ed..82b7d398 100644
--- a/src/components/perf_event/perf_event.c
+++ b/src/components/perf_event/perf_event.c
@@ -1099,14 +1099,23 @@ _pe_rdpmc_read( hwd_context_t *ctx, hwd_control_state_t *ctl,
count = mmap_read_self(pe_ctl->events[i].mmap_buf,
&enabled,&running);
- /* TODO: error checking? */
+ /* TODO: more error checking? */
/* Handle multiplexing case */
- if (enabled!=running) {
+ if (enabled == running) {
+ /* no adjustment needed */
+ }
+ else if (enabled && running) {
adjusted = (enabled * 128LL) / running;
adjusted = adjusted * count;
adjusted = adjusted / 128LL;
count = adjusted;
+ } else {
+ /* This should not happen, but we have had it reported */
+ SUBDBG("perf_event kernel bug(?) count, enabled, "
+ "running: %lld, %lld, %lld\n",
+ papi_pe_buffer[0],enabled,running);
+
}
pe_ctl->counts[i] = count;

115
papi-ldflags.patch Normal file
View File

@ -0,0 +1,115 @@
commit bde3da26f1f2755689e16fc9f5ab404367d1fdc8
Author: Vince Weaver <vincent.weaver@maine.edu>
Date: Wed Jan 24 14:13:28 2018 -0500
build: fix various LDFLAGS/CFLAGS issues
issues were reported by Andreas Beckmann <anbe@debian.org>
diff --git a/src/components/Makefile_comp_tests.target.in b/src/components/Makefile_comp_tests.target.in
index 9a369adb..a4412bea 100644
--- a/src/components/Makefile_comp_tests.target.in
+++ b/src/components/Makefile_comp_tests.target.in
@@ -9,7 +9,7 @@ INCLUDE = -I. -I@includedir@ -I$(datadir) -I$(testlibdir) -I$(validationlibdir)
LIBDIR = @libdir@
PAPILIB = $(datadir)/@LIBRARY@
TESTLIB = $(testlibdir)/libtestlib.a
-LDFLAGS = @LDL@
+LDFLAGS = @LDFLAGS@ @LDL@
CC = @CC@
F77 = @F77@
CC_R = @CC_R@
diff --git a/src/components/perf_event_uncore/tests/Makefile b/src/components/perf_event_uncore/tests/Makefile
index 3ee8fc2a..d70debe6 100644
--- a/src/components/perf_event_uncore/tests/Makefile
+++ b/src/components/perf_event_uncore/tests/Makefile
@@ -17,19 +17,19 @@ perf_event_uncore_lib.o: perf_event_uncore_lib.c perf_event_uncore_lib.h
perf_event_amd_northbridge: perf_event_amd_northbridge.o $(DOLOOPS) $(UTILOBJS) $(PAPILIB) $(DOLOOPS)
- $(CC) $(LFLAGS) -o perf_event_amd_northbridge perf_event_amd_northbridge.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
+ $(CC) $(CFLAGS) -o perf_event_amd_northbridge perf_event_amd_northbridge.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
perf_event_uncore: perf_event_uncore.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) perf_event_uncore_lib.o
- $(CC) $(LFLAGS) -o perf_event_uncore perf_event_uncore.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
+ $(CC) $(CFLAGS) -o perf_event_uncore perf_event_uncore.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
perf_event_uncore_attach: perf_event_uncore_attach.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) perf_event_uncore_lib.o
- $(CC) $(LFLAGS) -o perf_event_uncore_attach perf_event_uncore_attach.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
+ $(CC) $(CFLAGS) -o perf_event_uncore_attach perf_event_uncore_attach.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
perf_event_uncore_multiple: perf_event_uncore_multiple.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB)
- $(CC) $(LFLAGS) $(INCLUDE) -o perf_event_uncore_multiple perf_event_uncore_multiple.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
+ $(CC) $(CFLAGS) $(INCLUDE) -o perf_event_uncore_multiple perf_event_uncore_multiple.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
perf_event_uncore_cbox: perf_event_uncore_cbox.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB)
- $(CC) $(LFLAGS) $(INCLUDE) -o perf_event_uncore_cbox perf_event_uncore_cbox.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
+ $(CC) $(CFLAGS) $(INCLUDE) -o perf_event_uncore_cbox perf_event_uncore_cbox.o perf_event_uncore_lib.o $(UTILOBJS) $(DOLOOPS) $(PAPILIB) $(LDFLAGS)
diff --git a/src/ctests/Makefile.recipies b/src/ctests/Makefile.recipies
index 63c107c0..201f3c85 100644
--- a/src/ctests/Makefile.recipies
+++ b/src/ctests/Makefile.recipies
@@ -350,7 +350,7 @@ code2name: code2name.c $(TESTLIB) $(PAPILIB)
$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) code2name.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o code2name
attach_target: attach_target.c $(DOLOOPS)
- -$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) attach_target.c -o attach_target $(DOLOOPS) $(TESTLIB)
+ -$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) attach_target.c -o attach_target $(DOLOOPS) $(TESTLIB) $(LDFLAGS)
zero_attach: zero_attach.c $(TESTLIB) $(DOLOOPS) $(PAPILIB)
-$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) zero_attach.c $(TESTLIB) $(DOLOOPS) $(PAPILIB) $(LDFLAGS) -o zero_attach
diff --git a/src/ctests/Makefile.target.in b/src/ctests/Makefile.target.in
index bb51c350..fcc3373b 100644
--- a/src/ctests/Makefile.target.in
+++ b/src/ctests/Makefile.target.in
@@ -12,7 +12,7 @@ LIBRARY=@LIBRARY@
SHLIB=@SHLIB@
PAPILIB = ../@LINKLIB@
TESTLIB = $(testlibdir)/libtestlib.a
-LDFLAGS = @LDL@ @STATIC@
+LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@
CC = @CC@
MPICC = @MPICC@
F77 = @F77@
diff --git a/src/ftests/Makefile.target.in b/src/ftests/Makefile.target.in
index 718586e5..8006dd8d 100644
--- a/src/ftests/Makefile.target.in
+++ b/src/ftests/Makefile.target.in
@@ -11,7 +11,7 @@ LIBRARY = @LIBRARY@
SHLIB=@SHLIB@
PAPILIB = ../@LINKLIB@
TESTLIB = $(testlibdir)/libtestlib.a
-LDFLAGS = @LDL@
+LDFLAGS = @LDFLAGS@ @LDL@
CC = @CC@
F77 = @F77@
CC_R = @CC_R@
diff --git a/src/utils/Makefile.target.in b/src/utils/Makefile.target.in
index a5eab438..58d438a1 100644
--- a/src/utils/Makefile.target.in
+++ b/src/utils/Makefile.target.in
@@ -11,7 +11,7 @@ LIBRARY=@LIBRARY@
SHLIB=@SHLIB@
PAPILIB = ../@LINKLIB@
TESTLIB = $(testlibdir)/libtestlib.a
-LDFLAGS = @LDL@ @STATIC@
+LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@
CC = @CC@
MPICC = @MPICC@
F77 = @F77@
diff --git a/src/validation_tests/Makefile.target.in b/src/validation_tests/Makefile.target.in
index a5eab438..58d438a1 100644
--- a/src/validation_tests/Makefile.target.in
+++ b/src/validation_tests/Makefile.target.in
@@ -11,7 +11,7 @@ LIBRARY=@LIBRARY@
SHLIB=@SHLIB@
PAPILIB = ../@LINKLIB@
TESTLIB = $(testlibdir)/libtestlib.a
-LDFLAGS = @LDL@ @STATIC@
+LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@
CC = @CC@
MPICC = @MPICC@
F77 = @F77@

144
papi-mx.patch Normal file
View File

@ -0,0 +1,144 @@
commit 3a6c9a855195e6f6f44ad6dffe2cd4046426ab53
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Wed Nov 25 21:46:26 2020 +0900
fix for performance improvement of _mx_init_component() function
diff --git a/src/components/mx/linux-mx.c b/src/components/mx/linux-mx.c
index 2da406d14..34e6f02c2 100644
--- a/src/components/mx/linux-mx.c
+++ b/src/components/mx/linux-mx.c
@@ -224,26 +224,35 @@ _mx_init_component( int cidx )
{
FILE *fff;
- char test_string[BUFSIZ];
+ char *path;
+ int len, pathlen;
/* detect if MX available */
- strncpy(mx_counters_exe,"mx_counters 2> /dev/null",BUFSIZ);
- fff=popen(mx_counters_exe,"r");
- /* popen only returns NULL if "sh" fails, not the actual command */
- if (fgets(test_string,BUFSIZ,fff)==NULL) {
- pclose(fff);
- strncpy(mx_counters_exe,"./components/mx/utils/fake_mx_counters 2> /dev/null",BUFSIZ);
- fff=popen(mx_counters_exe,"r");
- if (fgets(test_string,BUFSIZ,fff)==NULL) {
- pclose(fff);
- /* neither real nor fake found */
- strncpy(_mx_vector.cmp_info.disabled_reason,
- "No MX utilities found",PAPI_MAX_STR_LEN);
- return PAPI_ECMP;
+ path = getenv("PATH");
+ pathlen = strlen(path);
+ while(pathlen > 0) {
+ len = strcspn(path, ":");
+ strncpy(mx_counters_exe, path, len);
+ mx_counters_exe[len] = '\0';
+ strcat(mx_counters_exe, "/mx_counters");
+ fff = fopen(mx_counters_exe, "r");
+ if (fff != NULL) {
+ strcat(mx_counters_exe, " 2> /dev/null");
+ break;
}
+ pathlen = pathlen - len - 1;
+ if (pathlen > 0) {
+ path = path + len + 1;
+ }
+ }
+ if (fff == NULL) {
+ /* neither real nor fake found */
+ strncpy(_mx_vector.cmp_info.disabled_reason,
+ "No MX utilities found",PAPI_MAX_STR_LEN);
+ return PAPI_ECMP;
}
- pclose(fff);
+ fclose(fff);
num_events=MX_MAX_COUNTERS;
_mx_vector.cmp_info.num_native_events=num_events;
commit 3a2560a86be44f4b15d96a45eda8e7f387b9166c
Author: Masahiko, Yamada <yamada.masahiko@fujitsu.com>
Date: Tue Jan 26 16:30:40 2021 +0900
Add string length check before strncpy() and strcat() calls in _mx_init_component()
Myrinet Express-related component MX modules are initialized with the _mx_init_component() function,
which is called from the PAPI_library_init() function.
The popen(3) call runs a loadable module called "mx_counters",
and if the loadable module does not exist,
it attempts to run a loadable module called "./components/mx/utils/fake_mx_counters".
In an environment where there are no "mx_counters" and "./components/mx/utils/fake_mx_counters" loadable modules,
popen(3) will be called twice uselessly.
popen(3) internally calls pipe(2) once, fork(2) twice and exec(2) once.
The size of the user space of the application calling the PAPI_library_init() function affects the performance of fork(2),
which is called as an extension of popen(3).
As a result, the performance of the PAPI_library_init() function is affected by the amount of user space in the application
that called the PAPI_library_init() function.
In the _mx_init_component() function,
the MX module only needs to be able to verify that a load module named "mx_counters" exists.
We improved the _mx_init_component() function to call fopen(3) instead of popen(3).
We add string length check before strncpy() and strcat() calls in _mx_init_component() function.
diff --git a/src/components/mx/linux-mx.c b/src/components/mx/linux-mx.c
index 34e6f02c2..c2920d65b 100644
--- a/src/components/mx/linux-mx.c
+++ b/src/components/mx/linux-mx.c
@@ -225,7 +225,7 @@ _mx_init_component( int cidx )
FILE *fff;
char *path;
- int len, pathlen;
+ int checklen, len, pathlen;
/* detect if MX available */
@@ -233,13 +233,31 @@ _mx_init_component( int cidx )
pathlen = strlen(path);
while(pathlen > 0) {
len = strcspn(path, ":");
- strncpy(mx_counters_exe, path, len);
+ if (len < BUFSIZ) {
+ strncpy(mx_counters_exe, path, len);
+ } else {
+ fff = NULL;
+ break;
+ }
mx_counters_exe[len] = '\0';
- strcat(mx_counters_exe, "/mx_counters");
+ checklen = len + strlen("/mx_counters");
+ if (checklen < BUFSIZ) {
+ strcat(mx_counters_exe, "/mx_counters");
+ } else {
+ fff = NULL;
+ break;
+ }
fff = fopen(mx_counters_exe, "r");
if (fff != NULL) {
- strcat(mx_counters_exe, " 2> /dev/null");
- break;
+ checklen = checklen + strlen(" 2> /dev/null");
+ if (checklen < BUFSIZ) {
+ strcat(mx_counters_exe, " 2> /dev/null");
+ break;
+ } else {
+ fclose(fff);
+ fff = NULL;
+ break;
+ }
}
pathlen = pathlen - len - 1;
if (pathlen > 0) {
@@ -247,7 +265,7 @@ _mx_init_component( int cidx )
}
}
if (fff == NULL) {
- /* neither real nor fake found */
+ /* mx_counters not found */
strncpy(_mx_vector.cmp_info.disabled_reason,
"No MX utilities found",PAPI_MAX_STR_LEN);
return PAPI_ECMP;

607
papi-rhbz1807346.patch Normal file
View File

@ -0,0 +1,607 @@
commit 660bfd20bc89a26629e99de958d38b031db4250d
Author: William Cohen <wcohen@redhat.com>
Date: Thu Oct 31 15:30:00 2019 -0400
This code is a modification of krentel_pthreads.c, to better test
some race conditions. It is not included in the standard tests;
it is a diagnostic that should be run with "valgrind --tool=helgrind".
Signed-off-by: Anthony Castaldo <TonyCastaldo@icl.utk.edu>
diff --git a/src/ctests/krentel_pthreads_race.c b/src/ctests/krentel_pthreads_race.c
new file mode 100644
index 000000000..0ebfb5056
--- /dev/null
+++ b/src/ctests/krentel_pthreads_race.c
@@ -0,0 +1,236 @@
+/*
+ * Test PAPI with multiple threads.
+ * This code is a modification of krentel_pthreads.c by William Cohen
+ * <wcohen@redhat.com>, on Sep 10 2019, to exercise and test for the race
+ * condition in papi_internal.c involving the formerly static variables
+ * papi_event_code and papi_event_code_changed. This code should be run with
+ * "valgrind --tool=helgrind" to show any data races. If run with:
+ * "valgrind --tool=helgrind --log-file=helgrind_out.txt"
+ * The output will be captured in helgrind_out.txt and can then be processed
+ * with the program filter_helgrind.c; see commentary at the top of that file.
+ */
+
+#define MAX_THREADS 256
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <sys/time.h>
+
+#include "papi.h"
+#include "papi_test.h"
+
+#define EVENT PAPI_TOT_CYC
+
+static int program_time = 5;
+static int threshold = 20000000;
+static int num_threads = 3;
+
+static long count[MAX_THREADS];
+static long iter[MAX_THREADS];
+static struct timeval last[MAX_THREADS];
+
+static pthread_key_t key;
+
+static struct timeval start;
+
+static void
+my_handler( int EventSet, void *pc, long long ovec, void *context )
+{
+ ( void ) EventSet;
+ ( void ) pc;
+ ( void ) ovec;
+ ( void ) context;
+
+ long num = ( long ) pthread_getspecific( key );
+
+ if ( num < 0 || num > num_threads )
+ test_fail( __FILE__, __LINE__, "getspecific failed", 1 );
+ count[num]++;
+}
+
+static void
+print_rate( long num )
+{
+ struct timeval now;
+ long st_secs;
+ double last_secs;
+
+ gettimeofday( &now, NULL );
+ st_secs = now.tv_sec - start.tv_sec;
+ last_secs = ( double ) ( now.tv_sec - last[num].tv_sec )
+ + ( ( double ) ( now.tv_usec - last[num].tv_usec ) ) / 1000000.0;
+ if ( last_secs <= 0.001 )
+ last_secs = 0.001;
+
+ if (!TESTS_QUIET) {
+ printf( "[%ld] time = %ld, count = %ld, iter = %ld, "
+ "rate = %.1f/Kiter\n",
+ num, st_secs, count[num], iter[num],
+ ( 1000.0 * ( double ) count[num] ) / ( double ) iter[num] );
+ }
+
+ count[num] = 0;
+ iter[num] = 0;
+ last[num] = now;
+}
+
+static void
+do_cycles( long num, int len )
+{
+ struct timeval start, now;
+ double x, sum;
+
+ gettimeofday( &start, NULL );
+
+ for ( ;; ) {
+ sum = 1.0;
+ for ( x = 1.0; x < 250000.0; x += 1.0 )
+ sum += x;
+ if ( sum < 0.0 )
+ printf( "==>> SUM IS NEGATIVE !! <<==\n" );
+
+ iter[num]++;
+
+ gettimeofday( &now, NULL );
+ if ( now.tv_sec >= start.tv_sec + len )
+ break;
+ }
+}
+
+static void *
+my_thread( void *v )
+{
+ long num = ( long ) v;
+ int n;
+ int EventSet = PAPI_NULL;
+ int event_code;
+ long long value;
+
+ int retval;
+
+ retval = PAPI_register_thread( );
+ if ( retval != PAPI_OK ) {
+ test_fail( __FILE__, __LINE__, "PAPI_register_thread", retval );
+ }
+ pthread_setspecific( key, v );
+
+ count[num] = 0;
+ iter[num] = 0;
+ last[num] = start;
+
+ retval = PAPI_create_eventset( &EventSet );
+ if ( retval != PAPI_OK ) {
+ test_fail( __FILE__, __LINE__, "PAPI_create_eventset failed", retval );
+ }
+
+ retval = PAPI_event_name_to_code("PAPI_TOT_CYC", &event_code);
+ if (retval != PAPI_OK ) {
+ if (!TESTS_QUIET) printf("Trouble creating event name\n");
+ test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code failed", retval );
+ }
+
+ retval = PAPI_add_event( EventSet, EVENT );
+ if (retval != PAPI_OK ) {
+ if (!TESTS_QUIET) printf("Trouble adding event\n");
+ test_fail( __FILE__, __LINE__, "PAPI_add_event failed", retval );
+ }
+
+ if ( PAPI_overflow( EventSet, EVENT, threshold, 0, my_handler ) != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_overflow failed", 1 );
+
+ if ( PAPI_start( EventSet ) != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_start failed", 1 );
+
+ if (!TESTS_QUIET) printf( "launched timer in thread %ld\n", num );
+
+ for ( n = 1; n <= program_time; n++ ) {
+ do_cycles( num, 1 );
+ print_rate( num );
+ }
+
+ PAPI_stop( EventSet, &value );
+
+ retval = PAPI_overflow( EventSet, EVENT, 0, 0, my_handler);
+ if ( retval != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_overflow failed to reset the overflow handler", retval );
+
+ if ( PAPI_remove_event( EventSet, EVENT ) != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_remove_event", 1 );
+
+ if ( PAPI_destroy_eventset( &EventSet ) != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_destroy_eventset", 1 );
+
+ if ( PAPI_unregister_thread( ) != PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_unregister_thread", 1 );
+
+ return ( NULL );
+}
+
+int
+main( int argc, char **argv )
+{
+ pthread_t *td = NULL;
+ long n;
+ int quiet,retval;
+
+ /* Set TESTS_QUIET variable */
+ quiet=tests_quiet( argc, argv );
+
+ if ( argc < 2 || sscanf( argv[1], "%d", &program_time ) < 1 )
+ program_time = 6;
+ if ( argc < 3 || sscanf( argv[2], "%d", &threshold ) < 1 )
+ threshold = 20000000;
+ if ( argc < 4 || sscanf( argv[3], "%d", &num_threads ) < 1 )
+ num_threads = 32;
+
+ td = malloc((num_threads+1) * sizeof(pthread_t));
+ if (!td) {
+ test_fail( __FILE__, __LINE__, "td malloc failed", 1 );
+ }
+
+ if (!quiet) {
+ printf( "program_time = %d, threshold = %d, num_threads = %d\n\n",
+ program_time, threshold, num_threads );
+ }
+
+ if ( PAPI_library_init( PAPI_VER_CURRENT ) != PAPI_VER_CURRENT )
+ test_fail( __FILE__, __LINE__, "PAPI_library_init failed", 1 );
+
+ /* Test to be sure we can add events */
+ retval = PAPI_query_event( EVENT );
+ if (retval!=PAPI_OK) {
+ if (!quiet) printf("Trouble finding event\n");
+ test_skip(__FILE__,__LINE__,"Event not available",1);
+ }
+
+ if ( PAPI_thread_init( ( unsigned long ( * )( void ) ) ( pthread_self ) ) !=
+ PAPI_OK )
+ test_fail( __FILE__, __LINE__, "PAPI_thread_init failed", 1 );
+
+ if ( pthread_key_create( &key, NULL ) != 0 )
+ test_fail( __FILE__, __LINE__, "pthread key create failed", 1 );
+
+ gettimeofday( &start, NULL );
+
+ for ( n = 1; n <= num_threads; n++ ) {
+ if ( pthread_create( &(td[n]), NULL, my_thread, ( void * ) n ) != 0 )
+ test_fail( __FILE__, __LINE__, "pthread create failed", 1 );
+ }
+
+ my_thread( ( void * ) 0 );
+
+ /* wait for all the threads */
+ for ( n = 1; n <= num_threads; n++ ) {
+ if ( pthread_join( td[n], NULL))
+ test_fail( __FILE__, __LINE__, "pthread join failed", 1 );
+ }
+
+ free(td);
+
+ if (!quiet) printf( "done\n" );
+
+ test_pass( __FILE__ );
+
+ return 0;
+}
commit 979e80136fd5e0ee2fb26f7374b36a8433147a68
Author: Anthony Castaldo <TonyCastaldo@icl.utk.edu>
Date: Thu Oct 31 15:56:55 2019 -0400
The changes to papi.c, papi_internal.c, threads.h and threads.c
correct a race condition that was the result of all threads using
the same two static variables (papi_event_code and papi_event_code_changed)
to temporarily record a state of operation. The solution was to
make these variables unique per thread, using the ThreadInfo_t
structure already provided in PAPI for such purposes. The file
krentel_pthread_race.c is a stress test to produce race conditions.
filter_helgrind.c reduces the volume of --tool-helgrind output to
a more manageable summary. Both are added to Makefile.recipies.
diff --git a/src/ctests/Makefile.recipies b/src/ctests/Makefile.recipies
index 87340831d..b7c1963d7 100644
--- a/src/ctests/Makefile.recipies
+++ b/src/ctests/Makefile.recipies
@@ -161,6 +161,12 @@ locks_pthreads: locks_pthreads.c $(TESTLIB) $(PAPILIB)
krentel_pthreads: krentel_pthreads.c $(TESTLIB) $(PAPILIB)
$(CC_R) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) krentel_pthreads.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o krentel_pthreads -lpthread
+# krentel_pthreads_race is not included with the standard tests;
+# it is a modification of krentel_pthreads intended to be run with
+# "valgrind --tool=helgrind" to test for race conditions.
+krentel_pthreads_race: krentel_pthreads_race.c $(TESTLIB) $(PAPILIB)
+ $(CC_R) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) krentel_pthreads_race.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o krentel_pthreads_race -lpthread
+
overflow_pthreads: overflow_pthreads.c $(TESTLIB) $(DOLOOPS) $(PAPILIB)
$(CC_R) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) overflow_pthreads.c $(TESTLIB) $(DOLOOPS) $(PAPILIB) $(LDFLAGS) -o overflow_pthreads -lpthread
@@ -434,6 +440,9 @@ forkexec4: forkexec4.c $(TESTLIB) $(PAPILIB)
prof_utils.o: prof_utils.c $(testlibdir)/papi_test.h prof_utils.h
$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) -c prof_utils.c
+filter_helgrind: filter_helgrind.c $(TESTLIB) $(PAPILIB)
+ -$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) filter_helgrind.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o filter_helgrind
+
.PHONY : all default ctests ctest clean
clean:
diff --git a/src/ctests/filter_helgrind.c b/src/ctests/filter_helgrind.c
new file mode 100644
index 000000000..d918a789e
--- /dev/null
+++ b/src/ctests/filter_helgrind.c
@@ -0,0 +1,170 @@
+/*
+ * This code is a simple filter for the helgrind_out.txt file
+ * produced by:
+ * "valgrind --tool=helgrind --log-file=helgrind_out.txt someProgram"
+ *
+ * This is useful because the tool does not recognize PAPI locks,
+ * thus reports as possible race conditions reads/writes by
+ * different threads that are actually fine (surrounded by locks).
+ *
+ * This was written particularly for krentel_pthreads_race.c
+ * when processed by the above valgrind. We produce a line per
+ * condition, in the form:
+ * OP@file:line OP@file:line
+ * where OP is R or W. The first file:line code occurred
+ * after the second file:line code, and on a different thread.
+ *
+ * We print the results to stdout. It is useful to filter this
+ * through the standard utility 'uniq', each occurrence only
+ * needs to be investigated once. Just insure there are
+ * MATCHING locks around each operation within the code.
+ *
+ * An example run (using uniq): The options -uc will print
+ * only unique lines, preceeded by a count of how many times
+ * it occurs.
+ *
+ * ./filter_helgrind | uniq -uc
+ *
+ * An example output line (piped through uniq as above):
+ * 1 R@threads.c:190 W@threads.c:206
+ * An investigation shows threads.c:190 is protected by
+ * _papi_hwi_lock(THREADS_LOCK); and threads.c:206 is
+ * protected by the same lock. Thus no data race can
+ * occur for this instance.
+ *
+ * Compilation within the papi/src/ctests directory:
+ * make filter_helgrind
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char** args) {
+ (void) argc;
+ (void) args;
+
+ char myLine[16384];
+ int state, size;
+ char type1, type2;
+ char fname1[256], fname2[256];
+ char *paren1, *paren2;
+
+ FILE *HELOUT = fopen("helgrind_out.txt", "r"); // Read the file.
+ if (HELOUT == NULL) {
+ fprintf(stderr, "Could not open helgrind_out.txt.\n");
+ exit(-1);
+ }
+
+ char PDRR[]="Possible data race during read";
+ char PDRW[]="Possible data race during write";
+ char TCWW[]="This conflicts with a previous write";
+ char TCWR[]="This conflicts with a previous read";
+ char atSTR[]=" at ";
+
+ // State machine:
+ // State 0: We are looking for a line with PDRR or PDRW.
+ // We don't exit until we find it, or run out of lines.
+ // if we find it, we remember which and go to state 1.
+ // State 1: Looking for " at " in column 11.
+ // When found, we extract the string betweeen '(' and ')'
+ // which is program name:line. go to state 2.
+ // State 2: We are searching for TCWW, TCWR, PDRW, PDRR.
+ // If we find the first two:
+ // Remember which, and go to state 3.
+ // If we find either of the second two, go back to State 1.
+ // State 3: Looking for " at " in column 11.
+ // When found, extract the string betweeen '(' and ')',
+ // which is program name:line.
+ // OUTPUT LINE for an investigation.
+ // Go to State 0.
+
+ state = 0; // looking for PDRR, PDRW.
+ while (fgets(myLine, 16384, HELOUT) != NULL) {
+ if (strlen(myLine) < 20) continue;
+ switch (state) {
+ case 0: // Looking for PDRR or PRDW.
+ if (strstr(myLine, PDRR) != NULL) {
+ type1='R';
+ state=1;
+ continue;
+ }
+
+ if (strstr(myLine, PDRW) != NULL) {
+ type1='W';
+ state=1;
+ continue;
+ }
+
+ continue;
+ break;
+
+ case 1: // Looking for atSTR in column 11.
+ if (strncmp(myLine+10, atSTR, 6) != 0) continue;
+ paren1=strchr(myLine, '(');
+ paren2=strchr(myLine, ')');
+ if (paren1 == NULL || paren2 == NULL ||
+ paren1 > paren2) {
+ state=0; // Abort, found something I don't understand.
+ continue;
+ }
+
+ size = paren2-paren1-1; // compute length of name.
+ strncpy(fname1, paren1+1, size); // Copy the name.
+ fname1[size]=0; // install z-terminator.
+ state=2;
+ continue;
+ break;
+
+ case 2: // Looking for TCWW, TCWR, PDRR, PDRW.
+ if (strstr(myLine, TCWR) != NULL) {
+ type2='R';
+ state=3;
+ continue;
+ }
+
+ if (strstr(myLine, TCWW) != NULL) {
+ type2='W';
+ state=3;
+ continue;
+ }
+
+ if (strstr(myLine, PDRR) != NULL) {
+ type1='R';
+ state=1;
+ continue;
+ }
+
+ if (strstr(myLine, PDRW) != NULL) {
+ type1='W';
+ state=1;
+ continue;
+ }
+
+ continue;
+ break;
+
+ case 3: // Looking for atSTR in column 11.
+ if (strncmp(myLine+10, atSTR, 6) != 0) continue;
+ paren1=strchr(myLine, '(');
+ paren2=strchr(myLine, ')');
+ if (paren1 == NULL || paren2 == NULL ||
+ paren1 > paren2) {
+ state=0; // Abort, found something I don't understand.
+ continue;
+ }
+
+ size = paren2-paren1-1; // compute length of name.
+ strncpy(fname2, paren1+1, size); // Copy the name.
+ fname2[size]=0; // install z-terminator.
+ fprintf(stdout, "%c@%-32s %c@%-32s\n", type1, fname1, type2, fname2);
+ state=0;
+ continue;
+ break;
+ } // end switch.
+ } // end while.
+
+ fclose(HELOUT);
+ exit(0);
+}
diff --git a/src/papi.c b/src/papi.c
index 4e08dc840..070e3f8c6 100644
--- a/src/papi.c
+++ b/src/papi.c
@@ -608,32 +608,26 @@ PAPI_library_init( int version )
papi_return( init_retval );
}
- /* Initialize component globals */
+ /* Initialize thread globals, including the main threads */
- tmp = _papi_hwi_init_global( );
+ tmp = _papi_hwi_init_global_threads( );
if ( tmp ) {
init_retval = tmp;
_papi_hwi_shutdown_global_internal( );
- _in_papi_library_init_cnt--;
+ _in_papi_library_init_cnt--;
papi_return( init_retval );
}
-
- /* Initialize thread globals, including the main threads */
- tmp = _papi_hwi_init_global_threads( );
+ /* Initialize component globals */
+
+ tmp = _papi_hwi_init_global( );
if ( tmp ) {
- int i;
init_retval = tmp;
_papi_hwi_shutdown_global_internal( );
- for ( i = 0; i < papi_num_components; i++ ) {
- if (!_papi_hwd[i]->cmp_info.disabled) {
- _papi_hwd[i]->shutdown_component( );
- }
- }
_in_papi_library_init_cnt--;
papi_return( init_retval );
}
-
+
init_level = PAPI_LOW_LEVEL_INITED;
_in_papi_library_init_cnt--;
diff --git a/src/papi_internal.c b/src/papi_internal.c
index 2412eca63..f0e457bf7 100644
--- a/src/papi_internal.c
+++ b/src/papi_internal.c
@@ -111,31 +111,28 @@ _papi_hwi_free_papi_event_string() {
}
return;
}
-// A place to keep the current papi event code so some component functions can fetch its value
-// The current event code can be stored here prior to component calls and cleared after the component returns
-static unsigned int papi_event_code = -1;
-static int papi_event_code_changed = -1;
+
void
_papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) {
INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
// if call is just to reset and start over, set both flags to show nothing saved yet
if (update_flag < 0) {
- papi_event_code_changed = -1;
- papi_event_code = -1;
+ _papi_hwi_my_thread->tls_papi_event_code_changed = -1;
+ _papi_hwi_my_thread->tls_papi_event_code = -1;
return;
}
// if 0, it is being set prior to calling a component, if >0 it is being changed by the component
- papi_event_code_changed = update_flag;
+ _papi_hwi_my_thread->tls_papi_event_code_changed = update_flag;
// save the event code passed in
- papi_event_code = event_code;
+ _papi_hwi_my_thread->tls_papi_event_code = event_code;
return;
}
unsigned int
_papi_hwi_get_papi_event_code () {
INTDBG("papi_event_code: %#x\n", papi_event_code);
- return papi_event_code;
+ return _papi_hwi_my_thread->tls_papi_event_code;
}
/* Get the index into the ESI->NativeInfoArray for the current PAPI event code */
int
@@ -560,7 +557,7 @@ _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char
int result;
- if (papi_event_code_changed > 0) {
+ if (_papi_hwi_my_thread->tls_papi_event_code_changed > 0) {
result = _papi_hwi_get_papi_event_code();
INTDBG("EXIT: papi_event_code: %#x set by the component\n", result);
return result;
diff --git a/src/threads.c b/src/threads.c
index 4dd0cf4e3..9f586c415 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -286,6 +286,10 @@ _papi_hwi_initialize_thread( ThreadInfo_t ** dest, int tid )
return PAPI_ENOMEM;
}
+ /* init event memory variables, used by papi_internal.c */
+ thread->tls_papi_event_code = -1;
+ thread->tls_papi_event_code_changed = -1;
+
/* Call the component to fill in anything special. */
for ( i = 0; i < papi_num_components; i++ ) {
@@ -421,6 +425,11 @@ _papi_hwi_shutdown_thread( ThreadInfo_t * thread, int force_shutdown )
unsigned long tid;
int i, failure = 0;
+ /* Clear event memory variables */
+ thread->tls_papi_event_code = -1;
+ thread->tls_papi_event_code_changed = -1;
+
+ /* Get thread id */
if ( _papi_hwi_thread_id_fn )
tid = ( *_papi_hwi_thread_id_fn ) ( );
else
diff --git a/src/threads.h b/src/threads.h
index cd3369068..264d9f3a6 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -30,6 +30,11 @@ typedef struct _ThreadInfo
EventSetInfo_t **running_eventset;
EventSetInfo_t *from_esi; /* ESI used for last update this control state */
int wants_signal;
+
+ // The current event code can be stored here prior to
+ // component calls and cleared after the component returns.
+ unsigned int tls_papi_event_code;
+ int tls_papi_event_code_changed;
} ThreadInfo_t;
/** The list of threads, gets initialized to master process with TID of getpid()

22
papi-rhbz1918721.patch Normal file
View File

@ -0,0 +1,22 @@
diff -up papi-5.6.0/src/papi_events.csv.p9 papi-5.6.0/src/papi_events.csv
--- papi-5.6.0/src/papi_events.csv.p9 2021-05-25 16:19:17.342588151 -0400
+++ papi-5.6.0/src/papi_events.csv 2021-05-25 16:54:06.357460525 -0400
@@ -1580,15 +1580,15 @@ PRESET,PAPI_L1_DCR,DERIVED_SUB,PM_LD_REF
#PRESET,PAPI_L1_DCA,DERIVED_POSTFIX,N0|N1|-|N2|+|N3|-,PM_ST_FIN,PM_ST_MISS_L1,PM_LD_REF_L1,PM_LD_MISS_L1_ALT
PRESET,PAPI_L1_DCA,DERIVED_ADD,PM_LD_REF_L1,PM_ST_CMPL
PRESET,PAPI_L2_DCM,NOT_DERIVED,PM_DATA_FROM_L2MISS
-PRESET,PAPI_L2_LDM,NOT_DERIVED,PM_L2_LD_MISS
-PRESET,PAPI_L2_STM,NOT_DERIVED,PM_L2_ST_MISS
+#PRESET,PAPI_L2_LDM,NOT_DERIVED,PM_L2_LD_MISS
+#PRESET,PAPI_L2_STM,NOT_DERIVED,PM_L2_ST_MISS
PRESET,PAPI_L3_DCR,NOT_DERIVED,PM_DATA_FROM_L2MISS
PRESET,PAPI_L3_DCM,DERIVED_ADD,PM_DATA_FROM_LMEM,PM_DATA_FROM_RMEM
PRESET,PAPI_L3_LDM,DERIVED_ADD,PM_DATA_FROM_LMEM,PM_DATA_FROM_RMEM
PRESET,PAPI_L1_ICH,NOT_DERIVED,PM_INST_FROM_L1
PRESET,PAPI_L1_ICM,NOT_DERIVED,PM_L1_ICACHE_MISS
PRESET,PAPI_L2_ICM,NOT_DERIVED,PM_INST_FROM_L2MISS
-PRESET,PAPI_L2_ICM,NOT_DERIVED,PM_L2_INST_MISS
+#PRESET,PAPI_L2_ICM,NOT_DERIVED,PM_L2_INST_MISS
PRESET,PAPI_L2_ICH,NOT_DERIVED,PM_INST_FROM_L2
PRESET,PAPI_L3_ICA,NOT_DERIVED,PM_INST_FROM_L2MISS
PRESET,PAPI_L3_ICH,NOT_DERIVED,PM_INST_FROM_L3

139
papi-thread_init.patch Normal file
View File

@ -0,0 +1,139 @@
commit 617eeabe0bbfb5357c10b22ebd72b24a4a872e52
Author: Anthony <adanalis@icl.utk.edu>
Date: Mon Jan 6 15:09:42 2020 -0500
Updated the variables that are used in the debug messages in accordance to a previous commit that made these variables thread safe.
diff --git a/src/papi_internal.c b/src/papi_internal.c
index f0e457bf7..69b2914d0 100644
--- a/src/papi_internal.c
+++ b/src/papi_internal.c
@@ -114,7 +114,7 @@ _papi_hwi_free_papi_event_string() {
void
_papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) {
- INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
+ INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, _papi_hwi_my_thread->tls_papi_event_code);
// if call is just to reset and start over, set both flags to show nothing saved yet
if (update_flag < 0) {
@@ -131,7 +131,7 @@ _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) {
}
unsigned int
_papi_hwi_get_papi_event_code () {
- INTDBG("papi_event_code: %#x\n", papi_event_code);
+ INTDBG("papi_event_code: %#x\n", _papi_hwi_my_thread->tls_papi_event_code);
return _papi_hwi_my_thread->tls_papi_event_code;
}
/* Get the index into the ESI->NativeInfoArray for the current PAPI event code */
From 3cc3b6679e1ace7516c3037105ad16410ce7d3db Mon Sep 17 00:00:00 2001
From: William Cohen <wcohen@redhat.com>
Date: Wed, 12 Aug 2020 10:12:59 -0400
Subject: [PATCH] Initialize component globals before threads globals
An earlier commit (979e80136) swapped the order of initializing
globals and threads. This caused issues with the perf_event, appio,
and stealtime components which could be observed with the
all_native_events, appio_test_pthreads, and stealtime_basic tests
respectively. The component initialization needs to be performed
before the thread initialization.
The order of initialization has been changed back to initializing the
component then the threads. One complication is that papi_internal.c
had functions (_papi_hwi_set_papi_event_code and
_papi_hwi_get_papi_event_code) that required thread local storage that
was being setup in commit 979e80136 by the thread initialization.
This was the original reason for swapping the order of initialization
of component and thread. Using __thread on the file scope
declarations of the variables allow the original order of
initialization.
---
src/papi.c | 10 +++++-----
src/papi_internal.c | 21 +++++++++++++--------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/papi.c b/src/papi.c
index 33cc29935..107a15044 100644
--- a/src/papi.c
+++ b/src/papi.c
@@ -1151,19 +1151,19 @@ PAPI_library_init( int version )
papi_return( init_retval );
}
- /* Initialize thread globals, including the main threads */
+ /* Initialize component globals */
- tmp = _papi_hwi_init_global_threads( );
+ tmp = _papi_hwi_init_global( );
if ( tmp ) {
init_retval = tmp;
_papi_hwi_shutdown_global_internal( );
- _in_papi_library_init_cnt--;
+ _in_papi_library_init_cnt--;
papi_return( init_retval );
}
- /* Initialize component globals */
+ /* Initialize thread globals, including the main threads */
- tmp = _papi_hwi_init_global( );
+ tmp = _papi_hwi_init_global_threads( );
if ( tmp ) {
init_retval = tmp;
_papi_hwi_shutdown_global_internal( );
diff --git a/src/papi_internal.c b/src/papi_internal.c
index 5a1ccd433..bdf30f875 100644
--- a/src/papi_internal.c
+++ b/src/papi_internal.c
@@ -115,27 +115,32 @@ _papi_hwi_free_papi_event_string() {
return;
}
+// A place to keep the current papi event code so some component functions can fetch its value
+// The current event code can be stored here prior to component calls and cleared after the component returns
+static THREAD_LOCAL_STORAGE_KEYWORD unsigned int papi_event_code = -1;
+static THREAD_LOCAL_STORAGE_KEYWORD int papi_event_code_changed = -1;
+
void
_papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag) {
- INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, _papi_hwi_my_thread->tls_papi_event_code);
+ INTDBG("new event_code: %#x, update_flag: %d, previous event_code: %#x\n", event_code, update_flag, papi_event_code);
// if call is just to reset and start over, set both flags to show nothing saved yet
if (update_flag < 0) {
- _papi_hwi_my_thread->tls_papi_event_code_changed = -1;
- _papi_hwi_my_thread->tls_papi_event_code = -1;
+ papi_event_code_changed = -1;
+ papi_event_code = -1;
return;
}
// if 0, it is being set prior to calling a component, if >0 it is being changed by the component
- _papi_hwi_my_thread->tls_papi_event_code_changed = update_flag;
+ papi_event_code_changed = update_flag;
// save the event code passed in
- _papi_hwi_my_thread->tls_papi_event_code = event_code;
+ papi_event_code = event_code;
return;
}
unsigned int
_papi_hwi_get_papi_event_code () {
- INTDBG("papi_event_code: %#x\n", _papi_hwi_my_thread->tls_papi_event_code);
- return _papi_hwi_my_thread->tls_papi_event_code;
+ INTDBG("papi_event_code: %#x\n", papi_event_code);
+ return papi_event_code;
}
/* Get the index into the ESI->NativeInfoArray for the current PAPI event code */
int
@@ -560,7 +565,7 @@ _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char
int result;
- if (_papi_hwi_my_thread->tls_papi_event_code_changed > 0) {
+ if (papi_event_code_changed > 0) {
result = _papi_hwi_get_papi_event_code();
INTDBG("EXIT: papi_event_code: %#x set by the component\n", result);
return result;
--
2.26.2

424
papi.spec Normal file
View File

@ -0,0 +1,424 @@
%bcond_with bundled_libpfm
# rdma is not available
%ifarch %{arm}
%{!?with_rdma: %global with_rdma 0}
%else
%{!?with_rdma: %global with_rdma 1}
%endif
Summary: Performance Application Programming Interface
Name: papi
Version: 5.6.0
Release: 14%{?dist}
License: BSD
Group: Development/System
Requires: papi-libs = %{version}-%{release}
URL: http://icl.cs.utk.edu/papi/
Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz
Patch1: papi-ldflags.patch
Patch2: papi-divzero.patch
Patch3: papi-rhbz1807346.patch
Patch4: papi-thread_init.patch
Patch5: papi-mx.patch
Patch6: papi-bz1908126.patch
Patch7: papi-rhbz1918721.patch
BuildRequires: autoconf
BuildRequires: doxygen
BuildRequires: ncurses-devel
BuildRequires: gcc-gfortran
BuildRequires: kernel-headers >= 2.6.32
BuildRequires: chrpath
BuildRequires: lm_sensors-devel
%if %{without bundled_libpfm}
BuildRequires: libpfm-devel >= 4.10.1-3
BuildRequires: libpfm-static >= 4.10.1-3
%endif
# Following required for net component
BuildRequires: net-tools
%if %{with_rdma}
# Following required for inifiband component
BuildRequires: rdma-core-devel
BuildRequires: infiniband-diags-devel
%endif
BuildRequires: perl-generators
#Right now libpfm does not know anything about s390 and will fail
ExcludeArch: s390 s390x
%description
PAPI provides a programmer interface to monitor the performance of
running programs.
%package libs
Summary: Libraries for PAPI clients
Group: Development/System
%description libs
This package contains the run-time libraries for any application that wishes
to use PAPI.
%package devel
Summary: Header files for the compiling programs with PAPI
Group: Development/System
Requires: papi = %{version}-%{release}
Requires: papi-libs = %{version}-%{release}
Requires: pkgconfig
%description devel
PAPI-devel includes the C header files that specify the PAPI user-space
libraries and interfaces. This is required for rebuilding any program
that uses PAPI.
%package testsuite
Summary: Set of tests for checking PAPI functionality
Group: Development/System
Requires: papi = %{version}-%{release}
Requires: papi-libs = %{version}-%{release}
%description testsuite
PAPI-testsuite includes compiled versions of papi tests to ensure
that PAPI functions on particular hardware.
%package static
Summary: Static libraries for the compiling programs with PAPI
Group: Development/System
Requires: papi = %{version}-%{release}
%description static
PAPI-static includes the static versions of the library files for
the PAPI user-space libraries and interfaces.
%prep
%setup -q
%patch1 -p1 -b .ldflags
%patch2 -p1 -b .divzero
%patch3 -p1 -b .rhbz1807346
%patch4 -p1 -b .thread_init
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
%if %{without bundled_libpfm}
# Build our own copy of libpfm.
%global libpfm_config --with-pfm-incdir=%{_includedir} --with-pfm-libdir=%{_libdir}
%endif
cd src
autoconf
%configure --with-perf-events \
%{?libpfm_config} \
--with-static-lib=yes --with-shared-lib=yes --with-shlib --with-shlib-tools \
--with-components="appio coretemp example infiniband lmsensors lustre micpower mx net rapl stealtime"
# implicit enabled components: perf_event perf_event_uncore
#components currently left out because of build configure/build issues
# --with-components="bgpm coretemp_freebsd cuda host_micpower nvml vmware"
pushd components
#pushd cuda; ./configure; popd
#pushd host_micpower; ./configure; popd
%if %{with_rdma}
pushd infiniband_umad; %configure; popd
%endif
pushd lmsensors; \
%configure --with-sensors_incdir=/usr/include/sensors \
--with-sensors_libdir=%{_libdir}; \
popd
#pushd vmware; ./configure; popd
popd
#DBG workaround to make sure libpfm just uses the normal CFLAGS
DBG="" make %{?_smp_mflags}
#generate updated versions of the documentation
#DBG workaround to make sure libpfm just uses the normal CFLAGS
pushd ../doc
DBG="" make
DBG="" make install
popd
%install
rm -rf $RPM_BUILD_ROOT
cd src
make DESTDIR=$RPM_BUILD_ROOT LDCONFIG=/bin/true install-all
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so*
%files
%{_bindir}/*
%dir /usr/share/papi
/usr/share/papi/papi_events.csv
%doc INSTALL.txt README LICENSE.txt RELEASENOTES.txt
%doc %{_mandir}/man1/*
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files libs
%{_libdir}/*.so.*
%doc INSTALL.txt README LICENSE.txt RELEASENOTES.txt
%files devel
%{_includedir}/*.h
%if %{with bundled_libpfm}
%{_includedir}/perfmon/*.h
%endif
%{_libdir}/*.so
%{_libdir}/pkgconfig/papi*.pc
%doc %{_mandir}/man3/*
%files testsuite
/usr/share/papi/run_tests*
/usr/share/papi/ctests
/usr/share/papi/ftests
/usr/share/papi/validation_tests
/usr/share/papi/components
/usr/share/papi/testlib
%files static
%{_libdir}/*.a
%changelog
* Tue May 25 2021 William Cohen <wcohen@redhat.com> - 5.6.0-14
- Disable problematic IBM Power9 events.
* Tue May 25 2021 William Cohen <wcohen@redhat.com> - 5.6.0-13
- Add Fujitsu A64FX support.
* Tue May 18 2021 William Cohen <wcohen@redhat.com> - 5.6.0-12
- Improvements to mx component.
* Fri Aug 21 2020 William Cohen <wcohen@redhat.com> - 5.6.0-11
- Correct the handling of multiple threads. (rhbz1807346)
* Wed May 27 2020 William Cohen <wcohen@redhat.com> - 5.6.0-10
- Rebuild with current libpfm-4.10.1.
* Tue May 26 2020 William Cohen <wcohen@redhat.com> - 5.6.0-9
- Correct typo in papi-testsuite description.
- Add papi-libs for papi-testsuite and papi-devel.
* Fri Nov 2 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.0-8
- Pull in patch to avoid division-by-0.
* Thu May 17 2018 William Cohen <wcohen@redhat.com> - 5.6.0-6
- Dynamically link utilities and tests to papi libraries.
* Mon Apr 30 2018 William Cohen <wcohen@redhat.com> - 5.6.0-5
- Include various LDFLAGS/CFLAGS.
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jan 31 2018 William Cohen <wcohen@redhat.com> - 5.6.0-3
- Bump and rebuild.
* Thu Dec 21 2017 William Cohen <wcohen@redhat.com> - 5.6.0-2
- Correct infiniband buildrequires.
* Thu Dec 21 2017 William Cohen <wcohen@redhat.com> - 5.6.0-1
- Rebase to papi-5.6.0.
* Mon Aug 28 2017 Honggang LI <honli@redhat.com> - 5.5.1-6
- Disable RDMA support on ARM32
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Feb 2 2017 William Cohen <wcohen@redhat.com> - 5.5.1-2
- Bump version and rebuild due to new libgfortan.so version.
* Fri Nov 18 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.1-1
- Rebase to papi-5.5.1.
* Wed Sep 14 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.0-1
- Rebase to papi-5.5.0.
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Jan 26 2016 William Cohen <wcohen@redhat.com> - 5.4.3-1
- Rebase to papi-5.4.3.
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Fri Mar 6 2015 William Cohen <wcohen@redhat.com> - 5.4.1-2
- Make sure using libpfm-4.6.0.
* Tue Mar 3 2015 William Cohen <wcohen@redhat.com> - 5.4.1-1
- Rebase to papi-5.4.1.
* Wed Feb 11 2015 William Cohen <wcohen@redhat.com> - 5.4.0-3
- Bump version and rebuild.
* Thu Dec 18 2014 William Cohen <wcohen@redhat.com> - 5.4.0-2
- Split out papi-libs as separate subpackage. (#1172875)
* Mon Nov 17 2014 William Cohen <wcohen@redhat.com> - 5.4.0-1
- Rebase to papi-5.4.0.
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Mon Aug 4 2014 William Cohen <wcohen@redhat.com> - 5.3.2-1
- Rebase to 5.3.2.
* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.3.0-2.16.ga7f6159
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Fri Jan 17 2014 Lukas Berk <lberk@redhat.com> - 5.3.0-1.16.ga7f6159
- Automated weekly rawhide release
* Thu Jan 16 2014 William Cohen <wcohen@redhat.com> - 5.3.0-1
- Rebase to 5.3.0.
* Tue Jan 14 2014 William Cohen <wcohen@redhat.com> - 5.2.0-5
- Add presets for Intel Silvermont.
* Mon Jan 13 2014 William Cohen <wcohen@redhat.com> - 5.2.0-4
- Add presets for Haswell and Ivy Bridge.
* Wed Aug 14 2013 William Cohen <wcohen@redhat.com> - 5.2.0-2
- Enable infiniband and stealtime components.
* Wed Aug 07 2013 William Cohen <wcohen@redhat.com> - 5.2.0-1
- Rebase to 5.2.0
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Jul 24 2013 William Cohen <wcohen@redhat.com> - 5.1.1-7
- rhbz830275 - Add support for POWER8 processor to PAPI
* Mon Jul 22 2013 William Cohen <wcohen@redhat.com> - 5.1.1-6
- Add autoconf buildrequires.
* Mon Jul 22 2013 William Cohen <wcohen@redhat.com> - 5.1.1-5
- rhbz986673 - /usr/lib64/libpapi.so is unowned
- Package files in /usr/share/papi only once.
- Avoid dependency problem with parallel make of man pages.
* Fri Jul 19 2013 William Cohen <wcohen@redhat.com> - 5.1.1-4
- Correct changelog.
* Fri Jul 5 2013 William Cohen <wcohen@redhat.com> - 5.1.1-3
- Add man page corrections/updates.
* Fri Jun 28 2013 William Cohen <wcohen@redhat.com> - 5.1.1-2
- Add testsuite subpackage.
* Thu May 30 2013 William Cohen <wcohen@redhat.com> - 5.1.1-1
- Rebase to 5.1.1
* Mon Apr 15 2013 William Cohen <wcohen@redhat.com> - 5.1.0.2-2
- Fix arm FTBS rhbz 951806.
* Tue Apr 9 2013 William Cohen <wcohen@redhat.com> - 5.1.0.2-1
- Rebase to 5.1.0.2
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Mon Jan 14 2013 William Cohen <wcohen@redhat.com> - 5.0.1-5
- Add armv7 cortex a15 presets.
* Tue Dec 04 2012 William Cohen <wcohen@redhat.com> - 5.0.1-4
- Disable ldconfig on install.
* Thu Nov 08 2012 William Cohen <wcohen@redhat.com> - 5.0.1-3
- Avoid duplicated shared library.
* Wed Oct 03 2012 William Cohen <wcohen@redhat.com> - 5.0.1-2
- Make sure using compatible version of libpfm.
* Thu Sep 20 2012 William Cohen <wcohen@redhat.com> - 5.0.1-1
- Rebase to 5.0.1.
* Mon Sep 10 2012 William Cohen <wcohen@redhat.com> - 5.0.0-6
- Back port fixes for Intel Ivy Bridge event presets.
* Thu Aug 30 2012 William Cohen <wcohen@redhat.com> - 5.0.0-5
- Fixes to make papi with unbundled libpfm.
* Mon Aug 27 2012 William Cohen <wcohen@redhat.com> - 5.0.0-2
- Keep libpfm unbundled.
* Fri Aug 24 2012 William Cohen <wcohen@redhat.com> - 5.0.0-1
- Rebase to 5.0.0.
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jun 11 2012 William Cohen <wcohen@redhat.com> - 4.4.0-4
- Use siginfo_t rather than struct siginfo.
* Mon Jun 11 2012 William Cohen <wcohen@redhat.com> - 4.4.0-3
- Correct build requires.
* Mon Jun 11 2012 William Cohen <wcohen@redhat.com> - 4.4.0-2
- Unbundle libpfm4 from papi.
- Correct description spellings.
- Remove unused test section.
* Fri Apr 20 2012 William Cohen <wcohen@redhat.com> - 4.4.0-1
- Rebase to 4.4.0.
* Fri Mar 9 2012 William Cohen <wcohen@redhat.com> - 4.2.1-2
- Fix overrun in lmsensor component. (rhbz797692)
* Tue Feb 14 2012 William Cohen <wcohen@redhat.com> - 4.2.1-1
- Rebase to 4.2.1.
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Nov 02 2011 William Cohen <wcohen@redhat.com> - 4.2.0-3
- Remove unwanted man1/*.c.1 files. (rhbz749725)
* Mon Oct 31 2011 William Cohen <wcohen@redhat.com> - 4.2.0-2
- Include appropirate man pages with papi rpm. (rhbz749725)
- Rebase to papi-4.2.0, fixup for coretemp component. (rhbz746851)
* Thu Oct 27 2011 William Cohen <wcohen@redhat.com> - 4.2.0-1
- Rebase to papi-4.2.0.
* Fri Aug 12 2011 William Cohen <wcohen@redhat.com> - 4.1.3-3
- Provide papi-static.
* Thu May 12 2011 William Cohen <wcohen@redhat.com> - 4.1.3-2
- Use corrected papi-4.1.3.
* Thu May 12 2011 William Cohen <wcohen@redhat.com> - 4.1.3-1
- Rebase to papi-4.1.3
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.1.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jan 24 2011 William Cohen <wcohen@redhat.com> - 4.1.2.1-1
- Rebase to papi-4.1.2.1
* Fri Oct 1 2010 William Cohen <wcohen@redhat.com> - 4.1.1-1
- Rebase to papi-4.1.1
* Tue Jun 22 2010 William Cohen <wcohen@redhat.com> - 4.1.0-1
- Rebase to papi-4.1.0
* Mon May 17 2010 William Cohen <wcohen@redhat.com> - 4.0.0-5
- Test run with upstream cvs version.
* Wed Feb 10 2010 William Cohen <wcohen@redhat.com> - 4.0.0-4
- Resolves: rhbz562935 Rebase to papi-4.0.0 (correct ExcludeArch).
* Wed Feb 10 2010 William Cohen <wcohen@redhat.com> - 4.0.0-3
- Resolves: rhbz562935 Rebase to papi-4.0.0 (bump nvr).
* Wed Feb 10 2010 William Cohen <wcohen@redhat.com> - 4.0.0-2
- correct the ctests/shlib test
- have PAPI_set_multiplex() return proper value
- properly handle event unit masks
- correct PAPI_name_to_code() to match events
- Resolves: rhbz562935 Rebase to papi-4.0.0
* Wed Jan 13 2010 William Cohen <wcohen@redhat.com> - 4.0.0-1
- Generate papi.spec file for papi-4.0.0.

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (papi-5.6.0.tar.gz) = b2a1536f220081d08ee9bc94fddbf422e36c60c55b0536bc43dec074bdaf23afaedbdd755b7e6af25c4c0ce582cc7ad4c59e2adc1801e75c482d472b080439be