~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/global/examples/md_cluster/grp_sim.F

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if HAVE_CONFIG_H
2
 
#   include "config.fh"
3
 
#endif
4
 
c
5
 
c                                   NOTICE
6
 
c
7
 
c   This software is being made available for internal testing and
8
 
c   evaluation purposes only. This software is a pre-release test version
9
 
c   which has not yet been authenticated and cleared for publication. Adherence
10
 
c   to this notice may be necessary for the author, Battelle Memorial
11
 
c   Institute, to successfully assert copyright in and commercialize this
12
 
c   software. This software is not intended for duplication or distribution
13
 
c   to third parties without the permission of the Manager of Software
14
 
c   Products at Pacific Northwest Laboratory, Richland, Washington,  99352.
15
 
c
16
 
#define USE_SUBGROUPS 1
17
 
      program grp_sim
18
 
#include "common.fh"
19
 
c
20
 
      integer MAXTASKS
21
 
      parameter (MAXTASKS=2000)
22
 
      integer i,j,me,icnt,ndim,one
23
 
      integer heap, stack, group_size, nprocs, ngroups, my_grp
24
 
      integer max_task, itask, jtask, natom1, natom2
25
 
      integer group_list(2000), proc_list(2000)
26
 
      double precision tbeg, wraptime, elapsed
27
 
      double precision task_time(MAXTASKS),task_beg
28
 
      double precision proc_time(MD_MAXPROC), delta_t
29
 
      double precision maxtime, mintime,mingtime,maxgtime
30
 
      logical status
31
 
c
32
 
c   This is the main calling program for the Molecular Dynamics
33
 
c   calculation.
34
 
c
35
 
c
36
 
c   Initialize message passing
37
 
c
38
 
#ifdef MPI
39
 
      integer ierr
40
 
      call mpi_init(ierr)
41
 
#else
42
 
      call pbeginf
43
 
#endif
44
 
      tbeg = wraptime()
45
 
c
46
 
      call ga_initialize()
47
 
c
48
 
c   Initialize global arrays
49
 
c
50
 
      heap = 2000000
51
 
      stack = 2000000
52
 
c      heap = 2000
53
 
c      stack = 2000
54
 
      if (.not.ma_init(MT_DBL, stack, heap))
55
 
     +  call ga_error("ma_init failed",-1)
56
 
c
57
 
c   Create process groups
58
 
c
59
 
#if USE_SUBGROUPS
60
 
      group_size = 1
61
 
#else
62
 
      group_size = ga_nnodes()
63
 
#endif
64
 
      max_task = 8
65
 
      one = 1
66
 
      nprocs = ga_nnodes() 
67
 
      me = ga_nodeid()
68
 
      my_grp = (me-mod(me,group_size))/group_size
69
 
      do i = 1, min(max_task, MAXTASKS)
70
 
        task_time(i) = 0.0d00
71
 
      end do
72
 
 
73
 
#if USE_SUBGROUPS
74
 
c      write(6,101) my_grp,me
75
 
  101 format('My group is ',i2,' on proc ',i3)
76
 
      ngroups = nprocs/group_size
77
 
      do i = 1, min(nprocs, MD_MAXPROC)
78
 
        proc_time(i) = 0.0d00
79
 
      end do
80
 
c      write(6,102) ngroups,me
81
 
  102 format('Ngroups is  ',i2,' on proc ',i3)
82
 
      icnt = 0
83
 
      do i = 1, ngroups
84
 
        do j = 1, group_size
85
 
          proc_list(j) = icnt
86
 
          icnt = icnt + 1
87
 
        end do
88
 
        group_list(i) = ga_pgroup_create(proc_list,group_size)
89
 
      end do
90
 
#endif
91
 
c
92
 
c  Create global array to use for master-worker algorithm
93
 
c
94
 
      g_counter = ga_create_handle()
95
 
      ndim = 1
96
 
      call ga_set_data(g_counter,ndim,ndim,MT_INT)
97
 
      status = ga_allocate(g_counter)
98
 
      call ga_zero(g_counter)
99
 
c      write(6,103) me
100
 
  103 format('Created counter array on   ',i3)
101
 
#if USE_SUBGROUPS
102
 
c      write(6,104) me,group_list(my_grp+1)
103
 
  104 format('Default group on ',i3,' is ',i2)
104
 
      call ga_pgroup_set_default(group_list(my_grp+1))
