- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello forum,
is possible to parallelize via OpenMP/MPI the following fragment of fortran code:
do i = 1,n
call ext_run(input(i), output(i))
end do
where subroutine ext_run(input,output) execute external single thread program by SYSTEMQQ (commandline) function. For example: SYSTEMQQ ('extprog.exe < input_i.dat > output_i.dat'), where input_i and output_i are auxiliary data files which were created using input(i) or output(i) parameters.
I will be happy for some simple examples. Thanks ...
Michal
is possible to parallelize via OpenMP/MPI the following fragment of fortran code:
do i = 1,n
call ext_run(input(i), output(i))
end do
where subroutine ext_run(input,output) execute external single thread program by SYSTEMQQ (commandline) function. For example: SYSTEMQQ ('extprog.exe < input_i.dat > output_i.dat'), where input_i and output_i are auxiliary data files which were created using input(i) or output(i) parameters.
I will be happy for some simple examples. Thanks ...
Michal
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Untesteded pseudo code
pidTable = 0
do i = 1, n
pid = fork()
if(pid .lt. 0) exit ! vfork failed
if(pid == 0) then
call exit_run(input(i), output(i))
call _exit(0) ! not exit(nnn) and in case of return of exit_run
end if
! fork successful and masterprocess
pidTable(i) = pid ! save pid of child process
end do
! check for errors and wait for child processes to complete
status = 0
anyStatus = 0
do i=1,n
if(pidTable(i) == 0) exit ! no more processes
if(waitpid(pidTable(i), status, 0) != pidTable(i)) anyStatus = status
end do
if((pid.lt. 0).or. (anyStatus .ne.0)) write(*,*) "oops"
Jim Dempsey
pidTable = 0
do i = 1, n
pid = fork()
if(pid .lt. 0) exit ! vfork failed
if(pid == 0) then
call exit_run(input(i), output(i))
call _exit(0) ! not exit(nnn) and in case of return of exit_run
end if
! fork successful and masterprocess
pidTable(i) = pid ! save pid of child process
end do
! check for errors and wait for child processes to complete
status = 0
anyStatus = 0
do i=1,n
if(pidTable(i) == 0) exit ! no more processes
if(waitpid(pidTable(i), status, 0) != pidTable(i)) anyStatus = status
end do
if((pid.lt. 0).or. (anyStatus .ne.0)) write(*,*) "oops"
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Question for Intel fortran guys:
Arethe fortran functions: SYSTEM andSYSTEMQQ thread-safe?
Arethe fortran functions: SYSTEM andSYSTEMQQ thread-safe?

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