Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ef90adb
Remove arpack (no longer needed) and use openmpi as default mpi for M…
JamieJQuinn Jun 3, 2021
944fe6a
Add pFUnit as git submodule
JamieJQuinn Jun 17, 2021
86821fe
Move pfunit to lib folder
JamieJQuinn Jun 17, 2021
ee37c90
Add makefile recipe for building and installing pfunit
JamieJQuinn Jun 17, 2021
02f19bd
Add TARGET var to makefile to help cleanup
JamieJQuinn Jun 17, 2021
6a2dd67
Move regression tests to their own directory within test to make room…
JamieJQuinn Jun 17, 2021
f86f924
Remove && operator in makefile to match other similar lines
JamieJQuinn Jun 21, 2021
543d941
Add simple example unit tests
JamieJQuinn Jun 22, 2021
054611f
Add readers and writers for regular fortran and MPI IO formats
JamieJQuinn Jun 22, 2021
fc54a58
Add test for fortran writer
JamieJQuinn Jun 22, 2021
f156281
Run correct unit tests
JamieJQuinn Jun 23, 2021
902233d
Cleanup camel case, improve errors and refactor file opening
JamieJQuinn Jun 23, 2021
ea66bf6
Add error handling
JamieJQuinn Jun 23, 2021
33e9e43
Rename writer and reader types to writer_base and reader_base
JamieJQuinn Jun 23, 2021
69882c5
Ignoring test outputs
JamieJQuinn Jun 28, 2021
e6aa810
Add fortran reader tests and cleanup writer
JamieJQuinn Jun 28, 2021
dc23716
Fix fortran compiler variable in makefile
JamieJQuinn Jun 28, 2021
cc3a8be
Add working MPI unit test of MPI writer
JamieJQuinn Jun 28, 2021
a8e90c7
Refactor byte size and MPI type determination into function
JamieJQuinn Jun 28, 2021
4418d13
Use TROVE's MPI initialisation routines in MPI unit tests (this will …
JamieJQuinn Jun 29, 2021
ec2a698
Add default data to error type
JamieJQuinn Jun 30, 2021
f489aea
Fix makefile dependencies
JamieJQuinn Jun 30, 2021
bb473b6
Ensure make clean removes mpi io test outputs
JamieJQuinn Jun 30, 2021
838508d
Implement outputting of 2D arrays using MPI IO while imitating fortra…
JamieJQuinn Jun 30, 2021
b76334d
Add another test case to MPI writer along with some comments
JamieJQuinn Jun 30, 2021
4564b07
Refactor reader & writer into one single type
JamieJQuinn Jul 1, 2021
f23784a
Integrate fortran writer into writing of contr_matelem.chk in perturb…
JamieJQuinn Jul 1, 2021
7687189
Add writing of strings from MPI writer
JamieJQuinn Jul 1, 2021
a475c87
Cleanup io_handler_ftn and fix complex type detection
JamieJQuinn Jul 2, 2021
0510ec6
Add fixtures to test MPI properly, and add test of co_distr_write
JamieJQuinn Jul 2, 2021
65b2c23
Add writing of arrays distributed through co_distr_data
JamieJQuinn Jul 5, 2021
0d59f52
Implement writing of (unsplit) matelem using MPI
JamieJQuinn Jul 5, 2021
d8bdac1
Fix bug in MPI array writer and only enable MPI writer when compiling…
JamieJQuinn Jul 5, 2021
3415094
Small changes to unit test build (#37)
ageorgou Aug 18, 2021
819dbdc
Add todos in code
JamieJQuinn Aug 4, 2021
428359b
Merge branch 'merge-develop-mpi' into feature/unit-testing
ageorgou Oct 7, 2021
e57ee84
Move script so tests find it
ageorgou Oct 7, 2021
a353e5f
Use correct libraries for running tests
ageorgou Oct 7, 2021
94f0ebf
Determine MPI usage correctly
ageorgou Oct 11, 2021
b2782c4
Fix allocation problems when using Intel (#47)
ageorgou Oct 22, 2021
4cfa941
Fix case of skipping g_cor header with MPI writer (#43)
ageorgou Oct 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
env:
OMP_NUM_THREADS: 1
USE_MPI: ${{ matrix.mpi && 1 || 0 }}
COMPILER: ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -67,6 +68,17 @@ jobs:
if: ${{ !matrix.mpi }}
run: sudo apt-get install -y intel-mkl

- name: Build pFUnit
run: |
if [[ -d "/opt/intel/oneapi" ]]; then
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/setvars.sh
if [ ${USE_MPI} = 1 ]; then
source /opt/intel/oneapi/mkl/latest/env/vars.sh
fi
fi
make COMPILER=${COMPILER} install-pfunit

- name: Build (gfortran)
if: ${{ matrix.compiler == 'gfortran' }}
run: |
Expand Down Expand Up @@ -98,4 +110,4 @@ jobs:
source /opt/intel/oneapi/mkl/latest/env/vars.sh
fi
fi
make test
make COMPILER=${COMPILER} USE_MPI=${USE_MPI} test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ wigxjpf-1.5/lib/
wigxjpf-1.5/bin/
wigxjpf-1.5/mod/

# test executables
test/unit/test_io
test/unit/test_mpi_io

# regression test files
test/regression/benchmarks
test/regression/benchmarks.tar.gz
test/regression/outputs

# Windows image file caches
Thumbs.db
ehthumbs.db
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/pFUnit"]
path = lib/pFUnit
url = https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
12 changes: 12 additions & 0 deletions errors.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Errors
implicit none

integer, parameter :: ERR_None = 0, &
ERR_Default = 1, &
ERR_FileNotFound = 2

type:: ErrorType
integer :: code = ERR_None
character(len=256) :: message = ""
end type
end module Errors
16 changes: 16 additions & 0 deletions errors.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
! Error.fpp

! From http://www.luckingtechnotes.com/fortran-error-handling-techniques on 23/06/2021

! Macros for error handling.
! Enables user to store errors and exit the subroutine in single statement.
! Fortran preprocessor must be enabled: -fpp.

! Raise Error
! Store the error code and info (only if the current code is zero).
! Return from the subroutine.
#define RAISE_ERROR(msg, err) if (err%Code == ERR_None) then; err = ErrorType(Code=ERR_Default, Message=msg); end if; return;

! Pass Error
! Returns if there's an error.
#define HANDLE_ERROR(err) if (err%Code /= ERR_None) then; print *, err%message; return; end if;
83 changes: 83 additions & 0 deletions io_handler_base.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
module io_handler_base
use mpi_aux
use errors

implicit none

type, abstract :: ioHandlerBase
contains
procedure(open), deferred :: open
generic :: write => writeScalar, write1DArray, write2DArray, write2DArrayDistBlacs, write2DArrayDistColumn
procedure(writeScalar), deferred :: writeScalar
procedure(write1DArray), deferred :: write1DArray
procedure(write2DArray), deferred :: write2DArray
procedure(write2DArrayDistBlacs), deferred :: write2DArrayDistBlacs
procedure(write2DArrayDistColumn), deferred :: write2DArrayDistColumn
generic :: read => readScalar, read1DArray, read2DArray
procedure(readScalar), deferred :: readScalar
procedure(read1DArray), deferred :: read1DArray
procedure(read2DArray), deferred :: read2DArray
end type ioHandlerBase

abstract interface
subroutine open(this, fname, err, action, position, status, form, access)
import ioHandlerBase
import ErrorType
class(ioHandlerBase) :: this
type(ErrorType), intent(inout) :: err
character (len = *), intent(in) :: fname
character (len = *), intent(in) :: action
character (len = *), intent(in), optional :: position, status, form, access
end subroutine
subroutine writeScalar(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), intent(in) :: object
end subroutine
subroutine write1DArray(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), dimension(:), intent(in) :: object
end subroutine
subroutine write2DArray(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), dimension(:,:), intent(in) :: object
end subroutine
subroutine write2DArrayDistBlacs(this, object, descr, block_type)
import ioHandlerBase
import MPI_Datatype
class(ioHandlerBase) :: this
class(*), dimension(:,:), intent(in) :: object
integer, intent(in) :: descr(9)
type(MPI_Datatype), intent(in) :: block_type
end subroutine
subroutine write2DArrayDistColumn(this, object, mdimen)
import ioHandlerBase
import MPI_Datatype
class(ioHandlerBase) :: this
class(*), dimension(:,:), intent(in) :: object
integer, intent(in) :: mdimen
end subroutine
subroutine readScalar(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), intent(out) :: object
end subroutine
subroutine read1DArray(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), dimension(:), intent(out) :: object
end subroutine
subroutine read2DArray(this, object)
import ioHandlerBase
class(ioHandlerBase) :: this
class(*), dimension(:,:), intent(out) :: object
end subroutine
end interface

private

public :: ioHandlerBase

end module
Loading