- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following program outputs some garbage in the string S (after the concatenated part), is this expected?
PROGRAM P IMPLICIT NONE INTEGER :: I CHARACTER(LEN=20) :: S
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not expected by me, at least. We'll take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which compiler do you use? I remember such problems with ifort 14 when using character components of derived type coarrays. But since ifort 15 everything works fine in my own programming.
regards Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Michael, this is with IVF 16.0 Update 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Escalated as issue DPD200380661. It seems to have something to do with the TRIM(S) in the expression, though printing TRIM(S) by itself is ok.
By the way, we've made some changes in the way the forums display member names, and if you haven't set a "Display Name", or your display name is the same as your login ID, it will now show as "(Name Withheld)". If you want to fix this, click on the arrow to the right of your name at the upper right, select Dashboard, and then edit your profile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tried your code with both, ifort 15 and gfortran 6/OpenCoarrays 1.0.1. Indeed, your code does puzzle both coarray implementations. I did slightly modify your code to figure out what the reason could be. The following code does work with both compilers (BTW, since you start the DO loop counter with 1 you get AB on image 1 and ABB on all other images for S):
PROGRAM P
IMPLICIT NONE
INTEGER :: I
CHARACTER(LEN=20) :: S
CHARACTER(LEN=20) :: T
S = ''
SYNC ALL
IF (THIS_IMAGE()==1) THEN
S = 'A'
DO I=1,NUM_IMAGES()
T = TRIM(S) // 'B'
S = T
END DO
END IF
SYNC ALL
WRITE(*,*) S
END PROGRAM P
Maybe this could be an example that both coarray implementations can't efficiently compile the remote data references due to the concatenation operator.
Isn't that also an issue of coarray correspondence as described by chapter 2 of Aleksandar Donev's 'Rationale for Co-Arrays in Fortran 2008' paper? As far as my understanding goes, in its extreme form, coarray correspondence would impose a syntax for remote data transfer like this: S=S. Of course, our coarray implementations (ifort and gfortran/OpenCoarrays) can already handle remote data references even if we use a purely local object (T in the code change I made) or even with numerical operations on the right-handed side of an assignment for example. (But possibly not with a character concatenation operation as shown in the original code). The essential statement from Aleksandar Donev's paper could be: "This correspondence is essential for both the semantics, in the sense that it enables the programmer to reason about what object a co-indexed data reference really refers to, and for implementations, since it enables efficient compilation of remote data references."
Of course, these are only my current personal thoughts.
Best Regards Michael
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page