Open szaghi opened 7 years ago
I complete the module with this
subroutine GetBoundsFromCoarrayMember(Coarray_Object, intImageNumber, intLowerBound, intUpperBound)
type(NonSymmetricCoarray), intent(in) :: Coarray_Object[*]
integer, intent(in) :: intImageNumber
integer, intent(out) :: intLowerBound
integer, intent(out) :: intUpperBound
intLowerBound = 0
intUpperBound = 0
if (allocated(Coarray_Object[intImageNumber]%reaDataArray)) then
intLowerBound = lbound(Coarray_Object[intImageNumber]%reaDataArray, dim=1)
intUpperBound = ubound(Coarray_Object[intImageNumber]%reaDataArray, dim=1)
endif
endsubroutine GetBoundsFromCoarrayMember
endmodule NonSymmetricDemo
The results are as expetected:
stefano@zaghi(04:30 PM Fri Nov 11) on master [!?]
~/fortran/Coarray-with-Allocatable-Component-Example 5 files, 32Kb
→ ifort -coarray -coarray-num-images=2 src/NonSymmetricDemo.f90 src/main.f90 -o a.out
stefano@zaghi(04:47 PM Fri Nov 11) on master [!?]
~/fortran/Coarray-with-Allocatable-Component-Example 6 files, 824Kb
→ a.out
This example shows how to access the array bounds on Image 2 from Image 1.
The following output comes from image 1
Lower and upper bounds on image 2 : 1 15
Dear Stefano, thanks for pointing to that, the example code was inclompete indeed. I did overlook that and just added the following missing code to the module:
! SUBROUTINE GetBoundsFromCoarrayMember (CoarrayObject, intImageNumber, intLowerBound, intUpperBound) ! TYPE (NonSymmetricCoarray), CODIMENSION[], INTENT (INOUT) :: Coarray_Object INTEGER, INTENT (IN) :: intImageNumber INTEGER, INTENT (OUT) :: intLowerBound INTEGER, INTENT (OUT) :: intUpperBound ! IF (Coarray_Object[intImageNumber] % logAllocationStatus) THEN intLowerBound = LBOUND (Coarray_Object[intImageNumber] % reaDataArray, 1) intUpperBound = UBOUND (CoarrayObject[intImageNumber] % reaDataArray, 1) ELSE intLowerBound = 1 intUpperBound = 0 END IF ! END SUBROUTINE GetBoundsFromCoarrayMember ! !** END MODULE NonSymmetricDemo
I see your code using the ALLOCATED function to access a remote image. This did not work when I did code the original version (using ifort 14, some two years ago). Great, I will try this shortly myself.
cheers
2016-11-11 16:54 GMT+01:00 Stefano Zaghi notifications@github.com:
I complete the module with this
subroutine GetBoundsFromCoarrayMember(Coarray_Object, intImageNumber, intLowerBound, intUpperBound) type(NonSymmetricCoarray), intent(in) :: Coarray_Object[*] integer, intent(in) :: intImageNumber integer, intent(out) :: intLowerBound integer, intent(out) :: intUpperBound
intLowerBound = 0 intUpperBound = 0 if (allocated(Coarray_Object[intImageNumber]%reaDataArray)) then intLowerBound = lbound(Coarray_Object[intImageNumber]%reaDataArray, dim=1) intUpperBound = ubound(Coarray_Object[intImageNumber]%reaDataArray, dim=1) endifendsubroutine GetBoundsFromCoarrayMemberendmodule NonSymmetricDemo
The results are as expetected:
stefano@zaghi(04:30 PM Fri Nov 11) on master [!?]~/fortran/Coarray-with-Allocatable-Component-Example 5 files, 32Kb → ifort -coarray -coarray-num-images=2 src/NonSymmetricDemo.f90 src/main.f90 -o a.out
stefano@zaghi(04:47 PM Fri Nov 11) on master [!?]~/fortran/Coarray-with-Allocatable-Component-Example 6 files, 824Kb → a.out This example shows how to access the array bounds on Image 2 from Image 1. The following output comes from image 1 Lower and upper bounds on image 2 : 1 15
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MichaelSiehl/Coarray-with-Allocatable-Component-Example/issues/1#issuecomment-259987722, or mute the thread https://github.com/notifications/unsubscribe-auth/AQUQ_JaFxGhhOaMNPJrgfTSBo3l2Hlekks5q9I-0gaJpZM4Kv3MT .
More importantly, if you are currently studying the MPMD-style and load balancing examples, I would suggest to wait for the shortly upcoming version, with some major improvements are:
-
I am also sitting on a new rationale for that, the plan is to open a new topic on comp.lang.fortran about atomic subroutines shortly.
The objective is to hide the inner implementation of the coarray wrappers (and thus atomic subroutines, SYNC MEMORY, VOLATILE, etc.) from the parallel software development process.
cheers
2016-11-11 23:28 GMT+01:00 michael siehl miesiehl@gmail.com:
Dear Stefano, thanks for pointing to that, the example code was inclompete indeed. I did overlook that and just added the following missing code to the module:
! SUBROUTINE GetBoundsFromCoarrayMember (CoarrayObject, intImageNumber, intLowerBound, intUpperBound) ! TYPE (NonSymmetricCoarray), CODIMENSION[], INTENT (INOUT) :: Coarray_Object INTEGER, INTENT (IN) :: intImageNumber INTEGER, INTENT (OUT) :: intLowerBound INTEGER, INTENT (OUT) :: intUpperBound ! IF (Coarray_Object[intImageNumber] % logAllocationStatus) THEN intLowerBound = LBOUND (Coarray_Object[intImageNumber] % reaDataArray, 1) intUpperBound = UBOUND (CoarrayObject[intImageNumber] % reaDataArray, 1) ELSE intLowerBound = 1 intUpperBound = 0 END IF ! END SUBROUTINE GetBoundsFromCoarrayMember ! !** END MODULE NonSymmetricDemo
I see your code using the ALLOCATED function to access a remote image. This did not work when I did code the original version (using ifort 14, some two years ago). Great, I will try this shortly myself.
cheers
2016-11-11 16:54 GMT+01:00 Stefano Zaghi notifications@github.com:
I complete the module with this
subroutine GetBoundsFromCoarrayMember(Coarray_Object, intImageNumber, intLowerBound, intUpperBound) type(NonSymmetricCoarray), intent(in) :: Coarray_Object[*] integer, intent(in) :: intImageNumber integer, intent(out) :: intLowerBound integer, intent(out) :: intUpperBound
intLowerBound = 0 intUpperBound = 0 if (allocated(Coarray_Object[intImageNumber]%reaDataArray)) then intLowerBound = lbound(Coarray_Object[intImageNumber]%reaDataArray, dim=1) intUpperBound = ubound(Coarray_Object[intImageNumber]%reaDataArray, dim=1) endifendsubroutine GetBoundsFromCoarrayMemberendmodule NonSymmetricDemo
The results are as expetected:
stefano@zaghi(04:30 PM Fri Nov 11) on master [!?]~/fortran/Coarray-with-Allocatable-Component-Example 5 files, 32Kb → ifort -coarray -coarray-num-images=2 src/NonSymmetricDemo.f90 src/main.f90 -o a.out
stefano@zaghi(04:47 PM Fri Nov 11) on master [!?]~/fortran/Coarray-with-Allocatable-Component-Example 6 files, 824Kb → a.out This example shows how to access the array bounds on Image 2 from Image 1. The following output comes from image 1 Lower and upper bounds on image 2 : 1 15
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MichaelSiehl/Coarray-with-Allocatable-Component-Example/issues/1#issuecomment-259987722, or mute the thread https://github.com/notifications/unsubscribe-auth/AQUQ_JaFxGhhOaMNPJrgfTSBo3l2Hlekks5q9I-0gaJpZM4Kv3MT .
@MichaelSiehl
Dear Michael,
thank you very much for your help it is very appreciated!
Yes, I started to study your work more closely.
All your upcoming new features are much more than welcome. Anyhow, I have to start immediately because I need time to learn and because I have few time "now" and probably no more in the future :-(
I have one question: it is possible to wrap a MPMD-coarray inside a derive type in your approach? i.e.
type :: baz
integer, allocatable :: mic(:)
end type baz
type :: foo
type(baz), allocatable :: bar[:]
end type foo
I used a plain coarray member here: this is an unlimited polymorphic thus I think it could be also one of your MPMD type... this could be fantastic for HASTY...
| I have one question: it is possible to wrap a coarray inside a derive type in your approach? i.e.
That would be a coarray component, see Modern Fortran explained chapter 19.9 and, more importantly, Aleksandar Donev's paper chapter 3.1 and 3.1.1. Due to the required allocation it may not be possible to use these within my MPMD approach. (But I have not tried coarray components myself yet). I believe, the main advantage of coarray components should be that you can use them together with inheritance and polymorphism. To use them for MPMD-style programming you may need upcomming F2015 teams.
cheers
2016-11-12 7:28 GMT+01:00 Stefano Zaghi notifications@github.com:
@MichaelSiehl https://github.com/MichaelSiehl
Dear Michael,
thank you very much for your help it is very appreciated!
Yes, I started to study your work more closely.
All your upcoming new features are much more than welcome. Anyhow, I have to start immediately because I need time to learn and because I have few time "now" and probably no more in the future :-(
I have one question: it is possible to wrap a coarray inside a derive type in your approach? i.e.
type :: baz integer, allocatable :: mic(:) end type baz
type :: foo type(baz), allocatable :: bar[:] end type foo
I used a plain coarray member here https://github.com/Fortran-FOSS-Programmers/FOODIE/blob/master/src/lib/foodie_adt_integrand.f90#L21: this is an unlimited polymorphic thus I think it could be also one of your MPMD type... this could be fantastic for HASTY...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MichaelSiehl/Coarray-with-Allocatable-Component-Example/issues/1#issuecomment-260105194, or mute the thread https://github.com/notifications/unsubscribe-auth/AQUQ_Nfw9_FJnuKdsOo68i3ehjutz6fFks5q9VyNgaJpZM4Kv3MT .
Dear @MichaelSiehl
I am now studying your examples. Hasty is now ready to accept some coarray stuff (and I have now some time...).
I tried to compile this example, but:
I can complete this module with some guessing, but I am looking for your complete example because your are my master, I am afraid to get the wrong way if I am alone :smile:
Cheers.