forked from KuangLab-Harvard/SAM_SRCv6.11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
task_init.f90
65 lines (44 loc) · 1.11 KB
/
task_init.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
subroutine task_init
! Check things, initialize multitasking:
use grid
implicit none
integer itasks,ntasks
if(YES3D .ne. 1 .and. YES3D .ne. 0) then
print*,'YES3D is not 1 or 0. STOP'
stop
endif
if(YES3D .eq. 1 .and. ny_gl .lt. 4) then
print*,'ny_gl is too small for a 3D case.STOP'
stop
endif
if(YES3D .eq. 0 .and. ny_gl .ne. 1) then
print*,'ny_gl should be 1 for a 2D case. STOP'
stop
endif
if(nsubdomains.eq.1) then
rank =0
ntasks = 1
dompi = .false.
else
call task_start(rank, ntasks)
dompi = .true.
! call system('hostname')
if(ntasks.ne.nsubdomains) then
if(rank.eq.0) print *,'number of processors is not equal to nsubdomains!',&
' ntasks=',ntasks,' nsubdomains=',nsubdomains
call task_abort()
endif
call task_barrier()
call task_ranks()
end if ! nsubdomains.eq.1
do itasks=0,nsubdomains-1
call task_barrier()
if(itasks.eq.rank) then
open(8,file='./CaseName',status='old',form='formatted')
read(8,'(a)') case
close (8)
endif
end do
masterproc = rank.eq.0
if(masterproc) print *,'number of MPI tasks:',ntasks
end