Skip to content

Commit

Permalink
240410.005715.HKT fortran: shift ftest from Classic Flang to LLVM F…
Browse files Browse the repository at this point in the history
…lang
  • Loading branch information
zaikunzhang committed Apr 9, 2024
1 parent fda2888 commit 1c23116
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 25 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ jobs:
fail-fast: false
matrix:
toolchain:
# Flang family with -Mchkptr would fail. See https://forums.developer.nvidia.com/t/bug-in-nvfortran-with-mchkptr-for-unallocated-optional-arguments/223220
# As of 20240220, flang and aflang with -Mbounds would fail due to the bug at https://github.com/flang-compiler/flang/issues/1238
# Classic Flang family with -Mchkptr would fail. See https://forums.developer.nvidia.com/t/bug-in-nvfortran-with-mchkptr-for-unallocated-optional-arguments/223220
# As of 20240220, aflang with -Mbounds would fail due to the bug at https://github.com/flang-compiler/flang/issues/1238
- {compiler: nvfortran, cflags: '-Wall', fflags: '-C -Wall -Wextra -Minform=warn -Mstandard -Mrecursive -Mbounds -Mchkstk'}
- {compiler: flang, cflags: '-Wall', fflags: '-pedantic -Weverything -Wall -Wextra -Minform=warn -Mstandard -Mrecursive'}
- {compiler: flang, cflags: '-Wall', fflags: '-pedantic'}
- {compiler: aflang, cflags: '-Wall', fflags: '-pedantic -Weverything -Wall -Wextra -Minform=warn -Mstandard -Mrecursive'}

steps:
Expand Down Expand Up @@ -205,8 +205,8 @@ jobs:
cmake --build . --target install
cmake --build . --target tests
# As of 20240316, CMake test fails on cobyla with the Classic flang, AOCC flang, and
# nvfortran. See https://github.com/libprima/prima/issues/165
# As of 20240316, CMake test fails on cobyla with the AOCC flang and nvfortran.
# See https://github.com/libprima/prima/issues/165
ctest --output-on-failure -V -E "stress|cobyla"
shell: bash
env:
Expand Down
7 changes: 5 additions & 2 deletions fortran/common/consts.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module consts_mod
!
! Started: July 2020
!
! Last Modified: Saturday, March 16, 2024 AM01:29:42
! Last Modified: Wednesday, April 10, 2024 AM12:54:17
!--------------------------------------------------------------------------------------------------!

!--------------------------------------------------------------------------------------------------!
Expand Down Expand Up @@ -155,7 +155,10 @@ module consts_mod
integer, parameter :: HALF_MAXPOW10 = floor(real(MAXPOW10) / 2.0)

! TINYCV is used in LINCOA. Powell set TINYCV = 1.0D-60. What about setting TINYCV = REALMIN?
real(RP), parameter :: TINYCV = TEN**max(-60, -MAXPOW10)
!real(RP), parameter :: TINYCV = TEN**max(-60, -MAXPOW10)
! The above code would lead to a warning with LLVM flang 19.0. See
! https://fortran-lang.discourse.group/t/flang-new-19-0-warning-overflow-on-power-with-integer-exponent/7801
real(RP), parameter :: TINYCV = TEN**max(-60.0, -real(MAXPOW10))
! FUNCMAX is used in the moderated extreme barrier. All function values are projected to the
! interval [-FUNCMAX, FUNCMAX] before passing to the solvers, and NaN is replaced with FUNCMAX.
! CONSTRMAX plays a similar role for constraints.
Expand Down
2 changes: 1 addition & 1 deletion fortran/examples/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ compliant with Fortran 2008 and above.
5. As of March 2024, the examples run successfully with the following compilers on Ubuntu 22.04.
- AMD AOCC Flang 4.2
- Arm Fortran Compiler 23.10
- Classic Flang 17.0
- LLVM Flang 19.0
- GNU gfortran 13.1
- Intel ifx 2024.0
- Intel ifort 2021.11.1
Expand Down
4 changes: 2 additions & 2 deletions fortran/examples/bobyqa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
AFLANG := $(shell find -L /opt/AMD -type f -executable -name flang -print 2> /dev/null | sort | tail -n 1)
dtest: FC := $(AFLANG) -Wall -Wextra -std=f$(FSTD) -Mstandard

# Flang
ftest: FC := flang -Wall -Wextra -std=f$(FSTD) -Mstandard
# LLVM Flang
ftest: FC := flang -std=f$(FSTD)

# GNU gfortran: due to `error stop` and `backtrace`, we must either compile wit no `-std` or
# use `-std=f20xy -fall-intrinsics` with xy >= 18.
Expand Down
4 changes: 2 additions & 2 deletions fortran/examples/cobyla/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
AFLANG := $(shell find -L /opt/AMD -type f -executable -name flang -print 2> /dev/null | sort | tail -n 1)
dtest: FC := $(AFLANG) -Wall -Wextra -std=f$(FSTD) -Mstandard

# Flang
ftest: FC := flang -Wall -Wextra -std=f$(FSTD) -Mstandard
# LLVM Flang
ftest: FC := flang -std=f$(FSTD)

# GNU gfortran: due to `error stop` and `backtrace`, we must either compile wit no `-std` or
# use `-std=f20xy -fall-intrinsics` with xy >= 18.
Expand Down
4 changes: 2 additions & 2 deletions fortran/examples/lincoa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
AFLANG := $(shell find -L /opt/AMD -type f -executable -name flang -print 2> /dev/null | sort | tail -n 1)
dtest: FC := $(AFLANG) -Wall -Wextra -std=f$(FSTD) -Mstandard

