×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CALL SYSTEM in Fortran

CALL SYSTEM in Fortran

CALL SYSTEM in Fortran

(OP)
Hi everyone!

I am trying to call a program from Fortran using the CALL SYSTEM subroutine. The problem has a little twist to it which is I am trying to run two commands in parallel. I am working on a UNIX machine.

What I have now is:

progam main
.
.
.
CALL SYSTEM('run_prog1 & run_prog2')
.
.
.
end main

What happens is that prog1 and prog 2 are executed (almost) simultaneously (the procedure is rather straight forward as I am simply using "&" to execute the two programs as I would otherwise do in the command prompt). The problem is that the computation of prog1 is different from prog2. So if prog1 is faster than prog2 fortran will finish executing prog1 and proceed reading the next commands from the main program while prog2 keeps running. Well, this is not really what i wanted! I would like Fortran to "wait" for both prog1 and prog2 to be finished (that means they have written their output files) before continuing with the main program.

I am very grateful for any help or any suggestions that you might have.

Regards
José

RE: CALL SYSTEM in Fortran

1) Does the compiler support execlp
2) Which compiler is it? (gfortran, g95, g77, ifort etc)

RE: CALL SYSTEM in Fortran

Can you have program 1 call program 2, and then not allow program 1 to terminate until after program 2 has terminated?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close