Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
5bc1f51
More gfortran fixes
ArjenTamerus Feb 4, 2019
8540f56
Merge branches + fix some string formats, memory bug
ArjenTamerus Feb 5, 2019
146a947
gfortran-compatible MPI
ArjenTamerus Feb 5, 2019
74a221a
Fix MPI + gfortran, use MPI datatype for data exchange
ArjenTamerus Feb 18, 2019
f121d38
co_write_matrix_distr: don't write out empty buffer columns
ArjenTamerus Feb 22, 2019
970c162
perturbation.f90 - WIP MPI-IO file formatting work + write fixes
ArjenTamerus Feb 22, 2019
763a291
coarray_aux => mpi_aux -- no longer using coarrays
ArjenTamerus Feb 22, 2019
ac0fd70
Work around slow MPI-IO write on some systems, implement parallel wri…
ArjenTamerus Apr 26, 2019
64e38db
Remove accidentally committed test code
ArjenTamerus May 8, 2019
3f68ac0
Some MPI documentation + SLURM script + makefile update
ArjenTamerus May 8, 2019
75a7220
Commented out some unfinished test code
ArjenTamerus Jun 3, 2019
4cff7f4
Fix issues w/ parallel I/O, avoids double write in tran.f90 and makes…
ArjenTamerus Jun 14, 2019
0d17cbc
[mpi_aux.f90] Fixed blacs implementation + cleanup
ArjenTamerus Jun 20, 2019
08c1c06
[mpi_aux.f90] return allocation status in co_block_type_init
ArjenTamerus Jun 20, 2019
727916c
[tran.f90] Implement Parallel DGEMM to enable MPI/memory scaling (sin…
ArjenTamerus Jun 20, 2019
9870c34
[tran.f90] Fix x/y dimension confusion, plus minor cleanup
ArjenTamerus Jun 21, 2019
6c4d732
Implement SPLIT file i/o for MPI version
ArjenTamerus Jul 1, 2019
ab20174
Fix MPI/POSIX IO switch, fix calculation of lower matrix in perturbat…
ArjenTamerus Jul 12, 2019
e37d217
gfortran fixes
ArjenTamerus Aug 1, 2019
0206dae
Bugfix: only call co_sum if select_gamma(isym) is true
ArjenTamerus Sep 9, 2019
13af4b4
Workaround: MKL's scalapack crashes with (correct) input on psi for l…
ArjenTamerus Sep 9, 2019
a8ed85f
Clean up redundant statements + minor makefile fix
ArjenTamerus Sep 9, 2019
ab66ff7
[input.f90] output 'echo' statements only on master process
ArjenTamerus Sep 9, 2019
2f3edf8
[perturbation.f90]Fix small mistake in co_sum call (allreduce when re…
ArjenTamerus Sep 10, 2019
88913fd
Rough fix to avoid 'Non-diagonal element' issue
ArjenTamerus Nov 12, 2019
696463e
Improve co_sum workaround by calling reduction operation only once pe…
ArjenTamerus Mar 11, 2020
aa47a1b
Refactored MPI-IO to be more robust across implementations
ArjenTamerus Apr 27, 2020
b9060cd
Pretend we're always using MPI
ageorgou Apr 16, 2021
7e8b53a
Use dummy MPI type in co_block_type_init
ageorgou Apr 16, 2021
c5a07b2
Use correct BLACS process numbering
ageorgou Apr 16, 2021
d4c917b
Add back some forgotten steps when not using MPI
ageorgou Apr 16, 2021
c9935c8
Fix indentation
ageorgou Apr 20, 2021
e9c04a1
Compile with MPI support
ageorgou Apr 20, 2021
b4f9c86
Fix compilation with gfortran
JamieJQuinn Apr 29, 2021
686a46e
Remove unused function
Apr 29, 2021
bd97ded
Remove unused function `diag_dseupd_p`
Apr 29, 2021
38887a7
Allow MPI code to compile without MPI enabled
Apr 29, 2021
0deb089
Merge branch 'develop' into merge-develop-mpi
JamieJQuinn May 7, 2021
d55c951
Add back missing #endif missed during merging
JamieJQuinn May 7, 2021
9a201a9
Ensure merged TROVE compiles using gfortran
JamieJQuinn May 7, 2021
3f1d4be
Fix makefile dependency
JamieJQuinn May 7, 2021
ae500c5
Fix segfault when compiling with -O0
JamieJQuinn May 10, 2021
d64cc5a
Fix incorrect capitalisation of header when writing external field
JamieJQuinn May 11, 2021
f776b92
Add docstrings to compare_results.py
JamieJQuinn May 19, 2021
d8f1a4c
Refactor comparison script and add testing of intensity log
JamieJQuinn May 19, 2021
c9a12ee
Remove dependency on pytest (and thus pipenv)
JamieJQuinn May 19, 2021
c648d22
Update test/compare_results.py
JamieJQuinn Jun 2, 2021
ee86bbb
Remove pipenv use from test runner
JamieJQuinn May 20, 2021
9cf070b
Fail earlier when searching log block
JamieJQuinn Jun 2, 2021
8c0dc2c
Remove pointless comment
JamieJQuinn Jun 2, 2021
b8d1729
When there are differences in outputs, print all differences then exit
JamieJQuinn Jun 2, 2021
2ff450c
Use assertion instead of exception for testing validity of intensity …
JamieJQuinn Jun 2, 2021
8cae86f
Add intensity as option in comparison
JamieJQuinn Jun 2, 2021
15dc285
Enable testing of intensity log file
JamieJQuinn Jun 2, 2021
98b3587
Remove unused pipenv steps in CI
JamieJQuinn Jun 2, 2021
1feb470
Comparing intensity outputs works down to 1e-6
JamieJQuinn Jun 2, 2021
a2bb6d0
Comments
JamieJQuinn Jun 2, 2021
44e88ce
Fix intensity comparison and test using absolute difference
JamieJQuinn Jun 2, 2021
0d64c38
Don't strip comments when running quantum energy comparison
JamieJQuinn Jun 2, 2021
b8d19a7
Sort intensity numbers by relevant ID before comparison
JamieJQuinn Jun 2, 2021
964ce80
Implement error checking when finding block in chkpoint file
JamieJQuinn Jun 2, 2021
4da59e1
Update test/compare_results.py
JamieJQuinn Jun 2, 2021
11d0127
Handle paths maturely
JamieJQuinn Jun 2, 2021
8bfa19a
Merge pull request #32 from Trovemaster/feature/test-intensity-log
JamieJQuinn Jun 2, 2021
3d8d80a
Cleanup makefile (fixes #33)
JamieJQuinn Jun 2, 2021
188e27e
Merge branch 'develop' into merge-develop-mpi
JamieJQuinn Jun 2, 2021
042127b
Improve error handling in comparison script; it's now much easier to …
JamieJQuinn Jun 2, 2021
e2e352b
TROVE built with gfortran -O0 segfaults; change to -O2 for continuous…
JamieJQuinn Jun 2, 2021
1250f52
Incorporate MPI options into makefile
JamieJQuinn Jun 2, 2021
4096f62
Move traceback flag to debug options
JamieJQuinn Jun 3, 2021
2652c80
Include Intel compiler and MPI in CI (#36)
ageorgou Jun 29, 2021
9cdb17f
Properly copy array, don't just re-reference (fixes double free error)
JamieJQuinn Aug 5, 2021
ec16a55
Fix array bounds error
JamieJQuinn Aug 5, 2021
65a9004
Fix more array bounds errors
JamieJQuinn Aug 5, 2021
a1d90ab
Comment out segfaulting deallocation
JamieJQuinn Aug 5, 2021
991ef2a
Refactor symm_mat_element_vector
JamieJQuinn Aug 9, 2021
313d098
Assume openmpi if using gfortran and add more debug compilation flags
JamieJQuinn Aug 9, 2021
c9639d6
Fix bash errors
JamieJQuinn Aug 9, 2021
846b278
Fix unassociated array access
JamieJQuinn Aug 10, 2021
2e949c9
Disable some runtime checks in debug compiler flags (just don't have …
JamieJQuinn Aug 11, 2021
3a2b77c
Fix incorrect filename and fix spacing in error message
JamieJQuinn Aug 11, 2021
a754bd9
Only compare intensity output if MPI disabled
JamieJQuinn Aug 11, 2021
193f693
Merge pull request #39 from Trovemaster/fix/ch4-file2-name
JamieJQuinn Aug 11, 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
75 changes: 62 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ on:

jobs:
test:
name: TROVE ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.compiler }}
name: TROVE ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.compiler }} - MPI:${{ matrix.mpi }}
env:
OMP_NUM_THREADS: 1
USE_MPI: ${{ matrix.mpi && 1 || 0 }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -20,16 +21,40 @@ jobs:
- x64
compiler:
- gfortran
- intel
mpi:
- true
- false
exclude:
# only use MPI with intel
- compiler: gfortran
mpi: true
steps:
- uses: actions/checkout@v2

#- name: Cache benchmark data
#uses: actions/cache@v2
#env:
#cache-name: benchmark-data
#with:
#path: test/benchmarks
#key: benchmark-data
- name: Restored cached Intel install
id: cache_intel
if: ${{ matrix.compiler == 'intel' }}
uses: actions/cache@v2
with:
key: oneapi-${{ matrix.os }}-${{ matrix.arch }}-MPI:${{ matrix.mpi }}
path: |
/opt/intel/oneapi/*
!/opt/intel/oneapi/conda_channel
!/opt/intel/oneapi/debugger
!/opt/intel/oneapi/licensing

- name: Setup Intel compiler and MPI
if: ${{ matrix.compiler == 'intel' && steps.cache_intel.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
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/oneAPI.list" -o APT::Get::List-Cleanup="0"
sudo apt-get install -y intel-oneapi-compiler-fortran
if [ ${USE_MPI} = 1 ]; then
sudo apt-get install -y intel-oneapi-mpi-devel intel-oneapi-mkl-devel
fi

- name: Setup python
uses: actions/setup-python@v1
Expand All @@ -38,15 +63,39 @@ jobs:
architecture: x64

- name: Install Intel MKL
# MKL will have been installed alongside MPI if we're using that
if: ${{ !matrix.mpi }}
run: sudo apt-get install -y intel-mkl

- name: Install pipenv environment
run: cd test && pip install pipenv && pipenv install

- name: Build
- name: Build (gfortran)
if: ${{ matrix.compiler == 'gfortran' }}
run: |
gfortran --version
make COMPILER=gfortran MODE=ci

- name: Build (intel)
if: ${{ matrix.compiler == 'intel' }}
run: |
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/setvars.sh
if [ -d "/opt/intel/oneapi/mkl" ]; then
source /opt/intel/oneapi/mkl/latest/env/vars.sh
fi
# mpif90 uses gfortran by default unless changed like this
export I_MPI_F90=ifort
ifort --version
make COMPILER=intel MODE=ci USE_MPI=${USE_MPI}

- name: Test
run: make test
env:
# nproc is used in the test script for the number of processes
nproc: ${{ matrix.mpi && 2 || 1 }}
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 test
82 changes: 82 additions & 0 deletions TROVE.wiki/TROVE-mpi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# MPI functionality

Distributed memory parallelism using MPI has been implemented in the
PTcontracted_matalem_class subroutine, plus subroutines called by or related to
it. Most MPI functionality has been consolidated in the mpi_aux.f90 file.

File output has been implemented using MPI-IO. Because MPI is not compatible
with the Fortran's record-based unformatted file format, a new file format has
been implemented. Preserving the old file format by using Master I/O has been
considered, but cannot be supported for large simulations (where distributed
memory parallelism is required) as the size of the data needing to be written
will exceed the available memory on a compute node.

The new file format is similar to the non-mpi format, except for using 'raw'
binary data versus Fortran's records. Conversion utilities between the two
formats will be provided.

The following has been implemented:

- Writing of single-file data
- Reading of single-file data
- Writing of split file data

The following needs testing:

- Reading of split file data

The following is in progress:

- Reading the new format on MPI-free systems
- Conversion functionality


To enable writing in the new file format, add the parameter `format mpiio` to
the input file under `CHECK_POINT`, e.g.:

```
CHECK_POINT
HAMILTONIAN read
potential read
kinetic read
external read
basis_set read
CONTRACT read
matelem save
extmatelem save
eigenfunc save
format mpiio
END
```

NOTE: As other routines than `matelem` have not been touched yet, expect a large
amount of duplicated output from stdout. This does not affect the integrity of
file output.

# How to run

## Requirements

The only additional requirement to build and run the MPI version of TROVE is a
compatible MPI library. The code has been tested with Intel MPI, versions
2017.4, 2018.4 and 2019.3. Intel 2018.1 is confirmed *not* working.

This version of TROVE should also build and run correctly with OpenMPI, and
should be compatible with GNU GFortran but this is untested.

Although not required, it is highly recommended to run on a distributed
filesystem (e.g. Lustre + striping) for significantly increased I/O performance.

## Building TROVE-MPI

Make sure the compiler is set to 'mpif90' or 'mpifort' in the Makegfile, then
run `make` in the source directory.

## Running TROVE-MPI

Once built, run the code like the sequential version but prepended with `mpirun`
or your scheduler's mpi wrapper (e.g. `srun`). E.g.:

`mpirun trove.x infile.inp`

A sample batch script for SLURM is provided.
30 changes: 30 additions & 0 deletions TROVE.wiki/trove-slurm.batch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#SBATCH -J TROVE-MPI-<input>
#SBATCH -p <PARTIITON>
#SBATCH -A <ACCOUNT>
#SBATCH -N <NUM_NODES>
#SBATCH -n <NUM_TASKS> # Recommend number of sockets
#SBATCH -c <CORES_PER_TASK> # for OpenMP, NOTE recommend number of cores per socket
#SBATCH -t 3:0:0
#SBATCH --exclusive
#SBATCH -o "trove.%j.out"

# This batch script runs TROVE-MPI using hybrid MPI/OpenMP. For best
# performance, it is recommended to run one MPI task per socket, and <ncores per
# socket> OpenMP threads per task.

module purge
module load rhel7/default-peta4
module unload intel/bundles/complib/2017.4
module load intel/bundles/complib/2019.3

# Set to number of cores per socket
export OMP_NUM_THREADS=16

# Prevent processes from migrating and ensure each task + threads is exclusive
# to one socket.
export I_MPI_PIN=1
export I_MPI_PIN_DOMAIN=omp:compact


mpirun trove.x file1.inp
4 changes: 2 additions & 2 deletions accuracy.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module accuracy
integer, parameter :: drk = selected_real_kind(12,25) ! "Double" reals and complex (complexi? :-)
integer, parameter :: rk = selected_real_kind(12,25) ! "Normal" reals and complex (complexi? :-)
integer, parameter :: ark = selected_real_kind(25,32) ! "Accurate" reals and complex (complexi? :-)
integer, parameter :: inp = 5 ! Output I/O channel
integer, parameter :: out = 6 ! Output I/O channel
integer, parameter :: inp = 5 ! Input I/O channel
integer :: out = 6 ! Output I/O channel
integer, parameter :: nfilelegendre = 101 ! Dump-outout channel for eigenfunction

! universal constants
Expand Down
8 changes: 2 additions & 6 deletions diag.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module diag
#define omparpack_ 0
#define propack_ 0
!
!
! Simplistic type-agnostic LAPACK interface
!
use accuracy
Expand All @@ -15,7 +14,7 @@ module diag
private verbose
!
!
public diag_tridiag,diag_tridiag_pack,diag_dsyev_i8,diag_dgelss,diag_syev_ilp,diag_syev_i8,diag_dseupd,diag_dseupd_p
public diag_tridiag,diag_tridiag_pack,diag_dsyev_i8,diag_dgelss,diag_syev_ilp,diag_syev_i8
public dseupd_omp_arpack,diag_propack,daprod
!
integer,parameter:: verbose = 4
Expand Down Expand Up @@ -2094,7 +2093,7 @@ subroutine diag_dseupd(n,bterm,nroots,factor,maxitr_,tol,h,e)
call dsaupd ( ido, bmat, n, which, nev, tol, resid, &
ncv, v, ldv, iparam, ipntr, workd, workl, &
lworkl, info )
#else
#else
!
write(out,"(/'Arpack was not activated yet. Please uncomment dsaupd and dseupd bellow')")
stop 'Arpack was not activated'
Expand Down Expand Up @@ -3274,9 +3273,6 @@ subroutine dseupd_omp_arpack(n,bterm,nroots,factor,maxitr_,tol,h,e)
end subroutine dseupd_omp_arpack





subroutine diag_propack(n,bterm,nroots,factor,maxiter,iverbose,tol,h,e)
!
integer,intent(in) :: n,bterm(n,2),maxiter,iverbose
Expand Down
Loading