Skip to content

Commit

Permalink
Merge branch 'stage-1.5' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Feb 8, 2024
2 parents 9f6cfcc + b66aedb commit e6dbe2c
Show file tree
Hide file tree
Showing 27 changed files with 203 additions and 124 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ Change Log

Notable project changes in various releases.


1.5
===

Added
-----

* mpifx_win allows allocations with 64 bit allocation size parameter


Changed
-------

* mpifx_win is fully standard conforming now (using the F08 MPI-interface)


1.4
===

Expand Down
38 changes: 30 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MpiFx - Modern Fortran Interface for MPI
****************************************

The open source library `MpiFx <https://github.com/dftbplus/mpifx>`_ provides
modern Fortran (Fortran 2003) wrappers around routines of the MPI library to
modern Fortran (Fortran 2008) wrappers around routines of the MPI library to
make their use as simple as possible. Currently several data distribution
routines are covered.

Expand All @@ -14,14 +14,36 @@ The documentation is included inside the repository, but is also available at
Installation
============

The preferred way of obtaining MpiFx is to install it via the Conda package
management framework using `Miniconda
<https://docs.conda.io/en/latest/miniconda.html>`_ or `Anaconda
<https://www.anaconda.com/products/individual>`_. Make sure to add/enable the
``conda-forge`` channel in order to be able to access MpiFx, and ensure that the
``conda-forge`` channel is the first repository to be searched for packages.

We provide both, OpenMPI and MPICH based build variants, choose the one suiting
your needs. For example, issue ::

conda install 'mpifx=*=mpi_mpich_*'

or ::

conda install 'mpifx=*=mpi_openmpi_*'

to get the last stable release of MpiFx for the respective MPI framework.


Building from source
====================

Prerequisites
-------------

* CMake (version >= 3.16)

* Fortran 2003 compatible Fortran compiler
* Fortran 2008 compatible Fortran compiler

* MPI-library and wrappers for your compiler
* MPI-library and wrappers for your compiler supporting the `mpi_f08` interface

* `Fypp preprocessor <https://github.com/aradi/fypp>`_

Expand All @@ -40,7 +62,7 @@ You can influence the configuration via CMake-variables, which are listed in
or pass them as command line options at the configuration phase, e.g.::

FC=ifort cmake -B _build -DBUILD_TESTING=NO .


Testing
-------
Expand All @@ -61,15 +83,15 @@ CMake build
* Make sure to add the root folder of the installed library to the
``CMAKE_PREFIX_PATH`` environment variable.

* Use ``find_package()`` in `CMakeLists.txt` to locate the library and link
* Use ``find_package()`` in `CMakeLists.txt` to locate the library and link
``MpiFx::MpiFx`` to every target which relies directly on the library ::

cmake_minimum_required(VERSION 3.16)

project(TestMpiFx LANGUAGES Fortran)

find_package(MpiFx REQUIRED)

add_executable(test_mpifx test_mpifx.f90)
target_link_libraries(test_mpifx MpiFx::MpiFx)

