Skip to content

Commit

Permalink
Merge pull request #97 from nekStab/new_ci
Browse files Browse the repository at this point in the history
New Github Action for CI
  • Loading branch information
loiseaujc authored Jun 15, 2024
2 parents beffa01 + 18ff7dd commit 8bf79dc
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 117 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ci

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
toolchain: {compiler: gcc, version: 12, flags: ['-cpp -O3 -march=native -mtune=native']}
- os: ubuntu-latest
toolchain: {compiler: gcc, version: 13, flags: ['-cpp -O3 -march=native -mtune=native']}
- os: ubuntu-latest
toolchain: {compiler: intel-classic, version: '2021.10', flags: ['-fpp -O0 -g']}
- os: ubuntu-latest
toolchain: {compiler: intel, version: '2024.1', flags: ['-fpp -O0 -g']}
# - os: ubuntu-latest
# toolchain: {compiler: nvidia-hpc, version: '24.1', flags: ['-Mpreprocess -Ofast']}
- os: windows-latest
toolchain: {compiler: gcc, version: 13, flags: ['-cpp -O3 -march=native -mtune=native']}
# - os: windows-latest
# toolchain: {compiler: intel-classic, version: '2021.10', flags: ["/fpp /O3"]}
# - os: windows-latest
# toolchain: {compiler: intel, version: '2024.1', flags: ["/fpp /O3"]}
- os: macos-12
toolchain: {compiler: gcc, version: 13, flags: ['-cpp -O3 -march=native -mtune=native']}
# - os: macos-12
# toolchain: {compiler: intel-classic, version: '2021.10', flags: ['-fpp -O3 -xhost']}

steps:
- name: Checkout code
uses: actions/checkout@v1

- uses: fortran-lang/setup-fortran@main
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Setup Fortran Package Manager
uses: fortran-lang/setup-fpm@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- run: |
fpm test --flag "${{ join(matrix.toolchain.flags, ' ') }}"
35 changes: 0 additions & 35 deletions .github/workflows/gcc.yml

This file was deleted.

2 changes: 0 additions & 2 deletions fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ auto-executables = true
auto-tests = true
auto-examples = true
module-naming = false
link = ["blas", "lapack"]
#link = ["openblas"]

[install]
library = true
Expand Down
12 changes: 0 additions & 12 deletions src/AbstractLinops.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ module lightkrylov_AbstractLinops
character*128, parameter :: this_module = 'Lightkrylov_AbstractLinops'

type, abstract, public :: abstract_linop
contains
private
procedure, pass(from), public :: copy
generic, public :: assignment(=) => copy
end type abstract_linop

!------------------------------------------------------------------------------
Expand Down Expand Up @@ -390,14 +386,6 @@ end subroutine abstract_matvec_cdp

contains

subroutine copy(out, from)
class(abstract_linop), intent(in) :: from
class(abstract_linop), allocatable, intent(out) :: out
if (allocated(out)) deallocate(out)
allocate(out, source=from)
return
end subroutine copy

subroutine id_matvec_rsp(self, vec_in, vec_out)
class(Id_rsp), intent(in) :: self
class(abstract_vector_rsp), intent(in) :: vec_in
Expand Down
12 changes: 0 additions & 12 deletions src/AbstractLinops.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ module lightkrylov_AbstractLinops
character*128, parameter :: this_module = 'Lightkrylov_AbstractLinops'

type, abstract, public :: abstract_linop
contains
private
procedure, pass(from), public :: copy
generic, public :: assignment(=) => copy
end type abstract_linop

#:for kind, type in RC_KINDS_TYPES
Expand Down Expand Up @@ -153,14 +149,6 @@ module lightkrylov_AbstractLinops
#:endfor
contains

subroutine copy(out, from)
class(abstract_linop), intent(in) :: from
class(abstract_linop), allocatable, intent(out) :: out
if (allocated(out)) deallocate(out)
allocate(out, source=from)
return
end subroutine copy

#:for kind, type in RC_KINDS_TYPES
subroutine id_matvec_${type[0]}$${kind}$(self, vec_in, vec_out)
class(Id_${type[0]}$${kind}$), intent(in) :: self
Expand Down
12 changes: 0 additions & 12 deletions src/AbstractVectors.f90
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ module lightkrylov_AbstractVectors


type, abstract, public :: abstract_vector
contains
private
procedure, pass(from), public :: copy => copy_vec
generic, public :: assignment(=) => copy
end type abstract_vector


Expand Down Expand Up @@ -364,14 +360,6 @@ end function abstract_dot_cdp

contains

subroutine copy_vec(out, from)
class(abstract_vector), intent(in) :: from
class(abstract_vector), allocatable, intent(out) :: out
if (allocated(out)) deallocate(out)
allocate(out, source=from)
return
end subroutine copy_vec

function norm_rsp(self) result(alpha)
!! Compute the norm of an `abstract_vector`.
class(abstract_vector_rsp), intent(in) :: self
Expand Down
12 changes: 0 additions & 12 deletions src/AbstractVectors.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ module lightkrylov_AbstractVectors


type, abstract, public :: abstract_vector
contains
private
procedure, pass(from), public :: copy => copy_vec
generic, public :: assignment(=) => copy
end type abstract_vector


Expand Down Expand Up @@ -135,14 +131,6 @@ module lightkrylov_AbstractVectors
#:endfor
contains

subroutine copy_vec(out, from)
class(abstract_vector), intent(in) :: from
class(abstract_vector), allocatable, intent(out) :: out
if (allocated(out)) deallocate(out)
allocate(out, source=from)
return
end subroutine copy_vec

