Skip to content

Commit

Permalink
Merge pull request #10 from LKedward/fix-ambig-generic
Browse files Browse the repository at this point in the history
Fixes to support Intel Fortran
  • Loading branch information
LKedward authored Apr 14, 2021
2 parents 125ac80 + ed6aa9a commit 99564c9
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 15 deletions.
65 changes: 59 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ name: fpm test
on: [push, pull_request]

jobs:
Build:
gfortran:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
haskell: [true, false]
include:
- os: ubuntu-latest
gcc_v: 9
Expand Down Expand Up @@ -43,13 +42,67 @@ jobs:
- name: Install fpm
uses: fortran-lang/setup-fpm@v3
with:
use-haskell: ${{ matrix.haskell }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests (fpm test)
- name: Run tests and demo programs (debug)
run: |
gfortran --version
fpm test
fpm run *-demo
- name: Run demo programs (fpm run)
run: fpm run
- name: Run tests and demo programs (release)
if: contains(matrix.os, 'ubuntu')
run: |
gfortran --version
fpm test --profile release
fpm run *-demo --profile release
Intel:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Install fpm
uses: fortran-lang/setup-fpm@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install ifort from cache
id: cache-oneapi
uses: actions/cache@v2
with:
path: |
/opt/intel/oneapi/compiler
/opt/intel/oneapi/setvars.sh
key: oneapi-cache-v0

- name: Install ifort with apt
if: steps.cache-oneapi.outputs.cache-hit != 'true'
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install intel-oneapi-ifort
sudo rm -rf /opt/intel/oneapi/compiler/latest/linux/lib/emu
sudo rm -rf /opt/intel/oneapi/compiler/latest/linux/lib/oclfpga
- name: Setup ifort env
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Run tests and demo programs (debug)
run: |
ifort --version
fpm test --compiler ifort
fpm run *-demo --compiler ifort
- name: Run tests and demo programs (release)
run: |
ifort --version
fpm test --compiler ifort --profile release
fpm run *-demo --compiler ifort --profile release
2 changes: 1 addition & 1 deletion app/2-derived-type-demo/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ subroutine fhash_get_string(tbl,k,string)
integer :: stat
class(*), allocatable :: data

call tbl%get(k,data,stat)
call tbl%get_raw(k,data,stat)

if (stat /= 0) print *, 'error ', stat! Error handling: key not found

Expand Down
5 changes: 3 additions & 2 deletions src/fhash_tbl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ module fhash_tbl
generic :: get => fhash_tbl_get_int32, fhash_tbl_get_int64
generic :: get => fhash_tbl_get_float, fhash_tbl_get_double
generic :: get => fhash_tbl_get_char, fhash_tbl_get_logical
generic :: get => fhash_tbl_get_data, fhash_tbl_get_raw
generic :: get => fhash_tbl_get_data
generic :: get_raw => fhash_tbl_get_raw

procedure :: fhash_tbl_get_int32_ptr, fhash_tbl_get_int64_ptr
procedure :: fhash_tbl_get_float_ptr, fhash_tbl_get_double_ptr
Expand All @@ -59,7 +60,7 @@ module fhash_tbl
generic :: get_ptr => fhash_tbl_get_int32_ptr, fhash_tbl_get_int64_ptr
generic :: get_ptr => fhash_tbl_get_float_ptr, fhash_tbl_get_double_ptr
generic :: get_ptr => fhash_tbl_get_char_ptr, fhash_tbl_get_logical_ptr
generic :: get_ptr => fhash_tbl_get_raw_ptr
generic :: get_raw_ptr => fhash_tbl_get_raw_ptr

final :: fhash_tbl_cleanup

Expand Down
5 changes: 0 additions & 5 deletions test/test_container.f90
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ subroutine test_container_scalar_ptr(error)
return
end if

if (.not.associated(container%scalar_ptr,my_int)) then
call test_failed(error,'Wrong association for container%scalar_ptr.')
return
end if

my_int = 10

select type(v=>container%scalar_ptr)
Expand Down
2 changes: 1 addition & 1 deletion test/test_tbl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ subroutine fhash_get_string(tbl,k,string,error)
integer :: stat
class(*), allocatable :: data

call tbl%get(k,data,stat)
call tbl%get_raw(k,data,stat)

if (stat /= 0) then
call test_failed(error,'Error while trying to retrieve derived type')
Expand Down

0 comments on commit 99564c9

Please sign in to comment.