Expand Down
1 change: 0 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set(sources-fpp
mpifx_barrier.fpp
mpifx_bcast.fpp
mpifx_comm.fpp
mpifx_common.fpp
mpifx_constants.fpp
mpifx_finalize.fpp
mpifx_gather.fpp
Expand Down
1 change: 0 additions & 1 deletion lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ sources_fpp = files(
'mpifx_barrier.fpp',
'mpifx_bcast.fpp',
'mpifx_comm.fpp',
'mpifx_common.fpp',
'mpifx_constants.fpp',
'mpifx_finalize.fpp',
'mpifx_gather.fpp',
Expand Down
4 changes: 3 additions & 1 deletion lib/mpifx_abort.fpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
!> Contains wrapper for \c MPI_ABORT.
module mpifx_abort_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : handle_errorflag
implicit none
private

Expand Down
4 changes: 3 additions & 1 deletion lib/mpifx_allgather.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

!> Contains wrapper for \c MPI_ALLGATHER
module mpifx_allgather_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, handle_errorflag, sp
implicit none
private

Expand Down
4 changes: 3 additions & 1 deletion lib/mpifx_allgatherv.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@

!> Contains wrapper for \c MPI_allgatherv
module mpifx_allgatherv_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, handle_errorflag, sp
implicit none
private

Expand Down
6 changes: 4 additions & 2 deletions lib/mpifx_allreduce.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

!> Contains wrapper for \c MPI_ALLREDUCE.
module mpifx_allreduce_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, handle_errorflag, sp
implicit none
private

Expand Down Expand Up @@ -86,7 +88,7 @@ module mpifx_allreduce_module
!! write(*, "(I2.2,'-',I3.3,'|',1X,A,3F8.2)") 4, mycomm%rank, &
!! & "Obtained result (prod):", resvalr(:)
!! call mpifx_finalize()
!!
!!
!! end program test_allreduceip
!!
interface mpifx_allreduceip
Expand Down
12 changes: 7 additions & 5 deletions lib/mpifx_barrier.fpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#:include 'mpifx.fypp'

!> Contains wrapper for \c MPI_BARRIER.
!> Contains wrapper for \c MPI_BARRIER.
module mpifx_barrier_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : handle_errorflag
implicit none
private

Expand Down Expand Up @@ -35,12 +37,12 @@ contains
subroutine mpifx_barrier(mycomm, error)
type(mpifx_comm), intent(in) :: mycomm
integer, intent(out), optional :: error

integer :: error0

call mpi_barrier(mycomm%id, error0)
call handle_errorflag(error0, "MPI_BARRIER in mpifx_barrier", error)

end subroutine mpifx_barrier


Expand Down
6 changes: 4 additions & 2 deletions lib/mpifx_bcast.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

!> Contains wrapper for \c MPI_BCAST.
module mpifx_bcast_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, getoptarg, handle_errorflag, sp
implicit none
private

Expand Down Expand Up @@ -80,7 +82,7 @@ contains

#:enddef mpifx_bcast_template


#:for TYPE in TYPES
#:for RANK in RANKS

Expand Down
2 changes: 1 addition & 1 deletion lib/mpifx_comm.fpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!> Contains the extended MPI communicator.
module mpifx_comm_module
use mpi
use mpifx_helper_module
use mpifx_helper_module, only : getoptarg, handle_errorflag
implicit none
private

Expand Down
13 changes: 0 additions & 13 deletions lib/mpifx_common.fpp

This file was deleted.

5 changes: 4 additions & 1 deletion lib/mpifx_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module mpifx_constants_module
public :: MPI_MODE_NOSTORE, MPI_MODE_NOPUT, MPI_MODE_NOPRECEDE, MPI_MODE_NOSUCCEED
public :: MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED, MPI_THREAD_SERIALIZED, MPI_THREAD_MULTIPLE
public :: MPI_COMM_TYPE_SHARED
public :: MPIFX_UNHANDLED_ERROR, MPIFX_ASSERT_FAILED
public :: MPIFX_UNHANDLED_ERROR, MPIFX_ASSERT_FAILED, MPIFX_SIZE_T


!> Exit code for errors which were not caught due to missing optional arguments
Expand All @@ -19,6 +19,9 @@ module mpifx_constants_module
!> Exit code for failed assertions
integer, parameter :: MPIFX_ASSERT_FAILED = 2

!> Native integer for MPI addresses
integer, parameter :: MPIFX_SIZE_T = MPI_ADDRESS_KIND

end module mpifx_constants_module

!> \endcond
8 changes: 5 additions & 3 deletions lib/mpifx_finalize.fpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
!> Contains wrapper for \c MPI_FINALIZE.
!> Contains wrapper for \c MPI_FINALIZE.
module mpifx_finalize_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : handle_errorflag
implicit none
private

Expand Down Expand Up @@ -39,5 +41,5 @@ contains
call handle_errorflag(error0, "Error: mpi_finalize() in mpifx_finalize()", error)

end subroutine mpifx_finalize

end module mpifx_finalize_module
22 changes: 12 additions & 10 deletions lib/mpifx_gather.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

!> Contains wrapper for \c MPI_GATHER
module mpifx_gather_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, getoptarg, handle_errorflag, sp
implicit none
private

Expand All @@ -30,17 +32,17 @@ module mpifx_gather_module
!! program test_gather
!! use libmpifx_module
!! implicit none
!!
!!
!! type(mpifx_comm) :: mycomm
!! integer :: send0
!! integer, allocatable :: send1(:)
!! integer, allocatable :: recv1(:), recv2(:,:)
!! character(100) :: formstr
!! character(*), parameter :: label = "(I2.2,'-',I3.3,'|',1X"
!!
!!
!! call mpifx_init()
!! call mycomm%init()
!!
!!
!! ! I0 -> I1
!! send0 = mycomm%rank * 2 ! Arbitrary number to send
!! if (mycomm%lead) then
Expand All @@ -55,7 +57,7 @@ module mpifx_gather_module
!! write(*, *) mycomm%rank, "Recv1 buffer:", recv1(:)
!! end if
!! deallocate(recv1)
!!
!!
!! ! I1 -> I1
!! allocate(send1(2))
!! send1(:) = [ mycomm%rank, mycomm%rank + 1 ] ! Arbitrary numbers
Expand All @@ -70,7 +72,7 @@ module mpifx_gather_module
!! if (mycomm%lead) then
!! write(*, *) mycomm%rank, "Recv1 buffer:", recv1
!! end if
!!
!!
!! ! I1 -> I2
!! send1(:) = [ mycomm%rank, mycomm%rank + 1 ]
!! if (mycomm%lead) then
Expand All @@ -82,9 +84,9 @@ module mpifx_gather_module
!! if (mycomm%lead) then
!! write(*, *) mycomm%rank, "Recv2 buffer:", recv2
!! end if
!!
!!
!! call mpifx_finalize()
!!
!!
!! end program test_gather
!!
interface mpifx_gather
Expand All @@ -100,7 +102,7 @@ module mpifx_gather_module
#:endfor
#:endfor
end interface mpifx_gather

contains

#:def mpifx_gather_dr0_template(SUFFIX, TYPE, MPITYPE, RANK, HASLENGTH)
Expand Down Expand Up @@ -135,7 +137,7 @@ contains
call mpi_gather(send, ${COUNT}$, ${MPITYPE}$, recv, ${COUNT}$, ${MPITYPE}$, root0,&
& mycomm%id, error0)
call handle_errorflag(error0, "MPI_GATHER in mpifx_gather_${SUFFIX}$", error)

end subroutine mpifx_gather_${SUFFIX}$

#:enddef mpifx_gather_dr0_template
Expand Down
4 changes: 3 additions & 1 deletion lib/mpifx_gatherv.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@

!> Contains wrapper for \c MPI_gatherv
module mpifx_gatherv_module
use mpifx_common_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_helper_module, only : dp, handle_errorflag, sp
implicit none
private

Expand Down
2 changes: 1 addition & 1 deletion lib/mpifx_get_processor_name.fpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!> Contains the extended MPI communicator.
module mpifx_get_processor_name_module
use mpifx_helper_module
use mpi
use mpifx_helper_module, only : handle_errorflag
implicit none
private

Expand Down
2 changes: 1 addition & 1 deletion lib/mpifx_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module mpifx_helper_module
use mpi
use, intrinsic :: iso_fortran_env, only : stderr => error_unit
use mpifx_constants_module
use mpifx_constants_module, only : MPIFX_ASSERT_FAILED, MPIFX_UNHANDLED_ERROR
implicit none
private

Expand Down
6 changes: 4 additions & 2 deletions lib/mpifx_init.fpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
!> Contains wrapper for \c MPI_INIT.
module mpifx_init_module
use mpifx_common_module
use mpifx_constants_module
use mpi
use mpifx_comm_module, only : mpifx_comm
use mpifx_constants_module, only : MPIFX_UNHANDLED_ERROR
use mpifx_helper_module, only : handle_errorflag
implicit none
private

Expand Down
Loading

0 comments on commit e6dbe2c

Please sign in to comment.