]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/gparal/gpinit.F
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gparal / gpinit.F
1 *CMZ :          11/11/94  14.40.52  by  John Apostolakis CERN GP-MIMD 2
2 *-- Author :    John Apostolakis CERN GP-MIMD 2   13/07/94
3 C------------------------------------------------------------------------
4 C     gpinit
5 C           Function: initialises the parallel environment (MPI) and
6 C           parallel's Geant's variables that track it.
7 C
8 C     called by:  <USER>, uginit, (if CERNLIB_PARA switch is used)
9 C------------------------------------------------------------------------
10 #if defined(CERNLIB_PARA)
11       subroutine gpinit
12       implicit none
13 #include "geant321/mpifinc.inc"
14 #include "geant321/multiprox.inc"
15 #include "geant321/multseeds.inc"
16 #include "geant321/gcflag.inc"
17       integer             msgerrpas, ierr
18       common  /gpinitpas/ msgerrpas, ierr
19
20       integer ierr1, ierr2, ierr3
21       integer ibase, lunerr
22       integer msgerror, rngerror
23       data    ibase / 1 /
24       data    msgerror, rngerror / 0, 0 /
25       parameter (lunerr= 0)
26
27 c     Initialise Event Level Parallel Geant (message passing)
28 c
29 c     Tasks:
30 c       Initialise Message Passing and my relevant variables (npsize etc)
31
32       nprank= -1
33
34 c     Initialise Message Passing
35
36       call MPI_init( ierr1 )
37       call MPI_Comm_rank( MPI_COMM_WORLD, nprank, ierr2 )
38       call MPI_Comm_size( MPI_COMM_WORLD, npsize, ierr3 )
39       if ( (ierr1 .gt. 0)  .or. (ierr2 .gt. 0)  .or. (ierr3 .gt. 0) )
40      +    msgerror=1
41
42       write(*,*)  ' Node ', nprank , ' initialised - one of ', npsize
43
44 c     Set Error flag ...
45
46       if( msgerror .ne. 0) then
47           write (lunerr, *)  ' Message Passing Library error ',
48      &                                  ' in initialisation. '
49           if ( (ierr1.ne.0) .or. (nprank .ne. -1)) then
50              write (lunerr, *)  ' Occured in node ', nprank
51           else
52              write (lunerr, *)  ' MASSIVE ERROR> in an unknown node. '
53              write (lunerr, *)   
54      &       ' This is non-recoverable, MPI did not initialise at all'
55 c
56 c            This is non-recoverable, MPI did not initialise at all
57              call gpabort()
58 c            ieorun= 1
59              stop
60           endif
61       endif
62 c
63 c     By default a static decomposition of events is done, with
64 c       each processor geting 1/number of processors of the share 
65 c       of events. 
66 c     If an input file exists or the time per event has a large standard
67 c       deviation, the events can be dynamically assigned. You will then
68 c       need to look at the routines gukine and muxread in gexam3.
69 c
70 c     The following just initialises the default "static" configuration,
71 c       in which there is no "master" or "leader".
72 c
73 c         -- Id of task expected to be a "master"
74       npleader = -1
75 c         -- Id of task expected to be 1st worker
76 c                                 (representative for printout ...)
77       nfirstworker= 0
78
79       msgerrpas= msgerror
80
81       return
82       end
83 #endif