Subject: CGAL users discussion list
List archive
[cgal-discuss] A question about driving many Ansoft Maxwell programs on many machines
Chronological Thread
- From: Zhanghong Tang <>
- To: <>
- Subject: [cgal-discuss] A question about driving many Ansoft Maxwell programs on many machines
- Date: Thu, 27 Oct 2011 15:11:00 +1200
- Importance: Normal
Dear all,
I am sorry to both all of you since this topic is not related to the CGAL:( However, I know all of you are experts of C++ or Fortran language and the most important, I know that all of you are very kind, so I ask for your help. Now I am trying to simulate some projects by Ansoft Maxwell. There are thousands of projects to be simulated so I tried to drive it by the MPI-OpenMP based parallel program. I will use many computers with multiple cores on every computer. The computation mode is to let all computers work at the same time, and in every computer, many Ansoft Maxwell programs should be launched. Now I have problems to drive many Ansoft Maxwell programs: when many Ansoft Maxwell programs are launched by MPI based program, only one program run correctly and all other programs are killed after about 1 second. However, when the programs are launched by OpenMP based program, all Ansoft Maxwell programs run correctly. I addition, when the Ansoft Maxwell programs are launched by OpenMP based program, all windows Ansoft Maxwell programs are shown, but when launched by MPI based program, no Ansoft Maxwell window appears and they are all running in background. You must ask why you don't use the OpenMP based program to drive the Ansoft Maxwell, the reason is that I need to work on distributed computers or clusters, but the OpenMP based program can only work on one computer. Furthermore, when the OpenMP based program is driven by another MPI based program (the main control program), the number of Ansoft Maxwell programs launched by the OpenMP based program also changed to 1! Do you have such kind of experience to execute external programs by MPI or OpenMP programs? Could you please help me to check the problems of my code? Do you have any suggestions to drive many Ansoft Maxwell programs on many machines, with many Ansoft Maxwell programs running on the same machine? Waiting for your help! Thanks, Zhanghong Tang PS: the attachements: 1) commandlist.txt: the command line to drive Ansoft Maxwell program; 2) parallel_execute.f90: the OpenMP based program to drive Ansoft Maxwell program; 3) parallel_execute5.f90: the MPI based program to drive Ansoft Maxwell program. |
'D:\Program Files\Ansoft\Maxwell14.0\maxwell.exe'
' -runscriptandexit "F:\project\test_1.vbs"'
'D:\Program Files\Ansoft\Maxwell14.0\maxwell.exe'
' -runscriptandexit "F:\project\test_2.vbs"'
integer(4) function callShellExecute(filename,command)result(ret)
use shell32 !!1
implicit none
character(*) filename,command
ret = ShellExecute (&
hwnd = NULL, & !!2
lpOperation = "open"C, & !!3
lpFile = trim(filename)//char(0), & !!4
lpParameters = trim(command)//char(0), & !!5
lpDirectory = NULL_CHARACTER, & !!6
nShowCmd = SW_HIDE) !!7
end function! parallel_execute.f90
! Author: Zhanghong Tang @ 10/24/2011
! FUNCTIONS:
! parallel_execute - execute commands parallel.
!
!****************************************************************************
!
! PROGRAM: parallel_execute
!
! PURPOSE: execute commands parallel.
!
!****************************************************************************
program parallel_execute
use ifport
use OScall_mod
implicit none
! Variables
type commandlist
character*(512)::filename,command
end type
integer::commandsize,parallelsize,i,nthread,sleeptime
type(commandlist),allocatable::comm(:)
integer,allocatable::results(:)
character*(512)::path
call get_command_argument(1, path)
! Body of parallel_execute
open(1,file=trim(path)//'commandlist.txt')
read(1,*)commandsize,parallelsize,sleeptime
allocate(comm(commandsize),results(commandsize))
do i=1,commandsize
read(1,*)comm(i)%filename
read(1,*)comm(i)%command
enddo
close(1)
!$omp parallel
!$omp do
do i=1,commandsize
call sleep((i-1)*sleeptime)
! results(i)=system(comm(i)%filename)
call
OSCALL(iWaitMS=-1,Command=trim(comm(i)%filename),Args=trim(comm(i)%command),iRet=results(i))
! if(results(i)==-1)then
! results(i)=ierrno()
! endif
enddo
!$omp end do
!$omp end parallel
open(1,file=trim(path)//'result.txt')
do i=1,commandsize
write(1,*)results(i)
enddo
close(1)
deallocate(comm)
deallocate(results)
end program parallel_execute
! parallel_execute.f90
! Author: Zhanghong Tang @ 10/24/2011
! FUNCTIONS:
! parallel_execute - execute commands parallel.
!
!****************************************************************************
!
! PROGRAM: parallel_execute
!
! PURPOSE: execute commands parallel.
!
!****************************************************************************
program parallel_execute
use ifport
use OScall_mod
implicit none
type commandlist
character*(512)::filename,command
end type
character*(512)::workdir
integer::commandsize,parallelsize,sleeptime
integer,allocatable:: results(:)
type(commandlist),allocatable::comm(:)
integer,external::callShellExecute
include 'mpif.h'
integer::i
integer rank, size, myid, ierror
call get_command_argument(1, workdir)
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierror)
! read command lines and execute
open(1,file=trim(workdir)//'commandlist.txt')
read(1,*)commandsize,parallelsize,sleeptime
allocate(comm(commandsize),results(commandsize))
do i=1,commandsize
read(1,*)comm(i)%filename
read(1,*)comm(i)%command
enddo
close(1)
do i=1,commandsize
if(myid==mod(i-1,size))then
write(*,*)'myid=',myid
write(*,*)'file=',trim(comm(myid+1)%filename)
write(*,*)'comm=',trim(comm(myid+1)%command)
call sleep(myid*sleeptime)
! results(myid+1)=system(comm(myid+1)%filename)
results(myid+1)=callShellExecute(comm(myid+1)%filename,comm(myid+1)%command)
!call
OSCALL(iWaitMS=-1,Command=trim(comm(i)%filename),Args=trim(comm(i)%command),iRet=results(i))
if(results(myid+1)==-1)then
results(myid+1)=ierrno()
endif
endif
enddo
call
MPI_ALLGATHER(results(myid+1),1,MPI_INTEGER,results,1,MPI_INTEGER,MPI_COMM_WORLD,ierror)
if(myid==0)then
open(1,file=trim(workdir)//'result.txt')
do i=1,commandsize
write(1,*)results(i)
write(*,*)'results(',i,')=',results(i)
enddo
close(1)
endif
deallocate(comm)
deallocate(results)
call MPI_FINALIZE(ierror)
end
- [cgal-discuss] warnings in kds and polynomial_kernel testsuite, Andreas Fabri, 10/26/2011
- Fwd: [cgal-discuss] warnings in kds and polynomial_kernel testsuite, Andreas Fabri, 10/26/2011
- [cgal-discuss] A question about driving many Ansoft Maxwell programs on many machines, Zhanghong Tang, 10/27/2011
- Fwd: [cgal-discuss] warnings in kds and polynomial_kernel testsuite, Andreas Fabri, 10/26/2011
Archive powered by MHonArc 2.6.16.