This tag is for questions specifically relating to the coarray (a partitioned global address space model) feature introduced in Fortran 2008. The tag should not be used simply because a problem example uses coarrays. In addition, the general Fortran tag should be added and no revision-specific Fortran tag prior to Fortran 2008 should feature.
Questions tagged [fortran-coarrays]
25 questions
4
votes
1 answer
Passing a coarray subarray to a function gives a wrong part of the array
I'm attempting to understand how to pass a slice of a multidimensional co-array to a function. I would like to use a function like this:
function get_int_vec(vec_int_2get, rank) result(ret_val)
implicit none
integer, dimension(:),…

Sparonuz
- 145
- 7
3
votes
1 answer
Coarrays disabled use -fcoarrays=?
I'm trying to run a Fortran code that follows the example for the book:
Curcic, M. 2020. Modern Fortran: Building Efficient Parallel Applications.
Although I get the following error when I run it and I'm not experienced enough to understand what…

Stackbeans
- 273
- 1
- 16
3
votes
1 answer
Why does coarray with allocatable component creates segmentation faults when accessed from different image?
I want to use the fortran coarray feature to have different size arrays on different images.
Following the 2008/2018 standard, this should be possible by using a derived type containing an allocatable. I am using gfortran 8.2.0 with opencoarrays…

Frenz
- 41
- 5
2
votes
1 answer
When and where are writes to coarrays visible in Fortran?
I have this program, and would expect this to print 1 2 when run with 2 images. However, it prints 1 1 on one image, and 1 2 on the other.
program main
implicit none
double precision, allocatable :: a[:]
allocate(a[*])
a =…

asdfldsfdfjjfddjf
- 209
- 1
- 6
2
votes
1 answer
Is/Will there be a way to perform Fortran Coarray calls asynchronously?
I've been falling in love with the ease-of-use of Fortran's Coarrays framework, because of how clean it is compared to lower level APIs like MPI.
But one thing I haven't been able to tease out is whether there is a way to know how to explicitly tell…

Edward Yang
- 51
- 6
2
votes
1 answer
How to mix Coarray and MPI code in Fortran
I would like to combine Fortran coarray with MPI inside my code. I plan to use third party softwave(HYPRE), which used MPI, for linear system solvers. For the rest of my work, I want to use the Fortran coarray (OpenCoarrays). I've already searched…

Tung Dang
- 21
- 4
2
votes
1 answer
Application throws segmentation fault after some time on calling a procedure (containing local coarrays) in a loop
I am trying to call a subroutine in a loop. This subroutine has a local coarray. Following is the code that I am using:
! Test local coarray in procedure called in a loop.
!
program main
use, intrinsic :: iso_fortran_env, only : input_unit,…

Ombrophile
- 613
- 1
- 7
- 13
2
votes
0 answers
calling a Coarray Fortran shared library from Python
I am trying to understand how a Coarray Fortran DLL can be possibly called from Python. Consider the following sample Fortran module file example_mod.f90 which is to be called from Python later:
module example_mod
use iso_c_binding
implicit…

Scientist
- 1,767
- 2
- 12
- 20
2
votes
1 answer
Coarray derived type of allocatable vector of allocatable character components
Consider the following code that attempts to create a coarray derived type containing an array of variable-length allocatable character types.
program testCoarrayJaggedArray
implicit none
integer :: i
type ::…

Scientist
- 1,767
- 2
- 12
- 20
2
votes
1 answer
Coarray deadlock in do-cycle-exit
A strange phenomenon occurs in the following Coarray code
program strange
implicit none
integer :: counter = 0
logical :: co_missionAccomplished[*]
co_missionAccomplished = .false.
sync all
do
if (this_image()==1) then
counter = counter+1
…

Scientist
- 1,767
- 2
- 12
- 20
2
votes
0 answers
Only one image in Fortran Coarrays in gfortran
I'm using gfortran compiler and trying to work on parallel programming without MPI. Even though, I spent too much time on reading about Fortran, gfortran, parallel programming, I couldn't do anything to use different processors at the same time.
My…

Lito
- 17
- 2
1
vote
0 answers
Coarray Fortran segfaults when passing distributed argument
I am getting a segfault in C = C + matmul(A(:, 1 + (l - 1) * n / p: l * n / p), B(:,:)[l]) using gfortran + mpich, with n = 4000, p = 2. Is it not allowed to pass slices of distributed arrays into functions? When copying out B(:,:)[l], it is super…

asdfldsfdfjjfddjf
- 209
- 1
- 6
1
vote
0 answers
Fortran segmentation fault when deallocating a coarray component of a derived type (bug?)
I get a segfault when trying to deallocate a coarray component of a derived type. This happens after I assign one instance of the type to another. The minimal example is as follows:
program mytest
implicit none
type notmytype
real,…

water
- 11
- 2
1
vote
1 answer
Run only part of fortran coarray code parallel rest serial
I have a main program that has subroutine written using coarrays. The problem is that while running the code it treats the entire code (main + subroutine) as parallel code and runs it on all specified processors. For eg., the Below program prints…

codegeek
- 11
- 2
1
vote
1 answer
coarray fortran array doesn't get updated
I'm just learning to use coarry with Fortran. I have a very simple program. I have an array of length 9 that I want to distribute over 3 processes, do some calculations, and merge them back to a single array (basic MPI_scatter/MPI_gather like…

Eular
- 1,707
- 4
- 26
- 50