This doesn't seem to be too bad, but I think the app should be in c++, or an interpreter language, and not Fortran. Unfortunately I am getting ready for a conference and a grant meeting, so I may not be able to work much on this until later in the month.
Please let me know if you need it right away and I will see what I can do.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Thanks Given: 430
Thanked 480 Times in 395 Posts
I looked over the code that you posted. It contains ALLOCATE statements, so I think you can ignore LMHmedchem comments about array declarations, because that is the Fortran-77 way of doing things. Fortran-90 and later use modern techniques for dynamic storage.
My take is different from LMHmedchem's in that I think a bird in the hand is worth two in the bush -- so you have a Fortran code, you might as well use it, as opposed to writing something new in a different language.
I considered the possible problems from too many files being open, so I wrote two test codes. The first simply opens files associating with "unit=1", but never explicitly closing them. The second opens files concurrently, associating with unit=n, where n varies. Both read a value from the file and the second goes back to read the first data file to make sure that the first file is still open and accessible.
I tried these codes with 2000 data files. "data0011 - data2010". The data files have a unique integer number in them (basically the sequence), and then the negative of that (number+1). Both test programs worked as I expected, without error.
I do agree with LMHmedchem that "Most likely, you are exceeding the capacity of some data structure that stores the contents of the files ...".
I will demonstrate a technique for identifying such errors in a subsequent post ... cheers, drl
---------- Post updated at 11:09 ---------- Previous update was at 10:57 ----------
I wrote the following code to demonstrate how ALLOCATE can obtain storage dynamically, but the array is still subject to being over-run:
This was run in the following context:
The results are part of the comments above. The first section shows that errors occur when the array is over-run sufficiently. However, if one enables bounds-checking, the error is caught immediately.
Regrettably, the AIX box to which I have access does not have a Fortran compiler that I could find. However, I think IBM almost certainly will have provided a means to check for such errors, so you'll need to do a bit of reading for that.
Adding the bounds check may degrade performance, but it's such a easy change to make to see if that is the error, that your time will be well-spent.
I have a Fortran program and I am writing out to logical unit 7. The program is reading from a text file and writing to the new file formatted. It gets through the read and writes some to the file but then stops with the following error:
1525-013 The sequential WRITE statement cannot be... (5 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I'm doing aproximation of derivative called five-point stencil. For every value of x, in interval , in step... (0 Replies)
After compiling a .f90 code and executing it, i get strange characters in the output file like :
Are these windows characters? how can i get rid of this?
Paul (1 Reply)
I have the code below and I want to remove the "go to" statements. Any idea how I can do it?
if (iorder == 0) then
tmincurrent = 1.0e11
if(ireverse == 0 .or. istop /= 1) then
do i = 1, 6
if ((side(i) /= sidelimit(i)) .and. (tminside(i) < tmincurrent)) then
... (1 Reply)
I am using doxygen for documenting my fortran code.
I want to write some notes after the header in different parts of the subroutine. Any idea what the tags should be as anything I write after the header is not displayed
... (0 Replies)
I had run into some fortran code to modify. Obviously, it was written without thinking of high performance computing and not parallelized... Now I would like to make the code "on track" and parallel. After a whole afternoon thinking, I still cannot find where to start. Can any one... (3 Replies)
we have a script to remove the files from particular path,when we tryingto run manually the script went to success and removed the files but the same script which is running by other team it got failed and giving the error "2 (RC)2 "..what is the cause of the failure..and we passing the... (2 Replies)
Hi, I have a very large, very old FORTRAN code that I work with. The code is quite messy and I was wondering if I can speed up execution time by finding subroutines that code execution spends the most time in. Is there any kind of software I can use to see where the code spends most of the... (1 Reply)
I am running C program which include directfb.h header files.
root@lxdevenv:~/Desktop# vi n.c
root@lxdevenv:~/Desktop# gcc n.c -o n -I/usr/local/include/directfb -L/usr/local/lib -ldirectfb -lfusion -ldirect -lpthread -lm
n.c: In function ‘main':... (2 Replies)