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

Numerical issues caused by unsafe IntelLLVM flags #52

Open
kvrigor opened this issue Jan 24, 2025 · 1 comment
Open

Numerical issues caused by unsafe IntelLLVM flags #52

kvrigor opened this issue Jan 24, 2025 · 1 comment
Labels
build-issue Build errors and other compiler-related issues. runtime-issue Running eCLM results to something unexpected (e.g. error, hang-up, incorrect outputs)

Comments

@kvrigor
Copy link
Member

kvrigor commented Jan 24, 2025

Background: Since Stages/2023 the MPI compiler backend defaults to IntelLLVM. Classic Intel compilers are still accessible by passing the appropriate option to the MPI compiler:

module load IntelMPI
export CC='mpiicc -cc=icc'
export FC='mpiifort -f90=ifort'
export CXX='mpiicpc -cxx=icpc'

@AGonzalezNicolas ran tests comparing CLM5 and eCLM. Results show non-zero differences for IntelLLVM-compiled eCLM, yet absolute zero errors when classic Intel was used. This brings to question the correctness of the compile flags being passed to IntelLLVM.

While we could get away with sticking with classic Intel compilers, the doomsday warning below urges us to migrate to IntelLLVM soon:

$ mpicc -cc=icc --version
icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated
and will be removed from product release in the second half of 2023. The
Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler
moving forward. Please transition to use this compiler. Use '-diag-disable=10441'
to disable this message.

icc (ICC) 2021.10.0 20230609
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.
@kvrigor
Copy link
Member Author

kvrigor commented Jan 24, 2025

As a first step towards a fix, I'd suggest to split Intel and IntelLLVM in SetBuildOptions.cmake:

elseif(COMPILER STREQUAL "Intel" OR COMPILER STREQUAL "IntelLLVM")
add_compile_definitions(CPRINTEL)
set(CMAKE_C_FLAGS "-qno-opt-dynamic-align -std=gnu99 -fp-model precise -qopenmp")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal")
set(CMAKE_Fortran_FLAGS "-free -qno-opt-dynamic-align -ftz -traceback -convert big_endian -assume byterecl -assume realloc_lhs -fp-model source -qopenmp")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -fpe0 -check all")
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal")

It makes sense to start with the most conservative flags suggested in the Classic ifort to LLVM ifx Porting Guide. COMPILER=IntelLLVM should contain the following:

  • add_compile_definitions(CPRINTEL)
  • Same CMAKE_C_FLAGS, CMAKE_C_FLAGS_DEBUG, and CMAKE_C_FLAGS_RELEASE as COMPILER=Intel
  • Change CMAKE_Fortran_FLAGS:
    • -warn all: Check for compile-time warnings
    • -check all: Enable runtime checks
    • -standard-semantics: Obey Fortran semantics for expressions
    • -fpmodel=precise: Use precise floating-point settings
  • Change CMAKE_Fortran_FLAGS_DEBUG:
    • O0: Disable optimization
    • -g -traceback: Create debug symbols and print stacktrace on crash
    • -no-simd: Turn off default OpenMP SIMD
  • Change CMAKE_Fortran_FLAGS_RELEASE:
    • O0: Disable optimization

Note: There's also a Porting Guide from Classic C/C++ to LLVM-based C/DPC++. We can check the C flags after we tame the IntelLLVM-based Fortran compiler 😃

@kvrigor kvrigor added runtime-issue Running eCLM results to something unexpected (e.g. error, hang-up, incorrect outputs) build-issue Build errors and other compiler-related issues. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-issue Build errors and other compiler-related issues. runtime-issue Running eCLM results to something unexpected (e.g. error, hang-up, incorrect outputs)
Projects
None yet
Development

No branches or pull requests

1 participant