#:for kind, type in RC_KINDS_TYPES
function norm_${type[0]}$${kind}$(self) result(alpha)
!! Compute the norm of an `abstract_vector`.
Expand Down
4 changes: 0 additions & 4 deletions src/LightKrylov.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ module LightKrylov
public :: cg_sp_opts
public :: gmres_dp_opts
public :: cg_dp_opts
public :: gmres_sp_opts
public :: cg_sp_opts
public :: gmres_dp_opts
public :: cg_dp_opts

! AbstractVectors exports.
public :: abstract_vector
Expand Down
2 changes: 1 addition & 1 deletion src/LightKrylov.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module LightKrylov
public :: dp, atol_dp, rtol_dp

! Utils exports.
#:for kind, type in RC_KINDS_TYPES
#:for kind in REAL_KINDS
public :: gmres_${kind}$_opts
public :: cg_${kind}$_opts
#:endfor
Expand Down
6 changes: 0 additions & 6 deletions src/Utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ module lightkrylov_utils
! Re-orders the Schur factorization of A.
public :: ordschur

public :: abstract_opts
public :: gmres_sp_opts
public :: cg_sp_opts
public :: gmres_dp_opts
public :: cg_dp_opts

public :: log2_rsp
public :: norml_rsp
public :: log2_rdp
Expand Down
6 changes: 0 additions & 6 deletions src/Utils.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ module lightkrylov_utils
! Re-orders the Schur factorization of A.
public :: ordschur

public :: abstract_opts
#:for kind in REAL_KINDS
public :: gmres_${kind}$_opts
public :: cg_${kind}$_opts
#:endfor

#:for kind, type in RC_KINDS_TYPES
#:if type[0] == "r"
public :: log2_${type[0]}$${kind}$
Expand Down
24 changes: 16 additions & 8 deletions test/TestLinops.f90
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,15 @@ subroutine test_matvec_csp(error)
type(vector_csp), allocatable :: x, y
! Test LinOp.
type(linop_csp), allocatable :: A
real(sp), dimension(test_size, test_size, 2) :: Adata

! Initialize vectors.
x = vector_csp() ; call x%rand()
y = vector_csp() ; call y%rand()

! Initialize matrix.
A = linop_csp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Compute matrix-vector product.
call A%matvec(x, y)
Expand All @@ -618,14 +619,15 @@ subroutine test_rmatvec_csp(error)
type(vector_csp), allocatable :: x, y
! Test LinOp.
type(linop_csp), allocatable :: A
real(sp), dimension(test_size, test_size, 2) :: Adata

! Initialize vectors.
x = vector_csp() ; call x%rand()
y = vector_csp() ; call y%rand()

! Initialize matrix.
A = linop_csp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Compute matrix-vector product.
call A%rmatvec(x, y)
Expand All @@ -644,13 +646,14 @@ subroutine test_adjoint_matvec_csp(error)
! Test LinOp.
type(linop_csp), allocatable :: A
type(adjoint_linop_csp), allocatable :: B
real(sp), dimension(test_size, test_size, 2) :: Adata

! Internal variable.
real(sp) :: alpha

! Initialize matrix.
A = linop_csp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Adjoint operator.
allocate(B) ; B%A = A
Expand Down Expand Up @@ -678,13 +681,14 @@ subroutine test_adjoint_rmatvec_csp(error)
! Test LinOp.
type(linop_csp), allocatable :: A
type(adjoint_linop_csp), allocatable :: B
real(sp), dimension(test_size, test_size, 2) :: Adata

! Internal variable.
real(sp) :: alpha

! Initialize matrix.
A = linop_csp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Adjoint operator.
allocate(B) ; B%A = A
Expand Down Expand Up @@ -724,14 +728,15 @@ subroutine test_matvec_cdp(error)
type(vector_cdp), allocatable :: x, y
! Test LinOp.
type(linop_cdp), allocatable :: A
real(dp), dimension(test_size, test_size, 2) :: Adata

! Initialize vectors.
x = vector_cdp() ; call x%rand()
y = vector_cdp() ; call y%rand()

! Initialize matrix.
A = linop_cdp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Compute matrix-vector product.
call A%matvec(x, y)
Expand All @@ -749,14 +754,15 @@ subroutine test_rmatvec_cdp(error)
type(vector_cdp), allocatable :: x, y
! Test LinOp.
type(linop_cdp), allocatable :: A
real(dp), dimension(test_size, test_size, 2) :: Adata

! Initialize vectors.
x = vector_cdp() ; call x%rand()
y = vector_cdp() ; call y%rand()

! Initialize matrix.
A = linop_cdp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Compute matrix-vector product.
call A%rmatvec(x, y)
Expand All @@ -775,13 +781,14 @@ subroutine test_adjoint_matvec_cdp(error)
! Test LinOp.
type(linop_cdp), allocatable :: A
type(adjoint_linop_cdp), allocatable :: B
real(dp), dimension(test_size, test_size, 2) :: Adata

! Internal variable.
real(dp) :: alpha

! Initialize matrix.
A = linop_cdp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Adjoint operator.
allocate(B) ; B%A = A
Expand Down Expand Up @@ -809,13 +816,14 @@ subroutine test_adjoint_rmatvec_cdp(error)
! Test LinOp.
type(linop_cdp), allocatable :: A
type(adjoint_linop_cdp), allocatable :: B
real(dp), dimension(test_size, test_size, 2) :: Adata

! Internal variable.
real(dp) :: alpha

! Initialize matrix.
A = linop_cdp()
call random_number(A%data%re) ; call random_number(A%data%im)
call random_number(Adata) ; A%data%re = Adata(:, :, 1) ; A%data%im = Adata(:, :, 2)

! Adjoint operator.
allocate(B) ; B%A = A
Expand Down
Loading

0 comments on commit 8bf79dc

Please sign in to comment.