Topic: Esiest way to share data between differents projects

Hello again!

As I mentioned in my first post, I'm trying to manipulate a program developed in Fortran 77 mainly. That code has more than 20,000 lines divided in more than 150 subroutines. And right now I'm focusing only in a few subroutines, I'm changing them to free format and whatever recommendation that I read I try to implement.

I am pretty new to Fortran and for me change the whole project is a huge work that's why I'm working only in a few subroutines in order to gain confidence with the language. So my approach is the following: for those specific subroutines I created a new project and bring the necessary data to the project to compare.

Then my question is: is there a way to share arrays/vectors/matrices between different projects in simply fortran? What I did was to print to a txt file the data and then read it in the new project. But I find this tedious, is there a better approach?

Any help/suggestion would be really appreciated.

Re: Esiest way to share data between differents projects

A common method of doing this process is to have test "vectors" (data sets) that you run through the "new" and "old" version of the code.  The results from the "old" code could be consider as correct, so you are trying to ensure that the results from the new code match that from the old code.  A third program or script would run the test data sets through the new code, then compare the output to the "correct" values, noting any differences in an output file.  If you are doing this under linux or can install a few linux type tools under Windows, you can use the shell script commands to run the tests and do the output comparisons easily.

Re: Esiest way to share data between differents projects

Thanks for your response baf1! Could you point me in the right direction about those tools for windows (Right now I'm using only windows), I will certainly check such tools!

But besides to compare the vectors I also need some matrices/vectors that are calculated in the whole program, and the subroutines that I'm modifying does not have access to that data because are in another project. And I need those matrices to affected that new matrices that is within the new subroutines.

So, reformulating my question, in one project I have calculated a matrix that is needed in another project, is there a better way to share that data other than writing and reading through a file? the dimension of my array is 7500 x 7500, the txt that is generated is around 1GB and I would like to know a better approach.

Thanks for any help provided!

Re: Esiest way to share data between differents projects

If you don't have the source code so that you can merge the source into a single executable, than you really have no choice but to output the results from the first program into a file that is read in by the second program.  You can use unformatted I/O which would save some execution time for a large datafile. 

In one program, something like

write(12)array

in the the program

read(21)array

where 12 and 21 are the unit numbers.  Spend some quality time with a Fortran manual, or read some of the material available online, such as

http://www.am.qub.ac.uk/users/d.dundas/ … matted.pdf

Re: Esiest way to share data between differents projects

Was acctually going to ask something about sharing data aswell but i see you guys are into it. I hoped to avoid creating a sepearate file for each project but it seems its the only way to go if i dont have the source code.

Ill read thru that link you posted baf. Thnx for sharing // Chris