COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmanager.f
Go to the documentation of this file.
1 #if defined (KEKA) || defined (KEKB)
2 #define DOMPI
3 #endif
4 ! ****************************************************************
5 ! * cmanager: Managing Cosmos Simulation
6 ! ****************************************************************
7  subroutine cmanager
8  implicit none
9 #include "Zevhnp.h"
10 
11 
12 #if defined (DOMPI)
13 #include "mpif.h"
14 #include "Zmaxdef.h"
15 #include "Ztrack.h"
16 #include "Zmpi.h"
17 #include "Zmanagerp.h"
18 
19  integer err, intdata
20  character*120 parampath ! absolute param path given by job script
21  ! via envrionment
22 
23  call mpi_init(err)
24  call mpi_comm_size(mpi_comm_world, mpisize, err)
25  call mpi_comm_rank(mpi_comm_world, mpirank, err)
26 ! this is to treat exising name list as it is.
27 ! no delim="apstrophe" is needed
28 #if defined (KEKB) || defined (KEKA)
29  call setrteopts("namelist=old")
30 #endif
31 !!! call kgetenv2("PARAMPATH", parampath) ! this is OK ??
32  err = kgetenv2("PARAMPATH", parampath)
33 ! to avoid simultaneous access to HD, we
34 ! read namelist from rank0, rank1,...
35  if(mpirank .eq. 0) then
36  write(0,*) ' mpisize=',mpisize
37  open(tempdev, file=parampath, action="read")
38  call creadparam(tempdev)
39  close(tempdev)
40  if( mpisize .gt. 1) then
41  call mpi_send(mpirank, 1, mpi_integer, 1, 1,
42  * mpi_comm_world, err)
43  endif
44  else
45  call mpi_recv(intdata, 1, mpi_integer, mpirank-1, 1,
46  * mpi_comm_world, mpistat, err)
47  open(tempdev, file=parampath, action="read")
48  call creadparam(tempdev)
49  close(tempdev)
50 ! mpisize=5 and mpirank=4 ==> no more
51 ! mpirank=3 ==> send
52  if( mpirank .lt. mpisize-1 ) then
53  call mpi_send(mpirank, 1, mpi_integer, mpirank+1, 1,
54  * mpi_comm_world, err)
55  endif
56  endif
57 ! write(0,*)' rank=', mpirank, ' Job =', Job
58 !//////////////
59 #else
60 #if defined (MacIFC)
61  write(0,*) ' '
62 #endif
63  call creadparam(5) ! read execution conditions from stdin
64 #endif
65 #ifdef NEXT486
66  if( index(intmodel, 'fritiof1.6') .gt. 0 ) then
67  call cerrormsg('fritiof1.6 cannot be used'//
68  * ' for NEXT-Absoft Fortran', 0)
69  endif
70 #endif
71  call cbeginrun ! initialize the simulation
72  call ceventloop ! begin simulation and enter event Loop
73  call cendrun ! close the simulation
74  end
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
integer function kgetenv2(envname, envresult)
Definition: cgetLoginN.f:77
subroutine cendrun
Definition: cendRun.f:3
integer mpisize
Definition: Zmpibasic.h:1
integer mpirank
Definition: Zmpibasic.h:1
subroutine creadparam(io)
Definition: creadParam.f:5
subroutine ceventloop
Definition: ceventLoop.f:3
subroutine cbeginrun
Definition: cbeginRun.f:7
subroutine cmanager
Definition: cmanager.f:8