- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The situation is that I have an Coarray fortran program. I run it and it's distributed on N processors, and each of these processes should call an external program.
This external program is anexe program, however I want to run it in serial, on the processor that is calling it, as if it were part of the fortran program. The fortran program waits until the external program has completed, and then continues.
The problem is that coarray program only call the exe program once in one image if the command "CALL system". If I deleted the command 'call system(......)', it works well.
Can anyone tell me how I can call the program and ensure it runs only on this processor?
Thanks!
---
Extra information that might be helpful:
It simply run well if I don't use the command "call system". The result show that num_images: 1. The Coarray program is
-----------------------------------------------------------------------------------------------------
program HelloWorld1
implicit none
character(len=150)::str
integer :: me,i
me = num_images()
do i=1,num_images()
if(this_image() == i) then
CALL system('cd ..')
print *,'num_images:',num_images()
end if
end do
sync all
pause
end program HelloWorld1
-----------------------------------------------------------------------------------------------------
But if delete this sentence "CALL system('cd ..')" ,the program works well, num_images=4. Why about this problem? How to do it tocall an external program indifferent processes?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What does your real application want to do here? The loop you have is rather odd as it would always call SYSTEM in each image - the loop accomplishes nothing. Also, I suspect that the assignment to "me" wants to call this_image rather than num_images, though the code you have here never uses the variable. And, because the SYSTEM command runs in a separate process, the "cd" command would have no effect on the running program.
Typically a coarray program would not try to invoke external programs from the images. Theoretically, it should work, but may not do what you want. I note that the documentation says that SYSTEM waits on Windows, presumably it doesn't on Linux.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page