Welcome, Guest
Username: Password: Remember me

TOPIC: Program failes in parallel mode

Program failes in parallel mode 10 years 11 months ago #11265

  • nguyenthong_BK
  • nguyenthong_BK's Avatar
Dear all,
I'm using telemac2d version v6p2. I have my fortran file in which I have some source code as:
........
........
if((dabs(TEMPS-28800.d0).le.1.d0).or.(TEMPS.le.20.d0)) then
OPEN(78,FILE='..\QH_User.txt')
REWIND(78)
read(78,*) N_Obs
K=0
do while (K.lt.N_Obs)
K=K+1
read(78,*) Time_Obs(K),QH_User(K,1),QH_User(K,2)
enddo ! N_Obs
else
endif
close(78)
.....................
.....................

The program runs seem good in the sequential mode. Unfortunately when I pass in parallel mode, the program failed. I don't know why? Anyone could give me a suggestion. Thank you in advance.
Best regards
Thong NGUYEN
HCMUT, VN
The administrator has disabled public write access.

Program failes in parallel mode 10 years 11 months ago #11268

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello,

It would be best not to open the file yourself with the FORTRAN because TELEMAC will not know that that file has to be handled differently in case of parallelism. So never open/read/close a file yourself. Instead use one of the FORMATTED FILE (ASCII) with the appropriate keyword and logical unit -- something like T2D_FILES(T2DFO1)%LU. TELEMAC will do the open/duplication/close, and all you have to do is the READ.

Do note that each processors will read that file. Each processor has a different number numbering of node compared to the global GEO file.

Hope this helps,
Sébastien.
The administrator has disabled public write access.

Program failes in parallel mode 10 years 11 months ago #11270

  • nguyenthong_BK
  • nguyenthong_BK's Avatar
Hello,
Thank you very much for your suggestion. My problem is that I would like to update my boundary condition (Q) without to stop my simulation in progress. So if I use the file predefined by Telemac, I can't update this condition, right? This file will be read only one time when the program start running?
Best regards
Thong NGUYEN
HCMUT, VN
The administrator has disabled public write access.

Program failes in parallel mode 10 years 11 months ago #11271

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello,

That is true. TELEMAC opens the file at the start and then close it at the end.

There are two issues you have to remember here:

(a) In parallel, the same file cannot be open more than a few times at the same time. Therefore the script copies your ASCII input file as many times as you have processors, so that each processor accesses its own file without conflict.

(b) Usually and where possible, file access has to prevented while limiting memory use. TELEMAC would not be able to load all files in memory, and TELEMAC does not need to access file for every iteration it makes (usually). The solution was for TELEMAC to open the files first, save in memory only the time records, and then only test against these saved records if TIME (or AT) advances requires a new read to the file to get to the next time value. This is true of the LIQUID BOUNDARY FILE for instance.

Of course, with your own ASCII file, you can do whatever you like and you do not need to save the time recodrs in memory.

So.

If you want to change the value in your file while running, you can, as long as ...:
1.- you duplicate your file in as many file as there are processors (not that this would not be possible on a HPC queue).
2.- if you do save the time records, you do not change the time records, but only the values of your profiles.
3.- in your FORTRAN, you access your file through T2D_FILES(T2DFO1)%LU, and you make sure you do the REWIND every time (unless you have saved the time record. If that does not work, you can always CLOSE T2D_FILES(T2DFO1)%LU and re-open T2D_FILES(T2DFO1)%LU with T2D_FILES(T2DFO1)%NAME.

To do 1. you can use the command telemac2d.py --split (using the -w option), which should (amongst other things) copy / duplicate your new file if modified.

Hope this helps,
Sébastien.
The administrator has disabled public write access.

Program failes in parallel mode 10 years 11 months ago #11273

  • nguyenthong_BK
  • nguyenthong_BK's Avatar
Dear Sébatien,
Thank you very much for your precious advice. I hope that I will solve my problem with your suggestion. One more time, thank you so much.
Best regards
Thong NGUYEN
HCMUT, VN
The administrator has disabled public write access.
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.