Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29487 Discussions

Possible issue with allocate, move_alloc, deallocte in coarrays

Adelson_BR1
Beginner
158 Views

I'm trying to dinamically increase the size of a coarray declared as num_team(:)[:] so that it reflects the number of teams, known during execution.

The code is basically,

if(.not. allocated(num_teams)) then

   allocate(num_teams(1)[*],stat=erro)

else

   i=size(num_teams)

   allocate(num_teamsv(i+1)[*])

   num_teamsv(1:i) = num_teams

   deallocate(num_teams)

   allocate(num_teams(i+1)[*])

   num_teams = num_teamsv

   deallocate(num_teamsv)

endif

 

It is expected that the first allocate would be a barrier so that all images get num_team allocated. If so any other image would be direted to the ELSE option and the coarray num_team would be reallocated. This is not what is going on.  The following code has the same purpose and shows that if we force the reallocation breaking the if,else,endif into two if,endif, the first position of num_team(1)[*] is corrupted.

I´m using ifx 2025.1, with FOR_COARRAY_NUM_IMAGES=9, and compiling with

mpiifx -coarray=distributed testeifx.f90 -o testeifx

0 Kudos
1 Reply
Adelson_BR1
Beginner
130 Views

I guess I did mistakes in this bug report. In fact, I have to rethink and learn more about how to program what I need using coarrays.

Sorry.

0 Kudos
Reply