Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new tracing mask TRACE_VOLUME to trace the msg tasks communication size and group...
[simgrid.git] / examples / smpi / NAS / SP / define.f
1
2 c---------------------------------------------------------------------
3 c---------------------------------------------------------------------
4
5        subroutine compute_buffer_size(dim)
6
7 c---------------------------------------------------------------------
8 c---------------------------------------------------------------------
9
10        include 'header.h'
11
12        integer  c, dim, face_size
13
14        if (ncells .eq. 1) return
15
16 c---------------------------------------------------------------------
17 c      compute the actual sizes of the buffers; note that there is 
18 c      always one cell face that doesn't need buffer space, because it 
19 c      is at the boundary of the grid
20 c---------------------------------------------------------------------
21
22        west_size = 0
23        east_size = 0
24
25        do   c = 1, ncells
26           face_size = cell_size(2,c) * cell_size(3,c) * dim * 2
27           if (cell_coord(1,c).ne.1) west_size = west_size + face_size
28           if (cell_coord(1,c).ne.ncells) east_size = east_size + 
29      >                                                 face_size 
30        end do
31
32        north_size = 0
33        south_size = 0
34        do   c = 1, ncells
35           face_size = cell_size(1,c)*cell_size(3,c) * dim * 2
36           if (cell_coord(2,c).ne.1) south_size = south_size + face_size
37           if (cell_coord(2,c).ne.ncells) north_size = north_size + 
38      >                                                  face_size 
39        end do
40
41        top_size = 0
42        bottom_size = 0
43        do   c = 1, ncells
44           face_size = cell_size(1,c) * cell_size(2,c) * dim * 2
45           if (cell_coord(3,c).ne.1) bottom_size = bottom_size + 
46      >                                            face_size
47           if (cell_coord(3,c).ne.ncells) top_size = top_size +
48      >                                                face_size     
49        end do
50
51        start_send_west   = 1
52        start_send_east   = start_send_west   + west_size
53        start_send_south  = start_send_east   + east_size
54        start_send_north  = start_send_south  + south_size
55        start_send_bottom = start_send_north  + north_size
56        start_send_top    = start_send_bottom + bottom_size
57        start_recv_west   = 1
58        start_recv_east   = start_recv_west   + west_size
59        start_recv_south  = start_recv_east   + east_size
60        start_recv_north  = start_recv_south  + south_size
61        start_recv_bottom = start_recv_north  + north_size
62        start_recv_top    = start_recv_bottom + bottom_size
63
64        return
65        end
66