# Flang
ftest: FC := flang -Wall -Wextra -std=f$(FSTD) -Mstandard
# LLVM Flang
ftest: FC := flang -std=f$(FSTD)

# GNU gfortran: due to `error stop` and `backtrace`, we must either compile wit no `-std` or
# use `-std=f20xy -fall-intrinsics` with xy >= 18.
Expand Down
4 changes: 2 additions & 2 deletions fortran/examples/newuoa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
AFLANG := $(shell find -L /opt/AMD -type f -executable -name flang -print 2> /dev/null | sort | tail -n 1)
dtest: FC := $(AFLANG) -Wall -Wextra -std=f$(FSTD) -Mstandard

# Flang
ftest: FC := flang -Wall -Wextra -std=f$(FSTD) -Mstandard
# LLVM Flang
ftest: FC := flang -std=f$(FSTD)

# GNU gfortran: due to `error stop` and `backtrace`, we must either compile wit no `-std` or
# use `-std=f20xy -fall-intrinsics` with xy >= 18.
Expand Down
4 changes: 2 additions & 2 deletions fortran/examples/uobyqa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
AFLANG := $(shell find -L /opt/AMD -type f -executable -name flang -print 2> /dev/null | sort | tail -n 1)
dtest: FC := $(AFLANG) -Wall -Wextra -std=f$(FSTD) -Mstandard

# Flang
ftest: FC := flang -Wall -Wextra -std=f$(FSTD) -Mstandard
# LLVM Flang
ftest: FC := flang -std=f$(FSTD)

# GNU gfortran: due to `error stop` and `backtrace`, we must either compile wit no `-std` or
# use `-std=f20xy -fall-intrinsics` with xy >= 18.
Expand Down
14 changes: 7 additions & 7 deletions fortran/tests/makefiles/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 9: G95 (compilation only; no compilation of test_*.f90 and other testing code, which contains F03 constructs unsupported by G95)
# a: Absoft af95 (compilation only; the compiler is buggy and not maintained anymore)
# d: AOCC flang
# f: Classic flang or Huawei Bisheng flang
# f: LLVM flang
# g: GNU gfortran
# n: NAG nagfor
# i: Intel ifort
Expand Down Expand Up @@ -160,7 +160,7 @@ CHCKTST := $(TOOLS_DIR)/checktest
# Define the tests.
######################################################################################
# Decide whether to test QP, i.e., REAL128.
# Flang 17.0 and nvfortran 24.1 do not support REAL128;
# Classic Flang 17.0 and nvfortran 24.1 do not support REAL128;
# AOCC Flang 4.2 complains about a symbol lookup error: undefined symbol: "fort_rnumq_i8";
TESTS_QP = atest gtest ntest itest stest 9test xtest
TESTS_NO_QP = dtest ftest rtest vtest
Expand Down Expand Up @@ -383,18 +383,18 @@ dtest_i2_r16_d1_tst_c dtest_i4_r16_d1_tst_c dtest_i8_r16_d1_tst_c dtest_i2_r16_d
dtest_i2_r16_d1_tst_c dtest_i4_r16_d1_tst_c dtest_i8_r16_d1_tst_c dtest_i2_r16_d0_tst_c dtest_i4_r16_d0_tst_c dtest_i8_r16_d0_tst_c: \
FCF := $(DFORT) -ffp-exception-behavior=strict $(DFF)

# Classic Flang
# LLVM Flang
# We must define FFORT as follows, because AOCC will also provide "flang", except that it is
# located under /opt/AMD. Similar for ARM Flang.
FFORT := $(shell find -L /usr/bin /usr/local/bin ${HOME}/local ${HOME}/.local /tmp -type f -executable -name flang -print 2>/dev/null | sort | tail -n 1)
FFINC := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/include
FFLIB := $(shell dirname $$(dirname $(FFORT) 2>/dev/null) 2>/dev/null)/lib
FFORT := $(FFORT) -I$(FFINC) -L$(FFLIB)
FFORT := $(FFORT) -pedantic-errors -Werror
FFORT := $(FFORT) -fimplicit-none -Werror
ifeq ($(TESTDIM),small)
FFORT := $(FFORT) -Mstack_arrays
FFORT := $(FFORT)
endif
FFORT := $(FFORT) -std=f$(FSTD) -pedantic -Weverything -Wall -Wextra -Minform=warn -Mstandard -Mbounds -Mrecursive -Mchkptr #-Kieee
FFORT := $(FFORT) -std=f2018 -pedantic #-Kieee

ftest_i2_r4_d1_tst_c ftest_i4_r4_d1_tst_c ftest_i8_r4_d1_tst_c ftest_i2_r4_d0_tst_c ftest_i4_r4_d0_tst_c ftest_i8_r4_d0_tst_c: \
FCO := $(FFORT) $(FFLAGSO)
Expand Down Expand Up @@ -992,7 +992,7 @@ source_%: $(SRC_DIRS)
printf "\nPreparing the source code for $@.\n" ; \
bash $(TOOLS_DIR)/gsrc ./ ; \
fi
@if echo $@ | grep -q "ftest\|rtest\|dtest"; then \
@if echo $@ | grep -q "rtest\|dtest"; then \
printf "\nPreparing the source code for $@.\n" ; \
bash $(TOOLS_DIR)/frdsrc ./ ; \
fi
Expand Down

0 comments on commit 1c23116

Please sign in to comment.