Skip to content

Conversation

@chipot
Copy link
Contributor

@chipot chipot commented Jul 10, 2023

This PR is trying to address #1627

I reworked FindPFM.cmake to use find_library and find_path instead of check_library_exists and check_include_file. The main problem with these two is that they expect CFLAGS and LDFLAGS to be set correctly before the call.

The module now creates an IMPORTED target PFM::libpfm and we can link to it as expected.

@google-cla
Copy link

google-cla bot commented Jul 10, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dmah42
Copy link
Member

dmah42 commented Jul 10, 2023

fantastic! i wonder if this is why the CI bots fail the pfm tests... cc @macandy13

@dmah42
Copy link
Member

dmah42 commented Jul 10, 2023

CI failures are unrelated

@dmah42 dmah42 merged commit 8805bd0 into google:main Jul 10, 2023
@dmah42
Copy link
Member

dmah42 commented Jul 10, 2023

thanks!

Comment on lines -9 to -12
set_package_properties(PFM PROPERTIES
URL http://perfmon2.sourceforge.net/
DESCRIPTION "a helper library to develop monitoring tools"
PURPOSE "Used to program specific performance monitoring events")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should remain

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added back with a followup commit

Eric Fiselier <[email protected]>
Eugene Zhuk <[email protected]>
Evgeny Safronov <[email protected]>
Fabien Pichot <[email protected]>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know almost-sorted files is not fun to deal with,
but would it please be possible to not re-sort it here,
but just add new entries to the right-ish place?

Comment on lines +15 to +17
if (PFM_FOUND AND NOT TARGET PFM::libpfm)
add_library(PFM::libpfm UNKNOWN IMPORTED)
set_target_properties(PFM::libpfm PROPERTIES
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a convention on the names of imported targets?
If not, i think PFM::PFM might be better-ish?

Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please, this is nice.

@macandy13
Copy link
Contributor

fantastic! i wonder if this is why the CI bots fail the pfm tests... cc @macandy13

Hm, I don't see test failures related to pfm. I also think the pfm tests are never actually run on the CI machines, because they do not support performance counters at all (which is what I tried in one of the recent prs but sadly had to remove from the pr again).

Am I missing something?

@dmah42
Copy link
Member

dmah42 commented Jul 11, 2023

i was suggesting that the current version of this code that doesn't do a great job of finding pfm might be the reason why the CI machines can't run the tests. maybe with this change they can?

@macandy13
Copy link
Contributor

When I tried the tests, the problem was not that libpfm wasn't found (I was using bazel for doing this), it was that the underlying VM does not report any performance counters at all. The pfm tests actually expect that the system at least reports a few standard ones.

Do you have a link to the error you were seeing?

@dmah42
Copy link
Member

dmah42 commented Jul 11, 2023

i didn't check any errors, i was just being optimistic.

@macandy13
Copy link
Contributor

Ok. For the record, this is the failure I was seeing when trying to enable pfm CI tests: https://github.com/google/benchmark/actions/runs/5484545652/jobs/9992228532#step:5:2830

[ RUN      ] PerfCountersTest.OneCounter
***WARNING** Failed to get a file descriptor for performance counter CYCLES. Ignoring
test/perf_counters_gtest.cc:36: Failure
Expected equality of these values:
  PerfCounters::Create({kGenericPerfEvent1}).num_counters()
    Which is: 0
  1
[  FAILED  ] PerfCountersTest.OneCounter (0 ms)

@chipot chipot deleted the find_pfm branch July 11, 2023 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants