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

Remove pic flag from cmake file. #736

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

MFraters
Copy link
Member

@MFraters MFraters commented Jun 4, 2024

The -fPIC flag should be automatically set by cmake, so there is no need to specify it manually. @bangerth @tjhei

Copy link
Contributor

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

That seems like the right choice.

@bangerth
Copy link
Contributor

bangerth commented Jun 4, 2024

I believe that the problem is that the CMakeLists.txt file builds a static library that is then later used to link into a shared library or PIC executable. There are multiple ways to achieve what you want:

My personal opinion is that you should be building a shared library as it minimizes link times for downstream projects. But that's just my opinion.

@MFraters MFraters force-pushed the simplify_cmake_pic branch from 263f11f to adb0299 Compare June 4, 2024 22:53
Copy link

github-actions bot commented Jun 4, 2024

Benchmark Main Feature Difference (99.9% CI)
Slab interpolation simple none 1.014 ± 0.003 (s=432) 1.021 ± 0.006 (s=455) +0.6% .. +0.9%
Slab interpolation curved simple none 1.018 ± 0.004 (s=450) 1.022 ± 0.004 (s=435) +0.3% .. +0.4%
Spherical slab interpolation simple none 1.185 ± 0.007 (s=378) 1.186 ± 0.006 (s=384) +0.0% .. +0.3%
Slab interpolation simple curved CMS 1.064 ± 0.004 (s=436) 1.061 ± 0.004 (s=414) -0.3% .. -0.2%
Spherical slab interpolation simple CMS 1.592 ± 0.010 (s=260) 1.592 ± 0.010 (s=308) -0.2% .. +0.2%
Spherical fault interpolation simple none 1.192 ± 0.010 (s=375) 1.190 ± 0.011 (s=383) -0.4% .. +0.0%
Cartesian min max surface 2.327 ± 0.018 (s=196) 2.311 ± 0.019 (s=195) -1.0% .. -0.4%
Spherical min max surface 7.216 ± 0.029 (s=65) 7.238 ± 0.101 (s=62) -0.3% .. +0.9%

@MFraters
Copy link
Member Author

MFraters commented Jun 4, 2024

Thanks for the advice on how to fix this.

My personal opinion is that you should be building a shared library as it minimizes link times for downstream projects. But that's just my opinion.

I personally like the fact that the the library is compiled into the executable, since it make the executable self contained and even allows the executable to be moved, but I can see that shorter linking times may also be nice and maybe be more useful in practice. I would suggest just fixing this now, and move the static vs dynamic library discussion into a separate issue and potentially a separate pull request.

@bangerth
Copy link
Contributor

bangerth commented Jun 5, 2024

Yes, these are independent questions.

Copy link
Contributor

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

This looks correct to me now, and it also seems to work.

@tjhei tjhei merged commit 9303ad8 into GeodynamicWorldBuilder:main Jun 5, 2024
38 checks passed
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.

3 participants