icl-utk-edu / papi

Other
119 stars 54 forks source link

PAPI_ECMP and PAPI_ESBSTR Assigned Same Value #198

Open Treece-Burgess opened 5 months ago

Treece-Burgess commented 5 months ago

PAPI_ESBSTR and PAPI_ECMP both have the same value of -4 assigned to them, this can be seen in lines 258,259 in papi.c.

This issue is being looked into further by the PAPI team.

Treece-Burgess commented 5 months ago

Files that contain PAPI_ESBSTR:

./src/papi_libpfm4_events.c:120:                        return PAPI_ESBSTR;
./src/papi.h:259:#define PAPI_ESBSTR     -4     /**< Backwards compatibility */

Files that contain PAPI_ECMP:

./src/testlib/test_utils.c:727:                         "PAPI_get_component_info", PAPI_ECMP );
./src/testlib/ftests_util.F:99:      if ( retval.eq.PAPI_ECMP .OR. retval.eq.PAPI_ENOEVNT
./src/papi_common_strings.h:575:    /* 4 */ {PAPI_ECMP, "PAPI_ECMP", "Not supported by component"},
./src/papi_libpfm4_events.c:99: *  @retval PAPI_ECMP     There was an error initializing
./src/solaris-ultra.c:369:              return PAPI_ECMP;
./src/solaris-ultra.c:447:              return PAPI_ECMP;
./src/solaris-ultra.c:601:      return PAPI_ECMP;
./src/papi.h:258:#define PAPI_ECMP       -4     /**< Not supported by component */
./src/linux-bgq.c:652:  return PAPI_ECMP;
./src/linux-bgq.c:868:  return PAPI_ECMP;
./src/papi_vector.c:30: exit( PAPI_ECMP );
./src/papi_vector.c:48: return PAPI_ECMP;
./src/papi_vector.c:66: return PAPI_ECMP;
./src/papi_vector.c:74: return PAPI_ECMP;
./src/papi_vector.c:86: return PAPI_ECMP;
./src/papi_internal.c:488:      /*  4 PAPI_ECMP */      _papi_hwi_add_error("Not supported by component");
./src/papi_internal.c:771:   if (_papi_hwi_invalid_cmp(cidx)) return PAPI_ECMP;
./src/papi_internal.c:2497:                     retval = PAPI_ECMP;
./src/papi_internal.c:2501:             if ( retval==PAPI_ECMP) {
./src/papi_internal.c:2611:       if ( retval == PAPI_ECMP ) {
./src/solaris-niagara2.c:79:    if(retval != 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
./src/solaris-niagara2.c:82:    if(retval == NULL){ SUBDBG("RETVAL: NULL\n"); return PAPI_ECMP;}
./src/solaris-niagara2.c:85:    if(retval != PAPI_OK){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
./src/solaris-niagara2.c:91:    if(retval < 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
./src/solaris-niagara2.c:1182:          return PAPI_ECMP;
./src/solaris-niagara2.c:1578:          return PAPI_ECMP;
./src/solaris-niagara2.c:1589:                  return PAPI_ECMP;
./src/sw_multiplex.c:1264:                    if ( retval != PAPI_ECMP ) {
./src/ctests/profile_pthreads.c:158:            if ( retval == PAPI_ECMP )
./src/ctests/locks_pthreads.c:75:               if ( retval == PAPI_ECMP ) {
./src/ctests/multiplex3_pthreads.c:86:          if ( retval == PAPI_ECMP )
./src/ctests/zero_pthreads.c:152:               if ( retval == PAPI_ECMP ) {
./src/ctests/zero_smp.c:128:            if ( retval == PAPI_ECMP )
./src/ctests/inherit.c:41:              if ( retval == PAPI_ECMP) {
./src/ctests/thrspecific.c:112:         if ( retval == PAPI_ECMP ) {
./src/ctests/clockres_pthreads.c:47:       if ( retval == PAPI_ECMP ) {
./src/ctests/zero_omp.c:169:            if ( retval == PAPI_ECMP ) {
./src/ctests/multiplex1_pthreads.c:78:          if ( retval == PAPI_ECMP )
./src/ctests/val_omp.c:145:             if ( retval == PAPI_ECMP )
./src/ctests/second.c:157:         test_fail( __FILE__, __LINE__,"PAPI_get_component_info", PAPI_ECMP);
./src/ctests/second.c:235:              if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
./src/ctests/second.c:264:              if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
./src/ctests/overflow_pthreads.c:161:           if ( retval == PAPI_ECMP )
./src/ctests/code2name.c:117:                      "PAPI_get_component_info", PAPI_ECMP );
./src/linux-bgp.c:325:                                  return PAPI_ECMP;
./src/linux-bgp.c:346:                                  return PAPI_ECMP;
./src/linux-bgp.c:350:                                  return PAPI_ECMP;
./src/linux-bgp.c:449:          return PAPI_ECMP;
./src/linux-bgp.c:522:  return PAPI_ECMP;
./src/linux-bgp.c:648:  return PAPI_ECMP;
./src/linux-bgp.c:679:          return PAPI_ECMP;
./src/linux-bgp.c:859:          return PAPI_ECMP;
./src/papi.c:742: *  @retval PAPI_ECMP 
./src/papi.c:770: *     @retval PAPI_ECMP 
./src/papi.c:1015: *    @retval PAPI_ECMP 
./src/papi.c:3338: *    @retval PAPI_ECMP 
./src/papi.c:3711: *    @retval PAPI_ECMP 
./src/papi.c:3768: *    @retval PAPI_ECMP
./src/papi.c:3925: *    @retval PAPI_ECMP
./src/papi.c:4035:                      papi_return( PAPI_ECMP );
./src/papi.c:4039:                      papi_return( PAPI_ECMP );
./src/papi.c:4069:                      papi_return( PAPI_ECMP );
./src/papi.c:4079:                      papi_return( PAPI_ECMP );
./src/papi.c:4109:                      papi_return( PAPI_ECMP );
./src/papi.c:4373:                      papi_return( PAPI_ECMP );
./src/papi.c:4380:                      papi_return( PAPI_ECMP );
./src/papi.c:4601: *    @retval PAPI_ECMP 
./src/papi.c:4883:     return PAPI_ECMP;
./src/papi.c:6590: *    @retval PAPI_ECMP
./src/solaris-common.c:511:             return PAPI_ECMP;
./src/solaris-common.c:597:             return PAPI_ECMP;
./src/solaris-common.c:601:             return PAPI_ECMP;
./src/solaris-common.c:608:             return PAPI_ECMP;
./src/solaris-common.c:652:             return PAPI_ECMP;
./src/solaris-common.c:723:             return PAPI_ECMP;
./src/solaris-common.c:743:             return PAPI_ECMP;
./src/freebsd.c:503:                    return PAPI_ECMP;
./src/freebsd.c:543:                    return PAPI_ECMP;
./src/freebsd.c:619:            return PAPI_ECMP;
./src/freebsd.c:639:                    return PAPI_ECMP;
./src/components/net/linux-net.c:182:                return PAPI_ECMP;
./src/components/net/linux-net.c:340:        retval = PAPI_ECMP;
./src/components/perfmon_ia64/perfmon-ia64.c:1528:              return PAPI_ECMP;
./src/components/perfmon_ia64/perfmon-ia64.c:1878:              return PAPI_ECMP;
./src/components/perfmon_ia64/perfmon-ia64.c:2000:      return PAPI_ECMP;
./src/components/perfmon_ia64/perfmon-ia64.c:2036:              return PAPI_ECMP;
./src/components/perfmon_ia64/perfmon-ia64.c:2042:              return PAPI_ECMP;
./src/components/cuda/tests/simpleMultiGPU.cu:231:        test_fail(__FILE__, __LINE__, "Failed to get index of cuda component.", PAPI_ECMP);
./src/components/cuda/tests/test_multi_read_and_reset.cu:243:        test_fail(__FILE__, __LINE__, "Failed to get index of cuda component.", PAPI_ECMP);
./src/components/cuda/tests/simpleMultiGPU_noCuCtx.cu:221:        test_fail(__FILE__, __LINE__, "Failed to get index of cuda component.", PAPI_ECMP);
./src/components/cuda/cupti_common.c:440:        papi_errno = PAPI_ECMP;
./src/components/cuda/cupti_profiler.c:1531:    papi_errno = PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:65:        papi_errno = PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:75:        papi_errno = PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:80:        papi_errno = PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:111:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:129:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:147:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:165:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:183:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:201:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:219:    return PAPI_ECMP;
./src/components/cuda/cupti_dispatch.c:237:    return PAPI_ECMP;
./src/components/cuda/linux-cuda.c:334:        papi_errno = PAPI_ECMP;
./src/components/cuda/linux-cuda.c:372:        return PAPI_ECMP;
./src/components/micpower/linux-micpower.c:205:                retval = PAPI_ECMP;
./src/components/perfctr_ppc/perfctr-ppc64.c:623:       return PAPI_ECMP;
./src/components/perfctr_ppc/ppc64_events.c:84:         return PAPI_ECMP;
./src/components/perfctr_ppc/ppc64_events.c:158:                return PAPI_ECMP;
./src/components/rocm/rocm.c:280:        return PAPI_ECMP;
./src/components/rocm/rocm.c:360:        papi_errno = PAPI_ECMP;
./src/components/rocm/roc_profiler.c:303:        papi_errno = (htable_errno == HTABLE_ENOVAL) ? PAPI_ENOEVNT : PAPI_ECMP;
./src/components/rocm/roc_profiler.c:2085:        papi_errno = PAPI_ECMP;
./src/components/template/template.c:221:        return PAPI_ECMP;
./src/components/perf_event/perf_event.c:1761:             return PAPI_ECMP;
./src/components/perf_event/perf_event.c:2462:          return PAPI_ECMP;
./src/components/perf_event/perf_event.c:2478:          return PAPI_ECMP;
./src/components/perf_event/perf_event.c:2616:                  case PAPI_ECMP:
./src/components/perf_event/pe_libpfm4_events.c:1141: *  @retval PAPI_ECMP     There was an error initializing the component
./src/components/perf_event/pe_libpfm4_events.c:1280:           return PAPI_ECMP;
./src/components/perf_event/pe_libpfm4_events.c:1313: *  @retval PAPI_ECMP     There was an error initializing the component
./src/components/lmsensors/linux-lmsensors.c:346:      res = PAPI_ECMP;
./src/components/perfmon2/perfmon.c:710:                return PAPI_ECMP;
./src/components/perfmon2/perfmon.c:727:        return PAPI_ECMP;
./src/components/perfctr/perfctr.c:311:         return PAPI_ECMP;
./src/components/perfnec/perfmon.c:205: return PAPI_ECMP;
./src/components/mx/linux-mx.c:178:        return PAPI_ECMP;
./src/components/mx/linux-mx.c:271:       retval = PAPI_ECMP;
./src/components/vmware/vmware.c:240:            return PAPI_ECMP;
./src/components/vmware/vmware.c:327:              return PAPI_ECMP;
./src/components/vmware/vmware.c:335:      return PAPI_ECMP;
./src/components/vmware/vmware.c:340:      return PAPI_ECMP;
./src/components/vmware/vmware.c:354:      return PAPI_ECMP;
./src/components/vmware/vmware.c:362:      return PAPI_ECMP;
./src/components/vmware/vmware.c:370:      return PAPI_ECMP;
./src/components/vmware/vmware.c:382:         return PAPI_ECMP;
./src/components/vmware/vmware.c:391:      return PAPI_ECMP;
./src/components/vmware/vmware.c:399:      return PAPI_ECMP;
./src/components/vmware/vmware.c:407:      return PAPI_ECMP;
./src/components/vmware/vmware.c:415:      return PAPI_ECMP;
./src/components/vmware/vmware.c:423:      return PAPI_ECMP;
./src/components/vmware/vmware.c:431:      return PAPI_ECMP;
./src/components/vmware/vmware.c:439:      return PAPI_ECMP;
./src/components/vmware/vmware.c:447:      return PAPI_ECMP;
./src/components/vmware/vmware.c:455:      return PAPI_ECMP;
./src/components/vmware/vmware.c:467:         return PAPI_ECMP;
./src/components/vmware/vmware.c:476:      return PAPI_ECMP;
./src/components/vmware/vmware.c:488:         return PAPI_ECMP;
./src/components/vmware/vmware.c:497:      return PAPI_ECMP;
./src/components/vmware/vmware.c:505:      return PAPI_ECMP;
./src/components/vmware/vmware.c:545:         return PAPI_ECMP;
./src/components/vmware/vmware.c:577:       retval = PAPI_ECMP;
./src/components/vmware/vmware.c:916:       retval = PAPI_ECMP;
./src/components/vmware/vmware.c:1160:               return PAPI_ECMP;
./src/components/host_micpower/linux-host_micpower.c:400:                       return PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:613:     retval = PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:629:     retval = PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:644:     retval = PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:655:     retval = PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:672:     retval = PAPI_ECMP;
./src/components/perf_event_uncore/perf_event_uncore.c:1211:               return PAPI_ECMP;
./src/components/coretemp/linux-coretemp.c:78:             return PAPI_ECMP;
./src/components/coretemp/linux-coretemp.c:359:    return PAPI_ECMP;
./src/components/coretemp/linux-coretemp.c:432:        retval = PAPI_ECMP;
./src/components/coretemp/linux-coretemp.c:441:        retval = PAPI_ECMP;
./src/components/coretemp_freebsd/coretemp_freebsd.c:110:               return PAPI_ECMP;
./src/components/coretemp_freebsd/coretemp_freebsd.c:173:            retval = PAPI_ECMP;
./src/components/sde/sde.c:35:            return ( PAPI_ECMP );                                      \
./src/components/sde/sde.c:254:                return PAPI_ECMP;
./src/components/sde/sde.c:290:                return PAPI_ECMP;
./src/components/sde/sde.c:713:        return PAPI_ECMP;
./src/components/sde/sde.c:722:        return PAPI_ECMP;
./src/components/sde/sde.c:731:        return PAPI_ECMP;
./src/components/sde/sde.c:755:        return PAPI_ECMP;
./src/components/sde/tests/Advanced_C+FORTRAN/sde_test_f08.F90:109:              print *,'PAPI_ECMP', PAPI_ECMP
./src/components/rocm_smi/rocs.c:430:            PAPI_ENOEVNT : PAPI_ECMP;
./src/components/rocm_smi/rocs.c:551:        return PAPI_ECMP;
./src/components/rocm_smi/rocs.c:555:        return PAPI_ECMP;
./src/components/rocm_smi/rocs.c:583:        return PAPI_ECMP;
./src/components/rocm_smi/rocs.c:587:        return PAPI_ECMP;
./src/components/rocm_smi/rocs.c:1336:    papi_errno = (events_count - count) ? PAPI_ECMP : PAPI_OK;
./src/components/sysdetect/tests/query_device_simple_f.F:27:              print *,'PAPI_ECMP', PAPI_ECMP
Treece-Burgess commented 5 months ago

The following is mentioned (dated 2012-07-05) in ChangeLogP500.txt:

Move uses of PAPI_ESBSTR to PAPI_ECMP I left PAPI_ESBSTR defined too for backward compatability. Also some of the changes update PAPI_ESBSTR to be a more relevant error code, it one is available.

Comment seems to come from Tony.

deater commented 3 months ago

I guess I can weigh in here. As the comments say, this was done intentionally. Prior to PAPI 4.0 ("component PAPI") the various interfaces were called substrates and would return PAPI_ESBSTR. When things were modularized into components, it made sense to report these as PAPI_ECMP instead. However since these values are reported to the user it might in theory break user code if we just removed the PAPI_ESBSTR definition. So we left it there as an alias for PAPI_ECMP.

Is this currently breaking things? Or is it just not documented well enough?

The leftover PAPI_ESBSTR in the libpfm4 code is an overight and should probably be fixed

Treece-Burgess commented 3 months ago

@deater Thanks for more clarification on this.

As stands this is not causing anything to break, but it was not clear initially when looking through papi.h why two #define's had the value 4 besides backwards compatibility purposes. With your comment and the note left by Tony in ChangeLogP500.txt everything now makes much more sense.

From prior discussions with Heike, we decided to leave the #define for PAPI_ESBSTR in papi.h since it was found in the libpfm4 code. But if you are stating it is an oversight and should be replaced with PAPI_ECMP. Then removing PAPI_ESBSTR from the list of error code defines in papi.h would now possibly make sense to do.

I do agree that removing PAPI_ESBSTR could in theory cause issues for users which have source files that utilize conditionals with PAPI_ESBSTR. I will discuss this further with Heike and Anthony.