Fortran77: Data I/O in big file

In summary, the author has generated a file of formatted data that they believe will slow down the process significantly, so they are thinking of splitting the file into smaller files and calling them when they need them. They managed to create those files, but they are struggling to pass the correct data to them.
  • #1
Bistable
1
0
Hi there,

I have generated a huge data file (approx 500MB large) containing a few 100k lines of formatted data (format(1X, 200ES11.4)). As I believe handling such a large file might over and over again (will be opened by an explicit FE code) might slow down the process significantely, I was thinking to split this file into many smaller files that contain certain columns of data (eg. file element1.txt contains columns 1 and 2, element2.txt contains columns 1 and 3, element3.txt contains columns 1 and 4...element150.txt contains columns 1 and 151) and call those when I need them (I only need a few data points during the calculations). I managed to create those files, but I am struggeling to pass the correct data to those files. Pointers might be good, but I do not know if and how they work with fortran 77. Is there a simple way of doing this?

Thanks a lot.
 
Technology news on Phys.org
  • #2
It depends on how you use the file.
If it is a huge stiffness matrix which you have to read from A-Z, then you do not have too many options.
If it is a file from which you extract information ("I only need a few data points during the calculations"), then you may seriously consider using the direct access file capability.
You will have to index the records, and your program will be able to read the required records directly, without a sequential read. Even if you have a file of 500 Mb with 100K+ records, the read is instant, and you can read or write in any order. The only catch is you will have to decide on a fixed record length on creation of the file, and the search is by record number. If the point numbers cannot be related to the record number, then external indexing will be required.
See, for example, a description at:
http://rsusu1.rnd.runnet.ru/develop/fortran/prof77/node162.html
or an example at:
http://rainbow.ldgo.columbia.edu/data/fortranreaddata.html

Note: you do not need to dissect the file. A huge record of length 2K is reasonable, and easier for you to work with. There will be less file handles, less indexes, and less I/O overhead.
 
Last edited by a moderator:
  • #3
Is there any reason you can't read/write it as an unformatted file? MUCH faster. Also, do not directly operate on pointers if you're performing a complex operation, they are very very slow as well.
 

What is Fortran77?

Fortran77 is a programming language developed in the late 1970s for scientific computing. It is a widely used language for numerical and scientific computing, especially in the fields of physics, engineering, and mathematics.

What is Data I/O in Fortran77?

Data I/O (Input/Output) in Fortran77 refers to the methods used to read data from external sources (such as files) into a Fortran program, and to write data from a program to an external destination. This is an essential aspect of programming, as it allows for the manipulation and analysis of large datasets.

What is a big file in Fortran77?

A big file in Fortran77 refers to a file that contains a large amount of data. This can vary depending on the system, but generally refers to files that are larger than the available memory. In Fortran77, specialized techniques must be used to efficiently read and write data from these large files.

What are some common methods for Data I/O in Fortran77?

Some common methods for Data I/O in Fortran77 include the use of formatted and unformatted input/output statements, such as READ and WRITE, as well as the use of direct access statements, such as GET and PUT. Additionally, Fortran77 also has built-in functions and subroutines specifically designed for Data I/O, such as OPEN and CLOSE.

Why is Data I/O in big files important in Fortran77?

Data I/O in big files is important in Fortran77 because it allows for the processing and analysis of large datasets that may not fit into the available memory. This is particularly relevant in scientific computing, where large amounts of data are often collected and analyzed. Efficient Data I/O techniques are crucial for ensuring accurate and timely results.

Similar threads

  • Programming and Computer Science
Replies
1
Views
650
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
747
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Computing and Technology
Replies
15
Views
1K
Back
Top