- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What Ian said...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page