- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
There are two questions I would like an explanation for in the simple test below:
1. Why doesn't the code issue an error at run time - since the allocation of the coarray specifies different bounds on image 1 and images >1?
2. Why does the code run to completion at all? I thought there was an implicit barrier (SYNC ALL) for the allocation of any coarray, and that this barrier had to correspond to the same line of code. Or is it sufficient to have coarray allocations with the same bounds (even if said allocation occurs in different parts of the program)?
(1) looks like a bug - the Cray compiler works as intended in this case; (2) I am not so sure (actually it's better not to have the requirement of a barrier on the same ALLOCATE statement (same line of code).
Thanks,
Olivier
PROGRAM COARRAY_TEST
IMPLICIT NONE
INTEGER,ALLOCATABLE :: TEST(:)[:]
! Master thread
IF (THIS_IMAGE()==1) THEN
ALLOCATE(TEST(2)
TEST = THIS_IMAGE()
! Slave threads
ELSE
ALLOCATE(TEST(4)
TEST = THIS_IMAGE()
ENDIF
! Write TEST
WRITE(*,'(A,I4,A,10I4)') 'Image #',THIS_IMAGE(),' Array value:',TEST
END PROGRAM COARRAY_TEST
- Balises:
- Intel® Fortran Compiler
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Have a read of note 6.20 in F2008.
When an image executes an ALLOCATE statement, communication is not necessarily involved apart from any required for synchronization. The image allocates its coarray and records how the corresponding coarrays on other images are to be addressed. The processor is not required to detect violations of the rule that the bounds are the same on all images, nor is it responsible for detecting or resolving deadlock problems (such as two images waiting on different ALLOCATE statements).
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
What Ian said...
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thanks Steve and Ian for the answer. I understand the near impossibility to perform these checks at compile-time. I note however that (1) can be checked at runtime (this is why the above code crashes when run on a Cray with the Cray compiler); as for (2) I can't make up my mind on whether the 'flexibility' left open by having images allocating coarrays with the same bounds but in different part (code lines) of the code is a good thing or not. Maybe it's also near impossible to detect.
Olivier
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable