Reputation: 33
Sometimes I submit several jobs at once, and I want all data files written separately (do not overwrite on the same file). To do that I have to change the name of the data file for each run, and I do that adding a few lines of code, but I am wondering if anyone has any tip about similar issue.
For example, the best thing will be naming data files by the same name as the job number (although it sounds impossible).
Upvotes: 1
Views: 42
Reputation: 3264
You probably could useGET_COMMAND_ARGUMENT
(cf here) to take an argument that defines the folder for the output, e.g.:
PROGRAM main
... var defs ...
CALL GET_COMMAND_ARGUMENT(1, folder)
WRITE(filename, '(a,<blah>)') TRIM(folder)//"/<filename>.dat"
OPEN(UNIT=lun, FILE=filename, <args>)
... main code ...
END PROGRAM main
And in your submission script, you'd have to have something like
mkdir runjobNNNN
./main "runjobNNNN"
where NNNN
is the run number. Note that you might want to double check that these commands for the submission script will work, I'm not 100% sure that they work as written, but the idea ought to work.
Upvotes: 2