2014-10-03 15:17 GMT+00:00 Diego Avesani <diego.aves...@gmail.com>: > Dear all, > using ifort -r8, will reduce the error, > I am sure that every variable is in double precision, even when I convert > an integer to a real with real(X) or when I use FLOOR. > Yes, that is the whole point of -r8. It is not the root cause of your problems. But rather than using that, _why are you using it_. It seems to me that you do not fully understand the implications of adding this flag to your code. If you agree on this point, then you should definitely NOT use it :) (this is not to diminish your level of understanding... sorry if it hurts your feelings, I do not know how to put it any other way...)
Consider this small C snippet: float f = 1. double d =1. what you "basically" are doing is: #define float double float f = 1. double d = 1. Now why on earth would you do that? Well it has its usages, but if you do not see the implications it might have later, then the general consensus is to _explicitly_ tell the variable which precision it has. Do NOT consider -r8 a solution to your problems, it will (almost) certainly create more than you solve. > So, where con I insert the flag. > > Now I am converting the code with DP just to be able to debug my code > > What do you thing? > I think that you should always use DP and never -r8. > Am I wrong? > No you are not wrong, I would just call it "bad practice". > > Thanks again > It seems to me as if you want the double precision of the real's, and then you did: type :: ... real :: RR(2), QQ(4) end type TYPES(1)=MPI_INTEGER !We have three variables type in the new varible TYPES(2)=MPI_DOUBLE_PRECISION !Integer and Real and Real TYPES(3)=MPI_DOUBLE_PRECISION !Integer and Real and Real nBLOCKS(1)=1 !number of element in each block nBLOCKS(2)=2 nBLOCKS(3)=4 then you compiled and encountered problems. You added -r8 and it solved the problems... Hmm... This is not the way to solve the problem. In fortran a real is a single precision quantity. If you want it in double precision you have to tell the program that it is in double precision. In general coding I would advice you to use a module along the lines of this: module prec integer, parameter :: is = selected_int_kind(9) integer, parameter :: il = selected_int_kind(18) integer, parameter :: sp = selected_real_kind(p=6) integer, parameter :: dp = selected_real_kind(p=15) end module prec Every time you need a double precision variable do: real(dp) :: double_precision Every time you need a single precision variable you do: real :: single_precision or even better: real(sp) :: single_precision If you want a "single" precision integer (int) you do: integer :: int or even better: integer(is) :: int If you want a "double" precision integer (long) you do: integer(il) :: long Resorting to compiler flags to solve your problems should ALWAYS (in my honest opinion :) ) be the definite absolute last thing. Not second to last, really _the_ last thing. :) I hope I made my point clear, if not I am at a loss... :) > > > On 3 October 2014 17:03, Nick Papior Andersen <nickpap...@gmail.com> > wrote: > >> selected_real_kind > > > > > 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/25449.php > -- Kind regards Nick