# Problems with coarrays

**URL:** <https://fortran-lang.discourse.group/t/problems-with-coarrays/2565>\
**Category:** Uncategorized\
**Created:** [January 12, 2022, 4:22am UTC](https://fortran-lang.discourse.group/t/problems-with-coarrays/2565 "2022-01-12T04:22:47Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Knarfnarf](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Knarfnarf](https://fortran-lang.discourse.group/u/Knarfnarf)\
**Post date:** [February 4, 2023, 5:51am UTC](https://fortran-lang.discourse.group/t/problems-with-coarrays/2565/21 "2023-02-04T05:51:24Z")

</div>

Meh… Not really… Example;

sync all  
i\_a[i\_otherimage] = i\_data  
sync all

usually fails (wrong iteration number)

sync all  
i\_data = i\_a[i\_otherimage]  
sync all

does most times (wrong iteration number)  
but this never does;

do while(l\_notdone)  
allocate(p\_localdatastucture)  
sync all  
p\_localdatastructure = p\_remotedatastructure[i\_otherimage]  
do while (p\_localdatastructure%i\_iterationnumber .ne. i\_iterationnumber)  
deallocate(p\_localdatastructure)  
sleep(1)  
allocate(p\_localdatastructure)  
p\_localdatastructure = p\_remotedatastructure[i\_otherimage]  
end do  
sync all  
… some work …  
deallocate(p\_localdatastructure)  
sync all  
end do

always works so long as you always deallocate the structure and sleep if you need to.

Knarfnarf

[Previous page](https://fortran-lang.discourse.group/t/problems-with-coarrays/2565.md?page=1)
