File: process_server_delete_message.F

package info (click to toggle)
aces3 3.0.6-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 82,460 kB
  • sloc: fortran: 225,647; ansic: 20,413; cpp: 4,349; makefile: 953; sh: 137
file content (102 lines) | stat: -rw-r--r-- 3,955 bytes parent folder | download | duplicates (6)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
C  Copyright (c) 2003-2010 University of Florida
C
C  This program is free software; you can redistribute it and/or modify
C  it under the terms of the GNU General Public License as published by
C  the Free Software Foundation; either version 2 of the License, or
C  (at your option) any later version.

C  This program is distributed in the hope that it will be useful,
C  but WITHOUT ANY WARRANTY; without even the implied warranty of
C  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
C  GNU General Public License for more details.

C  The GNU General Public License is included in this distribution
C  in the file COPYRIGHT.
      subroutine process_server_delete_message(node, server_table,
     *                                   nserver_table)
c---------------------------------------------------------------------------
c   This subroutine handles the processing and manages state transitions
c   of a server_delete message.
c---------------------------------------------------------------------------
      implicit none
      include 'server.h'
      include 'mpif.h'
      include 'parallel_info.h'
      include 'dbugcom.h'
      include 'server_stat.h'

      integer nserver_table
      integer server_table(lserver_table_entry,nserver_table)
      integer i, j, k, n
      integer node
      integer state
      integer array, iblock, istart, nsearch

      state = server_msg(c_msg_state,node)
      if (state .eq. begin_state) then
         array = server_msg(c_msg_array, node) 

c---------------------------------------------------------------------------
c   Search the server_table for entries pertaining to this array.
c---------------------------------------------------------------------------

          do i = 1, nserved_arrays
            if (served_array_table(i) .eq. array) then
               istart = served_array_entry(i)
               nsearch = served_numblocks(i)
               go to 50
            endif
         enddo

c-----------------------------------------------------------------------------
c   There is no data for this array on the server.  Probably this is a tiny 
c   job run on more servers than necessary.  We have nothing to do.
c-----------------------------------------------------------------------------

         istart = 0
         nsearch = 0

c         print *,'Error: Cannot find array ',array,
c     *       ' in served array table'
c         call server_abort_job(server_table, nserver_table)
   50    continue

         do i = istart, istart + nsearch - 1
            if (server_table(c_server_diskloc,i) .gt. 0) then

c---------------------------------------------------------------------------
c   Negate the diskloc.  This indicates that the block is "up for grabs".
c---------------------------------------------------------------------------

               server_table(c_server_diskloc,i) = 
     *              -server_table(c_server_diskloc,i)
            endif

c---------------------------------------------------------------------------
c   Remove any references to the data in memory.
c---------------------------------------------------------------------------

            iblock = server_table(c_server_memloc,i)
            if (iblock .gt. 0) then
               if (and(server_table(c_server_flags,i),
     *                 server_dirty_flag) .ne. 0) then
                 call mark_block_clean(iblock, server_table,
     *                                  nserver_table)
               endif

               server_table(c_server_memloc,i) = 0
               server_table_ptr(iblock) = 0
            endif

c---------------------------------------------------------------------------
c   Clear the server flags for the block.
c---------------------------------------------------------------------------

            server_table(c_server_flags,i) = 0
         enddo

         server_msg(c_msg_state,node) = null_state
      endif

      return
      end