Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always linking gbench statically #1874

Closed

Conversation

cjnolet
Copy link
Member

@cjnolet cjnolet commented Oct 5, 2023

This just makes more sense. There's no inherent reason folks should have to have gbench installed just to run benchmarks.

@cjnolet cjnolet added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 5, 2023
@cjnolet cjnolet self-assigned this Oct 5, 2023
@cjnolet cjnolet requested a review from a team as a code owner October 5, 2023 22:37
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

Does this make sense to do more generally? @robertmaynard are there known issues with statically linking gbench? If not, should we move this logic into rapids_cpm_gbench and make this target available for all of RAPIDS to use in this way?

@bdice
Copy link
Contributor

bdice commented Oct 13, 2023

Does this make sense to do more generally? @robertmaynard are there known issues with statically linking gbench? If not, should we move this logic into rapids_cpm_gbench and make this target available for all of RAPIDS to use in this way?

I'd also like to know if we should do the same for nvbench, if applicable.

@cjnolet
Copy link
Member Author

cjnolet commented Oct 15, 2023

@bdice @vyasr @robertmaynard given that we are almost always linking gbench (and gtest) directly into executable binaries and not into libraries, it would be ideal to make the executables as self-contained as possible, with the exception of libraft.

As for the reasoning behind this change- there's currently a gbench version conflict happening in some environments where a different version is installed on the system and we get an library not found error as a result. Gbench is lightweight enough that we shouldn't even have to require it as a runtime dependency. Not many systems are already going to have it installed for runtime anyways.

Whether we do this at rapids-cmake or do this directly for raft doesn't matter to me, but we need to alleviate this burden because too many users (including our own developers) have encountered this problem.

Copy link
Contributor

@robertmaynard robertmaynard left a comment

Choose a reason for hiding this comment

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

The proper approach will be to request rapids-cmake to provide you a static version of gtest/gbench. Since this approach doesn't work with an installed version

@@ -86,6 +86,14 @@ endif()
# ##################################################################################################
# * Configure tests function-------------------------------------------------------------

# Build and link static version of the GBench to keep ANN_BENCH self-contained.
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work when google benchmark is pre-built and coming from the environment. The sources in that case will be empty and you will fail to have any gtest/gbench in your final executable.

@robertmaynard
Copy link
Contributor

Does this make sense to do more generally? @robertmaynard are there known issues with statically linking gbench? If not, should we move this logic into rapids_cpm_gbench and make this target available for all of RAPIDS to use in this way?

The thing we lose is the ability to use the conda version of gbench/gtest since they only come as shared. So as long as we are fine with that we can update rapids-cmake to provide a static version when requested.

@robertmaynard
Copy link
Contributor

Does this make sense to do more generally? @robertmaynard are there known issues with statically linking gbench? If not, should we move this logic into rapids_cpm_gbench and make this target available for all of RAPIDS to use in this way?

I'd also like to know if we should do the same for nvbench, if applicable.

NVBench explicitly builds shared we will need to look into this

@bdice
Copy link
Contributor

bdice commented Oct 16, 2023

Does this make sense to do more generally? @robertmaynard are there known issues with statically linking gbench? If not, should we move this logic into rapids_cpm_gbench and make this target available for all of RAPIDS to use in this way?

The thing we lose is the ability to use the conda version of gbench/gtest since they only come as shared. So as long as we are fine with that we can update rapids-cmake to provide a static version when requested.

That's fine by me -- part of my incentive to align the conda versions of gbench/gtest when I last worked on it was to ensure that environments had compatible versions. This is also achieved (perhaps more cleanly) by static linkage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake cpp improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
Development

Successfully merging this pull request may close these issues.

5 participants