Yes, I guess this is correct. Testing is easy! Try testing! As I stated, I do not know enough about the custom type in MPI, this was my hunch feeling...
2014-10-03 13:23 GMT+00:00 Diego Avesani <diego.aves...@gmail.com>: > Dear Nick, > thanks again. > After reading your post I have thought to compile as > > mpif90 -r8 *.f90 > > and to have this type variable > > TYPE tParticle > SEQUENCE > INTEGER :: ip > INTEGER :: fake > REAL :: RP(2) > REAL :: QQ(4) > END TYPE tParticle > > where I use fake to have 4 + 4 bytes, and then I have > TYPES(1)=MPI_INTEGER > TYPES(2)=MPI_DOUBLE_PRECISION > TYPES(3)=MPI_DOUBLE_PRECISION > nBLOCKS(1)=2 > nBLOCKS(2)=2 > nBLOCKS(3)=4 > > Am I wrong? Do I have correctly understood? > Really Really thanks > > > Diego > > > On 3 October 2014 15:10, Nick Papior Andersen <nickpap...@gmail.com> > wrote: > >> >> >> 2014-10-03 13:00 GMT+00:00 Diego Avesani <diego.aves...@gmail.com>: >> >>> Dear all, dear Nick, >>> thanks lot. >>> I have understood something, so I have create this variable type: >>> >>> TYPE tParticle >>> SEQUENCE >>> INTEGER :: ip >>> INTEGER :: fake >>> REAL :: RP(2) >>> REAL :: QQ(4) >>> END TYPE tParticle >>> >> But did it work? :) Remember to tell mpi about the padding (add one more >> type). >> Also, for cosmetic reasons I would do this: >> TYPE tParticle >> sequence >> integer :: ip >> real :: rp(2), qq(4) >> ! THIS IS A PADDING VARIABLE (SHOULD NEVER BE USED) >> integer :: pad >> end type >> >>> >>> In the point number 2, do you mean to insert some align options? >>> >> Search around for your compiler. However, this will be "forcing" your >> program to certain compilers, I would not recommend this (unless you have >> specific reasons anyway). >> >>> >>> For the point number 3, I do not understand where where I am wrong. This >>> is my code >>> >>> >>> TYPES(1)=MPI_INTEGER >>> >> Here it is wrong. >> If you compile with -i8 your integer is not an integer, but a long. Your >> displacements should be correct, but not your designation of the data-type >> for mpi. >> >>> >>> TYPES(2)=MPI_DOUBLE_PRECISION >>> TYPES(3)=MPI_DOUBLE_PRECISION >>> nBLOCKS(1)=2 >>> nBLOCKS(2)=2 >>> nBLOCKS(3)=4 >>> >>> DISPLACEMENTS(1)=0 >>> DISPLACEMENTS(2)=sizeof(dummy%ip)+sizeof(dummy%fake) >>> >>> >>> DISPLACEMENTS(3)=sizeof(dummy%ip)+sizeof(dummy%fake)+sizeof(dummy%RP(1))+sizeof(dummy%RP(2)) >>> >>> CALL >>> MPI_TYPE_CREATE_STRUCT(3,nBLOCKS,DISPLACEMENTS,TYPES,MPI_PARTICLE_TYPE,MPI%ierr) >>> >>> This is how I compile >>> >>> mpif90 -r8 *.f90 >>> >> No, that was not what you said! >> You said you compiled it using: >> mpif90 -r8 -i8 *.f90 >> >> >>> Again, really really Thanks >>> >>> Diego >>> >>> >>> On 3 October 2014 14:30, Nick Papior Andersen <nickpap...@gmail.com> >>> wrote: >>> >>>> I would never compile a fortran program relying on a specific compiler >>>> option! I would never use r8/i8! >>>> I would highly encourage you to explicitly set the precision of each >>>> variable if you need specific variable precision. There are plenty of >>>> tutorials around for this (selected_real/int_kind). >>>> >>>> Secondly, the warning of mis-alignment is due to the data type not >>>> being a multiple of 8. You can pad it with additional bytes to reach a >>>> multiple of 8 (in this case add a fake integer, or character(len=4)). >>>> I do not know if sequence is needed for the mpi data type (I guess it >>>> is needed when dealing with arrays of types, but again, I am not fully sure >>>> about this...). >>>> >>>> A couple of options: >>>> 1) I think sequence should work if you pad it to align with 8 bytes. >>>> 2) add code that is directive specified against the compiler to tell >>>> the exact alignment of the data type >>>> 3) Your compilation of -r8 -i8 does probably not work due to the >>>> integer being long, and hence your data type of MPI_INTEGER (you did not >>>> tell us whether you corrected this) >>>> >>>> >>>> >>>> >>>> 2014-10-03 11:07 GMT+00:00 Diego Avesani <diego.aves...@gmail.com>: >>>> >>>>> Dears, >>>>> First of all. Really really thanks for you help, I am learning a lot. >>>>> Second: >>>>> I try to study the MPI_TYPE_CREATE_STRUCT and all the things look >>>>> correct. >>>>> >>>>> I use Intel Fortran compiler and when I compile with -r8 means that I >>>>> am compiling in double precision. >>>>> >>>>> About Nick suggestion: >>>>> Coding >>>>> >>>>> TYPE tParticle >>>>> SEQUENCE >>>>> INTEGER :: ip >>>>> REAL :: RP(2) >>>>> REAL :: QQ(4) >>>>> END TYPE tParticle >>>>> >>>>> >>>>> if I compile with >>>>> mpif90 -r8 *.f90 >>>>> >>>>> I get the following error: >>>>> warning #6379: The structure contains one or more misaligned fields. >>>>> [TPARTICLE] TYPE tParticle >>>>> >>>>> >>>>> I can only compile as: >>>>> mpif90 -r8 -i8 *.f90 >>>>> >>>>> But I get the same error: >>>>> >>>>> An error occurred in MPI_Cart_create >>>>> [diedroLap:12267] *** reported by process >>>>> [139817172008961,139814070386689] >>>>> [diedroLap:12267] *** on communicator MPI_COMM_WORLD >>>>> [diedroLap:12267] *** MPI_ERR_OTHER: known error not in list >>>>> [diedroLap:12267] *** MPI_ERRORS_ARE_FATAL (processes in this >>>>> communicator will now abort, >>>>> [diedroLap:12267] *** and potentially your MPI job) >>>>> >>>>> >>>>> >>>>> What I can do? >>>>> Thanks a lot >>>>> >>>>> >>>>> >>>>> On 3 October 2014 08:15, Nick Papior Andersen <nickpap...@gmail.com> >>>>> wrote: >>>>> >>>>>> sequence >>>>> >>>>> >>>>> >>>>> >>>>> Diego >>>>> >>>>> >>>>> _______________________________________________ >>>>> users mailing list >>>>> us...@open-mpi.org >>>>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >>>>> Link to this post: >>>>> http://www.open-mpi.org/community/lists/users/2014/10/25434.php >>>>> >>>> >>>> >>>> >>>> -- >>>> Kind regards Nick >>>> >>>> _______________________________________________ >>>> users mailing list >>>> us...@open-mpi.org >>>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >>>> Link to this post: >>>> http://www.open-mpi.org/community/lists/users/2014/10/25435.php >>>> >>> >>> >>> _______________________________________________ >>> users mailing list >>> us...@open-mpi.org >>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >>> Link to this post: >>> http://www.open-mpi.org/community/lists/users/2014/10/25436.php >>> >> >> >> >> -- >> Kind regards Nick >> >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >> Link to this post: >> http://www.open-mpi.org/community/lists/users/2014/10/25437.php >> > > > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2014/10/25438.php > -- Kind regards Nick