Skip to content

Commit

Permalink
Add complex return detection for nvfortran (flame#765)
Browse files Browse the repository at this point in the history
Details:
- Search for Intel ifx and NVIDIA/PGI Fortran compilers.
- Correctly determine the Fortran compiler vendor for Intel ifx and NVIDIA/PGI compilers.
- Determine the compiler version and correct Fortran complex return type for NVIDIA/PGI.
  • Loading branch information
jeffhammond authored Nov 29, 2024
1 parent 50b7117 commit 12f2efa
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ get_fc_search_list()
{
local list

list="gfortran ifort"
list="gfortran ifort ifx nvfortran"

echo "${list}"
}
Expand Down Expand Up @@ -4229,11 +4229,37 @@ blis_main()
# Query the compiler "vendor" (ie: the compiler's simple name).
# The last part ({ read first rest ; echo $first ; }) is a workaround
# to OS X's egrep only returning the first match.
fc_vendor=$(echo "${vendor_string}" | grep -oE 'IFORT|GNU' |
fc_vendor=$(echo "${vendor_string}" | grep -oE 'IFORT|IFX|GNU|NVIDIA|PGI' |
{ read -r first rest ; echo "${first}"; })

if [[ ${fc_vendor} = IFORT ]]; then
if [[ ${fc_vendor} = IFORT || ${fc_vendor} = IFX ]]; then
complex_return='intel'
elif [[ ${fc_vendor} = NVIDIA || ${fc_vendor} = PGI ]]; then
# On x86_64 and aarch64 prior to 23.9, nvfortran
# uses the 'intel' convention.
# On and ppc64le and aarch64 starting with 23.9,
# the convention is 'gnu'.
if [[ "$(uname -m)" = "aarch64" ]]; then
fc_version=$(echo "${vendor_string}" \
| grep -oE '[0-9]+\.[0-9]+\.?[0-9]*' \
| { read -r first rest ; echo "${first}"; })
if [[ ${fc_version:0:2} -lt 23 ]]; then
complex_return='intel'
elif [[ ${fc_version:0:2} -eq 23 ]]; then
# Use 3:5 because minor version numbers include 1 and 11.
if [[ ${fc_version:3:5} -lt 9 ]]; then
complex_return='intel'
else
complex_return='gnu'
fi
else
complex_return='gnu'
fi
elif [[ "$(uname -m)" = "ppc64le" ]]; then
complex_return='gnu'
else
complex_return='intel'
fi
elif [[ ${fc_vendor} = GNU ]]; then
complex_return='gnu'
else
Expand Down

0 comments on commit 12f2efa

Please sign in to comment.