Skip to content

Commit 2e80c59

Browse files
Merge pull request #48 from FluidNumerics/bugfix/45-llvm-flang21
Bugfix/45 llvm flang21
2 parents eb3889c + b7b0897 commit 2e80c59

15 files changed

Lines changed: 80 additions & 852 deletions
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: linux-llvmflang-cmake
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths-ignore:
9+
- 'AUTHORS.md'
10+
- 'LICENSE.md'
11+
- 'README.md'
12+
pull_request:
13+
paths-ignore:
14+
- 'AUTHORS.md'
15+
- 'LICENSE.md'
16+
- 'README.md'
17+
18+
jobs:
19+
linux-tests:
20+
timeout-minutes: 20
21+
if: "!contains(github.event.head_commit.message, 'skip ci')"
22+
name: ${{ matrix.os }} - flang-new-${{ matrix.llvm_version }} - ${{ matrix.build_type }}
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- os: ubuntu-24.04
29+
llvm_version: 19
30+
build_type: debug
31+
32+
- os: ubuntu-24.04
33+
llvm_version: 20
34+
build_type: debug
35+
36+
defaults:
37+
run:
38+
shell: bash
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
- name: Install LLVM Flang
44+
run: |
45+
wget https://apt.llvm.org/llvm.sh
46+
chmod +x llvm.sh
47+
sudo ./llvm.sh ${{ matrix.llvm_version }}
48+
sudo apt-get install -y flang-${{ matrix.llvm_version }}
49+
50+
- name: Show version information
51+
run: |
52+
flang-new-${{ matrix.llvm_version }} --version
53+
clang-${{ matrix.llvm_version }} --version
54+
55+
- name: Build with Cmake
56+
run: |
57+
mkdir build
58+
cd build
59+
FC=flang-new-${{ matrix.llvm_version }} CC=clang-${{ matrix.llvm_version }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../
60+
make VERBOSE=1
61+
62+
- name: Run ctests
63+
run: |
64+
cd build/test
65+
ctest || ctest --rerun-failed --output-on-failure

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,24 @@ elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "IntelLLVM" )
7171
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
7272

7373
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Flang" )
74+
# Classic Flang (PGI-derived)
7475
set( CMAKE_Fortran_FLAGS "-Mpreprocess" )
7576
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -O0 -g -Wall -pedantic" )
76-
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available with ifx
77+
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available
78+
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
79+
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
80+
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
81+
82+
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LLVMFlang" )
83+
# LLVM Flang (flang-new, LLVM-based) - uses GCC-style flags
84+
set( CMAKE_Fortran_FLAGS "-cpp" )
85+
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -Wall -pedantic" )
86+
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available
7787
set( CMAKE_Fortran_FLAGS_PROFILE "-O3")
7888
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )
7989
set( CMAKE_C_FLAGS_COVERAGE "-g -O0")
8090

81-
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "NVHPC" )
91+
elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "NVHPC" )
8292
set( CMAKE_Fortran_FLAGS "-Mpreprocess" )
8393
set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -O0 -Wall -C -g -traceback" )
8494
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available with ifx

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Copyright 2020 Fluid Numerics LLC
1010

