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

Building w/ Intel oneAPI LLVM compilers might require to explicitly set the C language version #1902

Closed
thgeorgiou opened this issue Jul 26, 2023 · 4 comments
Assignees

Comments

@thgeorgiou
Copy link

thgeorgiou commented Jul 26, 2023

Describe the bug
This is related to the recently merged #1893. Trying to build WRF w/ Intel's new oneAPI compilers produces many instances of the following error on my system:

gribgetbds.c:388:5: error: call to undeclared function 'grib_unthin'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

From the manpages it seems that ICX defaults to a more recent standard of C:

Default for Linux: c++17 The compiler conforms to the 2017 ISO C++ standard. This is true also for SYCL programs.

I am not sure if something has changed between the current version of ICX and the one tested in #1893 but being explicit about using C89 fixes the issue. This needs a small change in arch/configure.defaults:

SFC             =       ifx
SCC             =       icx -std=gnu89
CCOMP           =       icx -std=gnu89
DM_FC           =       mpif90
DM_CC           =       mpicc -std=gnu89

Using -std=c89 doesn't seem to work since it doesn't define __USE_MISC and it fails to build external/RSL_LITE/.

I suspect this is similar to what happened in #1823 and led @mgs-52 to make these changes.

To Reproduce

  1. Grab a fresh copy of WRF's source (v4.5), including the change from Intel oneAPI LLVM Compilers Configuration #1893.
  2. Check ICX version:
❯ icx --version
Intel(R) oneAPI DPC++/C++ Compiler 2023.2.0 (2023.2.0.20230622)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2023.2.0/linux/bin-llvm
Configuration file: /opt/intel/oneapi/compiler/2023.2.0/linux/bin-llvm/../bin/icx.cfg
  1. Build dependencies (OpenMPI, HDF5, netCDF4) with the same stack. No issues encountered here.
  2. Configure WRF w/ Intel oneAPI and run build script:
./configure # select 78
./compile -j 1 em_real &> compile.out

Expected behavior
A successful build of WRF without changing configure.wrf.

Attachments
I am attaching a successful build log (w/ -std=gnu89) and a failed one (w/out -std=gnu89).

compile_failed.out.txt
compile_successful.out.txt

Additional context
I am not entirely sure if there is something else that is causing this issue on my system. If you think any other information and/or tests are useful I will be happy to help. Similarly, if you think this workaround is correct and it is convenient for you, I can draft a PR for it.

@weiwangncar
Copy link
Collaborator

@islas Can you comment on this? Thanks!

@islas
Copy link
Collaborator

islas commented Jul 27, 2023

@thgeorgiou We are in fact using an older version (2022.1) of ICX which is probably why this didn't show up. I'll go ahead and test this on a system that I can get the latest compilers on

@islas
Copy link
Collaborator

islas commented Aug 15, 2023

Testing with the newer ifx compiler version does result in the same errors. Though, I went ahead and tested out #1823 as a solution to this and with a minor edit, that does resolve this issue. I would rather we pull those changes in to address new compiler warnings rather than fall back to older standards.

@islas
Copy link
Collaborator

islas commented Dec 19, 2023

Closing as #1823 has been merged into release-v4.5.2

@islas islas closed this as completed Dec 19, 2023
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

No branches or pull requests

4 participants