A small progress update.
I’ve been testing LFortran 0.64.0 with lfortran/fortran_mpi, using Open MPI through its C interface. So far, a simple MPI program works, and several small tests within the codebase are compiling and passing, including MPI tests with multiple ranks.
The main limitation on the MPI side at the moment is interface coverage in fortran_mpi: a number of standard interfaces are still missing, including routines such as MPI_Abort and MPI_Send, some standard MPI datatypes, and overloads for commonly used collectives. I’ve been adding the missing wrappers as needed.
I’ve also encountered a few compiler issues. So far I have reduced two of them to small standalone reproducers.
1. dot_product on a derived-type component section with --separate-compilation
module repro
implicit none
type :: vector_t
integer :: x(1)
end type
contains
subroutine transform_index(a, result)
type(vector_t), intent(in) :: a
integer, intent(out) :: result
result = dot_product(a%x(:), a%x)
end subroutine
end module
With
lfortran --separate-compilation -c repro.f90
LFortran segfaults during compilation, while GFortran accepts it. dot_product(a%x, a%x) and sum(a%x(:)) both compile successfully. Without --separate-compilation, the module itself compiles, although I encountered the crash later when compiling a program using the routine.
2. Imported constant used to initialize a same-named component
module constants
implicit none
real, parameter :: value = 42.0
end module
module profile
use constants, only: value
implicit none
type :: profile_t
real :: value = value
end type
end module
LFortran reports
semantic error: Initialization of `value` must reduce to a compile time constant.
while GFortran accepts it. Aliasing the imported constant, for example default_value => value, and using that in the initializer works around the problem.