1111
[![linux-amdflang-cmake](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-amdflang-cmake.yaml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-amdflang-cmake.yaml)
1212
[![linux-nvfortran-cmake](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-nvfortran-cmake.yaml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-nvfortran-cmake.yaml)
13+
[![linux-llvmflang-cmake](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-llvmflang-cmake.yaml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions/workflows/linux-llvmflang-cmake.yaml)
1314

1415
[![windows-gnu-cmake](https://github.com/fluidnumerics/feq-parse/actions/workflows/windows-gnu-cmake.yml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions/workflows/windows-gnu-cmake.yml)
1516
[![windows-gnu-fpm](https://github.com/fluidnumerics/feq-parse/actions/workflows/windows-gnu-fpm.yml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions/workflows/windows-gnu-fpm.yml)
@@ -134,6 +135,7 @@ GNU Fortran | 13.2.0 | Windows Server 2022 (10.0.20348 Build 1547) (MSYS2) | `fp
134135
Intel oneAPI (`ifx`)| 2023.2 | Ubuntu 22.04.2 LTS | `fpm`, `cmake` | x86_64
135136
Intel oneAPI classic (`ifort`) | 2021.1 | Ubuntu 22.04.2 LTS | `fpm`, `cmake` | x86_64
136137
Nvidia HPC (`nvfortran`) | 23.11 | Ubuntu 22.04.2 LTS | `cmake` | x86_64
138+
LLVM Flang (`flang-new`) | 19, 20 | Ubuntu 24.04 LTS | `cmake` | x86_64
137139

138140
## Usage
139141

src/FEQParse_Functions.f90

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module FEQParse_Functions
2929

3030
implicit none
3131

32-
integer,public :: nFunctions = 17
32+
integer,public :: nFunctions = 16
3333
integer,protected,public :: maxFunctionLength = 0
3434
integer,parameter :: maxFunctions = 100
3535
logical :: isInitialized = .false.
@@ -51,7 +51,6 @@ module FEQParse_Functions
5151
enumerator :: asin_function = 14
5252
enumerator :: atan_function = 15
5353
enumerator :: sech_function = 16
54-
enumerator :: rand_function = 17
5554
endenum
5655

5756
private
@@ -104,18 +103,6 @@ pure real(real64) function f64(x)
104103

105104
type(FEQParse_Function),public :: Functions(maxFunctions)
106105

107-
interface
108-
pure real(real32) function randomize_r32()
109-
import
110-
endfunction
111-
endinterface
112-
113-
interface
114-
pure real(real64) function randomize_r64()
115-
import
116-
endfunction
117-
endinterface
118-
119106
interface AddFunction
120107
module procedure :: AddFunction32
121108
module procedure :: AddFunction64
@@ -268,10 +255,6 @@ subroutine InitializeFunctions()
268255
Functions(sech_function)%ptr32 => sech32
269256
Functions(sech_function)%ptr64 => sech64
270257

271-
Functions(rand_function) = Tuple("rand","RAND")
272-
Functions(rand_function)%ptr32 => rand32
273-
Functions(rand_function)%ptr64 => rand64
274-
275258
isInitialized = .true.
276259
endsubroutine InitializeFunctions
277260

@@ -473,24 +456,6 @@ pure real(real64) function sech64(x) result(fx)
473456
fx = 2.0_real64/(exp(x)+exp(-x))
474457
endfunction
475458

476-
pure real(real32) function rand32(x) result(fx)
477-
real(real32),intent(in) :: x
478-
!private
479-
real(real32) :: r
480-
associate(r => randomize_r32())
481-
fx = r*x
482-
endassociate
483-
endfunction
484-
485-
pure real(real64) function rand64(x) result(fx)
486-
real(real64),intent(in) :: x
487-
!private
488-
real(real64) :: r
489-
associate(r => randomize_r64())
490-
fx = r*x
491-
endassociate
492-
endfunction
493-
494459
pure function ToUpperCase(str) result(res)
495460
character(*),intent(in) :: str
496461
character(len(str)) :: res
@@ -507,19 +472,3 @@ pure function ToUpperCase(str) result(res)
507472
endfunction ToUpperCase
508473

509474
endmodule FEQParse_Functions
510-
511-
real(real32) function randomize_r32()
512-
use,intrinsic :: iso_fortran_env,only:real32
513-
real(real32) :: r
514-
515-
call random_number(r)
516-
randomize_r32 = r
517-
endfunction
518-
519-
real(real64) function randomize_r64()
520-
use,intrinsic :: iso_fortran_env,only:real64
521-
real(real64) :: r
522-
523-
call random_number(r)
524-
randomize_r64 = r
525-
endfunction

test/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,6 @@ add_fortran_tests (
154154
"monadic_r4fp64.f90"
155155
"monadic_sfp32.f90"
156156
"monadic_sfp64.f90"
157-
"random_r1fp32.f90"
158-
"random_r1fp64.f90"
159-
"random_r2fp32.f90"
160-
"random_r2fp64.f90"
161-
"random_r3fp32.f90"
162-
"random_r3fp64.f90"
163-
"random_r4fp32.f90"
164-
"random_r4fp64.f90"
165-
"random_sfp32.f90"
166-
"random_sfp64.f90"
167157
"sech_r1fp32.f90"
168158
"sech_r1fp64.f90"
169159
"sech_r2fp32.f90"

test/random_r1fp32.f90

Lines changed: 0 additions & 72 deletions
This file was deleted.

test/random_r1fp64.f90

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)