Skip to content

scotch: add oneAPI compiler flags that disable optimizations that alter mathematical results - #81

Open
rickgrubin-noaa wants to merge 7 commits into
JCSDA:spack-stack-devfrom
rickgrubin-noaa:bugfix/scotch-div-by-zero
Open

scotch: add oneAPI compiler flags that disable optimizations that alter mathematical results#81
rickgrubin-noaa wants to merge 7 commits into
JCSDA:spack-stack-devfrom
rickgrubin-noaa:bugfix/scotch-div-by-zero

Conversation

@rickgrubin-noaa

Copy link
Copy Markdown
Collaborator

Add oneAPI compiler flags that disable optimizations that alter mathematical results

For Intel OneAPI C and Fortran compilers, set the following flags for the scotch package recipe:

  • -fp-model=precise
    • Disables value-unsafe floating-point optimizations to ensure consistent numerical accuracy; results are predictable and reproducible across compiler versions.
  • -fp-speculation=safe
    • Disables speculation if there is a chance it might cause a floating-point exception.

These are set for CMAKE_{C,Fortran}_FLAGS to cover all build configuration types (Debug, Release, RelWithDebInfo, MinSizeRel).

Also changes the build_system() conditional so that cmake is the gated default for v7: and makefile is gated to older versions, and constrain oneAPI builds to use cmake.

Fixes: JCSDA/spack-stack#2075

Testing

Build test envs on hercules and orion with this PR's code changes; results are satisfactory, see here; @gspetro-NOAA has successfully run full regression tests.

A PR for authoritative spack-packages will also be created in the event that the PR for scotch either isn't accepted or is not merged prior to the next spack-stack release

version("5.1.10b", sha256="54c9e7fafefd49d8b2017d179d4f11a655abe10365961583baaddc4eeb6a9add")

build_system(conditional("cmake", when="@7:"), "makefile", default="cmake")
build_system("cmake", conditional("makefile", when="@:6"), default="cmake")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I understand correctly, this means that for versions 6 and earlier, both cmake and makefile are an option, and the default is cmake?

The original line 47 to me reads like cmake available from version 7 and makefile available for all versions, suggesting that the cmake build wasn't available for versions 6 and earlier?

If I am right (probably not ...) and our goal is to switch from makefile for version 6 to cmake for version 7, then this is sufficient?

build_system("make", when="@:6"))
build_system("cmake", when="@7:"))

The issue with that is that line 48 effectively precludes building scotch@:6 with oneapi. But maybe that's ok. After all, we weren't able to build scotch with oneapi until recently.

@AlexanderRichert-NOAA thoughts?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If I understand correctly, this means that for versions 6 and earlier, both cmake and makefile are an option, and the default is cmake?

The original line 47 to me reads like cmake available from version 7 and makefile available for all versions, suggesting that the cmake build wasn't available for versions 6 and earlier?

7: -- only cmake for build system
:6 -- cmake or makefile, default cmake

based on your comment from JCSDA/spack-stack#2075

If I am right (probably not ...) and our goal is to switch from makefile for version 6 to cmake for version 7, then this is sufficient?

build_system("make", when="@:6"))
build_system("cmake", when="@7:"))

I was trying to allow cmake or makefile for :6 but restrict to cmake for 7: -- if it's best to only build with makefile for :6, your suggestion does that. I am certainly agnostic about it.

The issue with that is that line 48 effectively precludes building scotch@:6 with oneapi. But maybe that's ok. After all, we weren't able to build scotch with oneapi until recently.

That is the point of line 48.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Understood. git diff can be so confusing. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is not working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCOTCH built with Intel oneAPI require -fp-speculation=safe to avoid a divide by zero error in UFS-WM debug runs

2 participants