From: Vito on 3 May 2010 19:52 Hi to all, I am trying to search a solution of this problem. I use fortran to solve a set of equations in an iterative loop. My data are 12 matrixes like this COMPLEX*16 Z1(4096,2048) In each loop, after other operations, I need to perform a FFT calling an external library that needs the data as a single row vector. So in the statement part of my code I use the command EQUIVALENCE (X1,Z1) where X1 is a complex array 4096*2048. At the moment this is better I am able to do. Consider I typically have 5000 iterations of 12 complex matrixes with forward and bakward FFT. Now, I need to assign the dimension of the matrixes dynamically, so I can create the .exe and use an input file to determine the dimension of my problem, but the EQUIVALENCE statement is not usable with an allocable data like COMPLEX*16, allocatable :: Z1(:,:). I see in previous post I can use RESHAPE, or additional temporary variables, but I have here the double problem of a very big RAM memory needs and execution time. In fact, at the moment this problem uses 2-3 GB of RAM and the execution time are something like 24 hours. If I understand well, the use of RESHAPE or additional variable will double, at least, both RAM needs and execution time. I will be very grateful If anybody has any suggestion. Vito
From: glen herrmannsfeldt on 3 May 2010 20:25 Vito <vito.roppo(a)gmail.com> wrote: > I am trying to search a solution of this problem. > I use fortran to solve a set of equations in an iterative loop. > My data are 12 matrixes like this > COMPLEX*16 Z1(4096,2048) > In each loop, after other operations, I need to perform a > FFT calling an external library that needs the data as a > single row vector. If the external library doesn't have an assumed shape (Fortran 90 or higher feature) array for its dummy argument, you can just pass the Z1 as an actual argument. A feature of the Fortran 77 (and earlier) style assumed size arrays allows for the called routine to use different rank or dimensions, accessing the array elements in the order they are stored, just as with EQUIVALENCE. The called routine can reference it as a 1D array! > So in the statement part of my code I use the command > EQUIVALENCE (X1,Z1) > where X1 is a complex array 4096*2048. > At the moment this is better I am able to do. > Consider I typically have 5000 iterations of 12 complex matrixes with > forward and > bakward FFT. > Now, I need to assign the dimension of the matrixes dynamically, > so I can create the .exe and use an input file to determine the > dimension of my problem, > but the EQUIVALENCE statement is not usable with an allocable data > like > > COMPLEX*16, allocatable :: Z1(:,:). > > I see in previous post I can use RESHAPE, or additional temporary > variables, but I have here the double problem of a very big RAM > memory needs and execution time. I believe that RESHAPE doesn't necessarily allocate a new array, but it might depend on how it is used. -- glen
From: Gordon Sande on 3 May 2010 21:06 On 2010-05-03 20:52:10 -0300, Vito <vito.roppo(a)gmail.com> said: > Hi to all, > > I am trying to search a solution of this problem. > I use fortran to solve a set of equations in an iterative loop. > My data are 12 matrixes like this > > COMPLEX*16 Z1(4096,2048) > > In each loop, after other operations, I need to perform a FFT calling > an external library > that needs the data as a single row vector. > So in the statement part of my code I use the command > > EQUIVALENCE (X1,Z1) > > where X1 is a complex array 4096*2048. > At the moment this is better I am able to do. > Consider I typically have 5000 iterations of 12 complex matrixes with > forward and > bakward FFT. > Now, I need to assign the dimension of the matrixes dynamically, > so I can create the .exe and use an input file to determine the > dimension of my problem, > but the EQUIVALENCE statement is not usable with an allocable data > like > > COMPLEX*16, allocatable :: Z1(:,:). > > I see in previous post I can use RESHAPE, or additional temporary > variables, > but I have here the double problem of a very big RAM memory needs and > execution time. > > In fact, at the moment this problem uses 2-3 GB of RAM and the > execution time are something like 24 hours. > If I understand well, the use of RESHAPE or additional variable > will double, at least, both RAM needs and execution time. > > I will be very grateful If anybody has any suggestion. > Vito If your FFT is an "F77" code in that it uses either assumed size or fixed size arrays then the arrays are determined by their initial element and the rules of sequence association. In practical terms this means that your equivalence was not actially needed as you could have gotten the same results in a less understandable form. Your z(1,1) and x(1) are the same initial element. The good news is that the "F77" code does not care if you supply a dynamic array or any other kind of array as they are all just arrays. So just use z(1,1) where you now have x(1). Toss the equivalence statement and add adequate comments to remind yourself (and others) what you have done. This all depends on the FFT code being well behaved with respect to sequence association. If there are no assumed shapes (the use of ":"s) then it is a fairly good bet. The requirement that the FFT data be a "row vector" sure sounds like it is vanilla sequence association. (Even vanilla can be rather confusing to those who are confused and rushed so caution is indicated!)
From: robin on 3 May 2010 22:08 "Vito" <vito.roppo(a)gmail.com> wrote in message news:ba93de44-1573-41eb-b069-2019ff9f622c(a)e35g2000yqm.googlegroups.com... | Hi to all, | | I am trying to search a solution of this problem. | I use fortran to solve a set of equations in an iterative loop. | My data are 12 matrixes like this | | COMPLEX*16 Z1(4096,2048) | | In each loop, after other operations, I need to perform a FFT calling | an external library | that needs the data as a single row vector. | So in the statement part of my code I use the command | | EQUIVALENCE (X1,Z1) | | where X1 is a complex array 4096*2048. If these two arrays Z1 and X1 have the same dimensions, why not just use Z1 throughout ? and then no equivalencing is required.
|
Pages: 1 Prev: long int computations Next: Any Free Fortran w/ quickwin? |