0

I'm working with Windows.

I have a program in a fortran 90 file ..\my_folder\my_file.f90 that yields an output file ..\my_folder\output.dat.

I'd like to run this file many times simultaneously (to get statistics from multiple stochastic simulations). But this cannot be done in one folder. I get the error message : cannot open output file a.exe: Permission denied collect2.exe: error: ld returned 1 exit status.

And I don't want to copy-past it to different folders ..\my_folder\new_folder0\my_file.f90,..\my_folder\new_folder1\my_file.f90... since this is not convenient if I want to modify a line inside the fortran file.

I would like to know what tool I can use to make one fortran file run from different folders ? And how is it possible to make it run but with different parameters please, so that in each folder the fortran file is run with different parameters ?

From the error message it seems also that if there was different .exe files and not only a.exe it would be ok. Is there a way that each time I compile the fortran file it would give a different .exe program to run ?

J.A
  • 285
  • 3
  • 12
  • 2
    I don't do windows so I may well be misunderstanding what you want, but why can't you compile and link just once, and then run the program as many times as required? This is based upon a bit of googling and finding things like https://stackoverflow.com/questions/18667502/what-does-permission-denied-id-returned-1-exit-status-mean – Ian Bush Mar 09 '22 at 20:02
  • 1
    Since you can't "run a fortran file", but rather run an executable compiled from a fortran file, can you not just have your compile script compile multiple executables from the one fortran file? (or compile one, and then copy it to as many destinations as needed automatically)? – veryreverie Mar 10 '22 at 09:00
  • It looks as if you're using gfortran. As @veryreverie says, you should build the executable just once. You can use the -o option to name it something other than a.exe. It's possible to put arguments on the command line that runs the EXE, but your program needs to be coded to retrieve them (GET_COMMAND_ARGUMENT is a standard intrinsic subroutine for this.) – Steve Lionel Mar 10 '22 at 22:31

0 Answers0