Coarray Initialization Error (OpenCoarrays)

Hi,

I am trying to use Opencoarrays for learning coarrays. I am trying to initialize coarray variable from a array.

This is the syntax I am trying

if ( this_image() == 1 ) then
    do i=1,num_images()
        write(*,*)"I : ",i,i_start(i),i_end(i)
        cellCA(1:i_index(i),1:jmax-1)[i] = cell(i_start(i):i_end(i),1:jmax-1)
    end do
end if

This particular point I am getting this error


CALLING CELL/AREA 105 1 105 1
I : 1 1 105
I : 2 106 210
[alpine-Latitude-7490:08892] *** An error occurred in MPI_Put
[alpine-Latitude-7490:08892] *** reported by process [7077889,0]
[alpine-Latitude-7490:08892] *** on win rdma window 9
[alpine-Latitude-7490:08892] *** MPI_ERR_RMA_RANGE: invalid RMA address range
[alpine-Latitude-7490:08892] *** MPI_ERRORS_ARE_FATAL (processes in this win will now abort,
[alpine-Latitude-7490:08892] *** and potentially your MPI job)

How can I assign a already existing data array to coarray for intialization.
Your guidance would be helpful.

Best Regards

Apurva

Do you have a complete but small program that demonstrates the problem? That would help us help you :innocent:

Is cellCA an allocatable array? If so, has it been allocated to the same shape on all images? Are you sure that the indices being used in the assignment are all within bounds (i.e. i_index(i) and jmax)? Those are the couple of things I would check, as typically an error message of that sort indicates an out-of-bounds access or accessing an unallocated array.

Hi Arjen,
Thanks for your help.
This code is a old 2D euler code. It was paralleized with OPENMP earlier. Now I am trying to learn COARRAYS and going step by step to modify the code. This is a intermediate step. The code is broken into 12 files. If this step is succesfull, I will try to modify the main calculation loops.

Hi Brad,

Thanks for your help. I will look into indexing aspect. This is the command I have used to allocate coarrays

allocate(cellCA(i_ind,jmax-1)[*])

Hope this is properly allocated.

It depends on what i_ind, and jmax are, and that they have the same value on every image.