105
 
c      write(6,105) me
106
 
  105 format('Set default group on   ',i3)
107
 
#endif
108
 
  100 if (ga_nodeid().eq.0) then
109
 
        itask = nga_read_inc(g_counter,one,one)
110
 
      else
111
 
        itask = 0
112
 
      endif
113
 
      call ga_igop(1,itask,1,'+')
114
 
      if (itask.lt.max_task) then
115
 
c        write(6,106) itask,me
116
 
  106   format('Executing task ',i3,' on proc ',i3)
117
 
        natom1 = 400
118
 
        natom1 = 0
119
 
        jtask = max_task - 1 - itask
120
 
        natom2 = jtask*5 + 25
121
 
        natom2 = jtask + 2
122
 
        task_beg = wraptime()
123
 
        call cl_sim(natom1,natom2,jtask)
124
 
        delta_t = wraptime() - task_beg
125
 
        if (itask.lt.MAXTASKS) task_time(itask+1) = delta_t
126
 
#if USE_SUBGROUPS
127
 
        i = ga_pgroup_nodeid(ga_pgroup_get_world())
128
 
        i = i/group_size+1
129
 
        if (i.le.MD_MAXPROC) proc_time(i) = delta_t
130
 
#endif
131
 
        go to 100
132
 
      endif
133
 
#if USE_SUBGROUPS
134
 
      call ga_pgroup_set_default(ga_pgroup_get_world())
135
 
#endif
136
 
      call ga_dgop(3,task_time,MAXTASKS,'+')
137
 
      task_time(1) = task_time(1)/dble(group_size)
138
 
      mintime = task_time(1)
139
 
      maxtime = task_time(1)
140
 
      do i = 2, min(max_task, MAXTASKS)
141
 
        task_time(i) = task_time(i)/dble(group_size)
142
 
        if (task_time(i).gt.maxtime) maxtime=task_time(i)
143
 
        if (task_time(i).lt.mintime) mintime=task_time(i)
144
 
      end do
145
 
      call ga_dgop(4,proc_time,MD_MAXPROC,'+')
146
 
      proc_time(1) = proc_time(1)/dble(group_size)
147
 
      mingtime = proc_time(1)
148
 
      maxgtime = proc_time(1)
149
 
      do i = 2, min(ngroups, MD_MAXPROC)
150
 
        proc_time(i) = proc_time(i)/dble(group_size)
151
 
        if (proc_time(i).gt.maxgtime) maxgtime=proc_time(i)
152
 
        if (proc_time(i).lt.mingtime) mingtime=proc_time(i)
153
 
      end do
154
 
      elapsed = wraptime()-tbeg
155
 
      call ga_dgop(2,elapsed,1,'+')
156
 
      elapsed = elapsed/dble(nprocs)
157
 
      if (me.eq.0) then
158
 
        do i = 1, min(max_task, MAXTASKS)
159
 
          write(6,300) i,task_time(i)
160
 
        end do
161
 
        do i = 1, min(ngroups, MD_MAXPROC)
162
 
          write(6,301) i,proc_time(i)
163
 
        end do
164
 
        write(6,201) max_task
165
 
        write(6,202) group_size
166
 
        write(6,203) mintime
167
 
        write(6,204) maxtime
168
 
        write(6,205) mingtime
169
 
        write(6,206) maxgtime
170
 
        write(6,200) elapsed
171
 
      endif
172
 
  200 format('Elapsed time for simulation  : ',f16.4)
173
 
  201 format('Number of tasks              : ',i12)
174
 
  202 format('Number of processors in group: ',i12)
175
 
  203 format('Minimum time for task        : ',f16.4)
176
 
  204 format('Maximum time for task        : ',f16.4)
177
 
  205 format('Minimum time for group       : ',f16.4)
178
 
  206 format('Maximum time for group       : ',f16.4)
179
 
  300 format('Time for task[',i3,']           : ',f16.4)
180
 
  301 format('Time for group[',i3,']          : ',f16.4)
181
 
      call ga_terminate()
182
 
#ifdef MPI
183
 
c      write(6,*) 'Calling mpi_finalize'
184
 
      call mpi_finalize()
185
 
#else
186
 
      call pend
187
 
#endif
188
 
c      write(6,*) 'Called mpi_finalize'
189
 
c
190
 
c      close(6)
191
 
      stop
192
 
      end