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

make sure that OpenFOAM's wmake can find MPFR and GMP if CGAL >= 5.0 (header-only) is used #3366

Merged
merged 9 commits into from
Jun 18, 2024

Conversation

bedroge
Copy link
Contributor

@bedroge bedroge commented Jun 17, 2024

With EESSI we ran into several undefined references to GMP and MPFR when building OpenFOAM v2312, see EESSI/software-layer#563 (comment)

This seems related to CGAL, which is header-only since version 5.0. Apparently, here's still some kind of indirect dependency on GMP and MPFR (the Ubuntu installation instructions also have these packages listed: https://gitlab.com/openfoam/openfoam/-/blob/master/doc/Requirements.md#ubuntu-eg-2204), which are lacking in the EESSI build container.

Even though OpenFOAM's wmake scripts seems to contain functionality for handling these situations (there is a cgal-no-mpfr rule, for instance: https://gitlab.com/openfoam/openfoam/-/blob/master/wmake/rules/General/cgal-no-mpfr?ref_type=heads), there are lots of issues about the same topic, e.g. this one related to Spack: https://develop.openfoam.com/Development/openfoam/-/issues/3101.
They even stick to CGAL 4.x: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/openfoam/package.py#L372.

This PR fixes this by overriding some variables in the have_cgal script, which finds CGAL and MPFR, in case CGAL >= 5.0 is used and MPFR is listed as dependency in the easyconfig. For the latter I'll open an easyconfigs PR.

@bedroge bedroge added bug fix EESSI Related to EESSI project labels Jun 17, 2024
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

easybuild/easyblocks/o/openfoam.py Outdated Show resolved Hide resolved
@@ -292,6 +292,25 @@ def configure_step(self):
env.setvar("BOOST_ROOT", get_software_root('Boost'))
else:
env.setvar("%s_ROOT" % depend.upper(), dependloc)
for dep in self.cfg.dependencies():
# CGAL >= 5.x is header-only, but when using it OpenFOAM still needs MPFR and GMP.
Copy link
Member

Choose a reason for hiding this comment

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

comment mentions GMP, but nothing is being done for GMP below, only MPFR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good question. It does look like it needs GMP, but there's no GMP_LIB_DIR... In for instance https://develop.openfoam.com/Development/openfoam/-/blob/OpenFOAM-v2312/wmake/rules/General/cgal-header-only?ref_type=tags they do add -lgmp. So I'm not completely sure what to do here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the current approach it does build fine, but we did have undefined references to GMP before. So I guess it does somehow find GMP.

Copy link
Contributor Author

@bedroge bedroge Jun 18, 2024

Choose a reason for hiding this comment

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

I checked the successful build from EESSI/software-layer#563 (comment) (without any modules loaded):

bedroge@x86-64-amd-zen3-node3 /project/def-users/SHARED/jobs/2024.06/pr_563/12933 $ ldd /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/OpenFOAM/v2312-foss-2023a/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/bin/* | grep -i mpfr
	libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001540bb46c000)
	libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001513a0015000)
	libmpfr.so.6 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/MPFR/4.2.0-GCCcore-12.3.0/lib/../lib64/libmpfr.so.6 (0x00001554b0428000)
bedroge@x86-64-amd-zen3-node3 /project/def-users/SHARED/jobs/2024.06/pr_563/12933 $ ldd /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/OpenFOAM/v2312-foss-2023a/OpenFOAM-v2312/platforms/linux64GccDPInt32Opt/bin/* | grep -i gmp 
	libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x0000148dbb6f7000)
	libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x00001530f2753000)
	libgmp.so.10 => /cvmfs/software.eessi.io/versions/2023.06/software/linux/x86_64/amd/zen3/software/GMP/6.2.1-GCCcore-12.3.0/lib/../lib64/libgmp.so.10 (0x000014d73d988000)

So it did indeed pick up the right GMP.

easybuild/easyblocks/o/openfoam.py Outdated Show resolved Hide resolved
easybuild/easyblocks/o/openfoam.py Outdated Show resolved Hide resolved
easybuild/easyblocks/o/openfoam.py Outdated Show resolved Hide resolved
@boegel
Copy link
Member

boegel commented Jun 18, 2024

@bedroge CI problem not related to changes here is fixed via #3365, this PR needs a sync with develop

@bedroge
Copy link
Contributor Author

bedroge commented Jun 18, 2024

@bedroge CI problem not related to changes here is fixed via #3365, this PR needs a sync with develop

@boegel done!

@boegel
Copy link
Member

boegel commented Jun 18, 2024

@boegelbot please test @ jsc-zen3
CORE_CNT=16
EB_ARGS="OpenFOAM-v2306-foss-2022b.eb OpenFOAM-v2312-foss-2023a.eb OpenFOAM-11-foss-2023a.eb"

@boegel boegel added this to the 4.x milestone Jun 18, 2024
@boegelbot
Copy link

@boegel: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de

PR test command 'if [[ develop != 'develop' ]]; then EB_BRANCH=develop ./easybuild_develop.sh 2> /dev/null 1>&2; EB_PREFIX=/home/boegelbot/easybuild/develop source init_env_easybuild_develop.sh; fi; EB_PR=3366 EB_ARGS="OpenFOAM-v2306-foss-2022b.eb OpenFOAM-v2312-foss-2023a.eb OpenFOAM-11-foss-2023a.eb" EB_REPO=easybuild-easyblocks EB_BRANCH=develop /opt/software/slurm/bin/sbatch --job-name test_PR_3366 --ntasks="16" ~/boegelbot/eb_from_pr_upload_jsc-zen3.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 4410

Test results coming soon (I hope)...

- notification for comment with ID 2176198762 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link

Test report by @boegelbot

Overview of tested easyconfigs (in order)

  • SUCCESS OpenFOAM-v2312-foss-2023a.eb
  • SUCCESS OpenFOAM-11-foss-2023a.eb
  • SUCCESS CGAL-5.5.2-GCCcore-12.2.0.eb
  • SUCCESS KaHIP-3.14-gompi-2022b.eb
  • SUCCESS ParaView-5.11.1-foss-2022b.eb
  • SUCCESS OpenFOAM-v2306-foss-2022b.eb

Build succeeded for 6 out of 6 (3 easyconfigs in total)
jsczen3c1.int.jsc-zen3.fz-juelich.de - Linux Rocky Linux 9.4, x86_64, AMD EPYC-Milan Processor (zen3), Python 3.9.18
See https://gist.github.com/boegelbot/4c3df7bafdc01173936f5fa45d5da93c for a full test report.

boegel
boegel previously approved these changes Jun 18, 2024
@bedroge bedroge dismissed boegel’s stale review June 18, 2024 20:34

The merge-base changed after approval.

@boegel boegel merged commit d1f2231 into easybuilders:develop Jun 18, 2024
41 checks passed
@boegel boegel modified the milestones: 4.x, release after 4.9.2 Jun 18, 2024
@bedroge bedroge deleted the openfoam_cgal branch June 18, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix EESSI Related to EESSI project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants