Merge lp:~albertog/siesta/gridxc-integration into lp:siesta/psml-support
- gridxc-integration
- Merge into trunk-psml
Status: | Merged |
---|---|
Merged at revision: | 533 |
Proposed branch: | lp:~albertog/siesta/gridxc-integration |
Merge into: | lp:siesta/psml-support |
Diff against target: |
3682 lines (+1534/-1037) (has conflicts) 48 files modified
Docs/gridxc-insert.CHANGES (+83/-0) Src/MPI/Makefile (+2/-6) Src/MPI/mpi__type_s.f90 (+0/-2) Src/MPI/mpi__type_sv.f90 (+0/-2) Src/MPI/mpi__type_v.f90 (+0/-2) Src/MPI/mpi__type_vs.f90 (+0/-2) Src/MPI/mpi_siesta.f90 (+0/-2) Src/MPI/timer_mpi.F90 (+0/-26) Src/Makefile (+58/-24) Src/SiestaXC/makefile (+3/-2) Src/SiestaXC/siestaxc.F90 (+5/-5) Src/Sys/GRIDXC.make (+55/-0) Src/alloc.F90 (+147/-567) Src/alloc_error_report.F (+55/-0) Src/alloc_memory_event.F (+30/-0) Src/atom.F (+2/-2) Src/broyden_optim.F (+1/-1) Src/cell_fire_optim.F (+1/-1) Src/cellxc_mod.F (+2/-2) Src/dhscf.F (+4/-4) Src/diagmemory.F (+0/-45) Src/diagon.F (+1/-1) Src/fft.F (+2/-2) Src/forhar.F (+3/-3) Src/ldau_specs.f (+2/-2) Src/m_memory.F (+0/-134) Src/m_timer.F90 (+47/-21) Src/memory.F (+6/-143) Src/memory_log.F90 (+587/-0) Src/meshsubs.F (+2/-2) Src/moreParallelSubs.F90 (+2/-2) Src/obj_setup.sh (+9/-0) Src/read_xc_info.F (+1/-1) Src/siesta_end.F (+2/-2) Src/siesta_init.F (+20/-10) Src/siesta_options.F90 (+0/-2) Src/state_init.F (+1/-1) Src/timer.F90 (+32/-1) Src/timer_tree.f90 (+13/-1) Util/Denchar/Src/Makefile (+8/-5) Util/Denchar/Src/alloc_handlers.f90 (+14/-0) Util/Gen-basis/Makefile (+57/-6) Util/Gen-basis/handlers.f (+114/-0) Util/SiestaSubroutine/ProtoNEB/Src/Makefile (+5/-0) Util/SiestaSubroutine/SimpleTest/Src/Makefile (+5/-0) Util/VCA/Makefile (+33/-3) Util/VCA/handlers.f (+114/-0) version.info (+6/-0) Text conflict in Src/Makefile Text conflict in Util/Denchar/Src/Makefile Text conflict in Util/Gen-basis/Makefile Contents conflict in Util/Gen-basis/local_die.F Text conflict in Util/SiestaSubroutine/ProtoNEB/Src/Makefile Text conflict in Util/SiestaSubroutine/SimpleTest/Src/Makefile Text conflict in Util/VCA/Makefile Text conflict in version.info |
To merge this branch: | bzr merge lp:~albertog/siesta/gridxc-integration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nick Papior | Approve | ||
Alberto Garcia | Approve | ||
Review via email: mp+300428@code.launchpad.net |
Commit message
Description of the change
Basic changes to interface to libGridXC:
- Abstraction of alloc interface, with callbacks for logging.
- Similar abstraction of timer interface
- Hooks for libGridXC, including libxc interface.
Alberto Garcia (albertog) wrote : | # |
Nick Papior (nickpapior) wrote : | # |
Yes, good idea.
I will take a look at it :)
2016-07-19 10:22 GMT+02:00 Alberto Garcia <email address hidden>:
> Nick:
>
> I think that this should be merged into the psml work to take advantage of
> the infrastructure for small libs there. Also, it would streamline the
> compilation of ATOM, which also uses libGridXC.
>
>
> --
>
> https:/
> You are requested to review the proposed merge of
> lp:~albertog/siesta/gridxc-integration into
> lp:~siesta-pseudos-bases/siesta/trunk-psml.
>
--
Kind regards Nick
Alberto Garcia (albertog) wrote : | # |
I am now ready to merge this branch into trunk-psml, which has been brought in sync to the tip of the trunk. Actually, the PSML work does need libgridxc for its support of libxc (still to be strengthened).
Alberto Garcia (albertog) wrote : | # |
I will merge it. The first commit (533) is the bulk of the merge. Later commits will fine-tune
missing bits and defaults.
Nick Papior (nickpapior) wrote : | # |
I think it looks good.
However, it seems that there is going to be needed "tons" of handlers.f in all utilities.
Wouldn't it be cleaner to add the handlers.f in the Src directory to not have the code dublicated.
We may then call it handlers_utils.f (or just handlers) to make it accessible for all the utilities?
Alberto Garcia (albertog) wrote : | # |
Hi Nick,
Indeed, this is a non-pretty side-effect of my scheme for back-communication from the small libraries.
Regarding your proposal: It is good, but note that there should be a few distintct "handlers" files for different uses. Some utilities (such as some in TS) work in parallel, so, say, "die" has to be the parallel version. Then, in some cases you might be interested in enabling detailed memory reports or error messages, so the simple stubs will not do.
I still need to carry out a second iteration of the Makefiles to rationalize the use of the handler idea (currently there are different mixes of "psml_die, die", etc, files, and "handlers"), so it would be a good opportunity to prepare a few common ones.
Note that I will not be merging trunk-psml for a while. I need to implement a few more things in gridxc and atom.F.
Thank you for the review!
Alberto
On 28 Oct 2016, at 20:39, Nick Papior <email address hidden> wrote:
> I think it looks good.
>
> However, it seems that there is going to be needed "tons" of handlers.f in all utilities.
> Wouldn't it be cleaner to add the handlers.f in the Src directory to not have the code dublicated.
> We may then call it handlers_utils.f (or just handlers) to make it accessible for all the utilities?
> --
> https:/
> You are the owner of lp:~albertog/siesta/gridxc-integration.
Preview Diff
1 | === added file 'Docs/gridxc-insert.CHANGES' | |||
2 | --- Docs/gridxc-insert.CHANGES 1970-01-01 00:00:00 +0000 | |||
3 | +++ Docs/gridxc-insert.CHANGES 2016-07-19 08:21:24 +0000 | |||
4 | @@ -0,0 +1,83 @@ | |||
5 | 1 | ----------------------------------------------------------------------- | ||
6 | 2 | 2016-07-07 Alberto Garcia siesta-trunk-503--gridxc-12 | ||
7 | 3 | Use external gridxc library | ||
8 | 4 | |||
9 | 5 | The arch.make must now define the GRIDXC_ROOT variable | ||
10 | 6 | (See Src/Sys/GRIDXC.make for the whole story, including | ||
11 | 7 | parallel makes for Siesta and serial for Utils). | ||
12 | 8 | |||
13 | 9 | See Src/Makefile and Util/Gen-basis/Makefile for new idioms. | ||
14 | 10 | |||
15 | 11 | Src/SiestaXC is kept to facilitate updates. | ||
16 | 12 | |||
17 | 13 | ----------------------------------------------------------------------- | ||
18 | 14 | 2016-05-29 Alberto Garcia siesta-trunk-503--gridxc-11 | ||
19 | 15 | Sync with trunk-503 | ||
20 | 16 | |||
21 | 17 | Note that the libGridXC code is kept in the Siesta tree for now. | ||
22 | 18 | Also, Src/SiestaXC is kept to facilitate updates. | ||
23 | 19 | |||
24 | 20 | ----------------------------------------------------------------------- | ||
25 | 21 | 2015-06-12 Alberto Garcia siesta-trunk-470--memory-accounting-10 | ||
26 | 22 | Revamped timer interface in gridxc. Build fixes | ||
27 | 23 | |||
28 | 24 | * Revamped the timer interface in gridxc | ||
29 | 25 | |||
30 | 26 | Removed the internal timer framework, as it was not really needed | ||
31 | 27 | in its full glory. If cellxc timing information is needed in the | ||
32 | 28 | future to fine-tune the load-balancing mechanism, it should be | ||
33 | 29 | handled in a more light-weight manner. | ||
34 | 30 | |||
35 | 31 | Internal timings are passed over to the calling program through | ||
36 | 32 | the 'gridxc_timer_*' calls. | ||
37 | 33 | |||
38 | 34 | The MPI subsystem is instrumented for timing also. It calls | ||
39 | 35 | also the gridxc_timer_* routines if 'time_mpi_calls' is set | ||
40 | 36 | in 'gridxc_init'. | ||
41 | 37 | |||
42 | 38 | * Use package-specific module names in MPI_instr | ||
43 | 39 | |||
44 | 40 | If a program uses several versions of the MPI interfaces, | ||
45 | 41 | the first appearing in the linking list will be used for | ||
46 | 42 | everything. This causes problems for package-specific | ||
47 | 43 | functionality. | ||
48 | 44 | |||
49 | 45 | The modules in MPI_instr are now renamed at the time | ||
50 | 46 | the 'generate.sh' script is run. | ||
51 | 47 | |||
52 | 48 | * Bring in needed fixes in Util and elsewhere | ||
53 | 49 | |||
54 | 50 | removed: | ||
55 | 51 | Src/gridxc/m_timer.F90 | ||
56 | 52 | Util/Gen-basis/local_die.F | ||
57 | 53 | added: | ||
58 | 54 | Util/Gen-basis/handlers.f | ||
59 | 55 | Util/VCA/handlers.f | ||
60 | 56 | modified: | ||
61 | 57 | Src/gridxc/MPI_instr/Makefile | ||
62 | 58 | Src/gridxc/MPI_instr/generate.sh | ||
63 | 59 | Src/gridxc/MPI_instr/mpi__type_s.f90 | ||
64 | 60 | Src/gridxc/MPI_instr/mpi__type_sv.f90 | ||
65 | 61 | Src/gridxc/MPI_instr/mpi__type_v.f90 | ||
66 | 62 | Src/gridxc/MPI_instr/mpi__type_vs.f90 | ||
67 | 63 | Src/gridxc/MPI_instr/mpi_instr.f90 | ||
68 | 64 | Src/gridxc/MPI_instr/mpi_interfaces.F | ||
69 | 65 | Src/gridxc/Testers/handlers.f90 | ||
70 | 66 | Src/gridxc/Testers/test3.F90 | ||
71 | 67 | Src/gridxc/atomxc.F90 | ||
72 | 68 | Src/gridxc/cellxc.F90 | ||
73 | 69 | Src/gridxc/fft3d.F90 | ||
74 | 70 | Src/gridxc/gridxc.F90 | ||
75 | 71 | Src/gridxc/gridxc_config.F90 | ||
76 | 72 | Src/gridxc/makefile | ||
77 | 73 | Src/gridxc/radfft.f | ||
78 | 74 | Src/obj_setup.sh | ||
79 | 75 | Src/siesta_init.F | ||
80 | 76 | Util/Gen-basis/Makefile | ||
81 | 77 | Util/VCA/Makefile | ||
82 | 78 | |||
83 | 79 | |||
84 | 80 | |||
85 | 81 | |||
86 | 82 | |||
87 | 83 | |||
88 | 0 | 84 | ||
89 | === modified file 'Src/MPI/Makefile' | |||
90 | --- Src/MPI/Makefile 2016-06-29 04:07:55 +0000 | |||
91 | +++ Src/MPI/Makefile 2016-07-19 08:21:24 +0000 | |||
92 | @@ -38,8 +38,8 @@ | |||
93 | 38 | @cp *.mod .. | 38 | @cp *.mod .. |
94 | 39 | @touch module_built | 39 | @touch module_built |
95 | 40 | # | 40 | # |
98 | 41 | libmpi_f90.a: mpi.o mpi__include.o Interfaces.o mpi_siesta.o timer_mpi.o | 41 | libmpi_f90.a: mpi.o mpi__include.o Interfaces.o mpi_siesta.o |
99 | 42 | @$(AR) $(ARFLAGS_EXTRA) cru libmpi_f90.a mpi.o mpi_siesta.o mpi__include.o Interfaces.o timer_mpi.o | 42 | @$(AR) $(ARFLAGS_EXTRA) cru libmpi_f90.a mpi.o mpi_siesta.o mpi__include.o Interfaces.o |
100 | 43 | -$(RANLIB) libmpi_f90.a | 43 | -$(RANLIB) libmpi_f90.a |
101 | 44 | # | 44 | # |
102 | 45 | clean: | 45 | clean: |
103 | @@ -47,7 +47,3 @@ | |||
104 | 47 | @rm -f module_built *.uses kind_explorer | 47 | @rm -f module_built *.uses kind_explorer |
105 | 48 | @rm -f libmpi_f90.a | 48 | @rm -f libmpi_f90.a |
106 | 49 | 49 | ||
107 | 50 | mpi_siesta.o: timer_mpi.o | ||
108 | 51 | Interfaces.o: timer_mpi.o | ||
109 | 52 | |||
110 | 53 | |||
111 | 54 | 50 | ||
112 | === modified file 'Src/MPI/mpi__type_s.f90' | |||
113 | --- Src/MPI/mpi__type_s.f90 2009-07-09 15:35:11 +0000 | |||
114 | +++ Src/MPI/mpi__type_s.f90 2016-07-19 08:21:24 +0000 | |||
115 | @@ -17,8 +17,6 @@ | |||
116 | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe |
117 | 18 | ! | 18 | ! |
118 | 19 | ! | 19 | ! |
119 | 20 | USE TIMER_MPI_M, only: timer_mpi | ||
120 | 21 | |||
121 | 22 | IMPLICIT NONE | 20 | IMPLICIT NONE |
122 | 23 | PRIVATE | 21 | PRIVATE |
123 | 24 | 22 | ||
124 | 25 | 23 | ||
125 | === modified file 'Src/MPI/mpi__type_sv.f90' | |||
126 | --- Src/MPI/mpi__type_sv.f90 2009-07-09 15:35:11 +0000 | |||
127 | +++ Src/MPI/mpi__type_sv.f90 2016-07-19 08:21:24 +0000 | |||
128 | @@ -17,8 +17,6 @@ | |||
129 | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe |
130 | 18 | ! | 18 | ! |
131 | 19 | ! | 19 | ! |
132 | 20 | USE TIMER_MPI_M, only: timer_mpi | ||
133 | 21 | |||
134 | 22 | IMPLICIT NONE | 20 | IMPLICIT NONE |
135 | 23 | PRIVATE | 21 | PRIVATE |
136 | 24 | 22 | ||
137 | 25 | 23 | ||
138 | === modified file 'Src/MPI/mpi__type_v.f90' | |||
139 | --- Src/MPI/mpi__type_v.f90 2009-07-09 15:35:11 +0000 | |||
140 | +++ Src/MPI/mpi__type_v.f90 2016-07-19 08:21:24 +0000 | |||
141 | @@ -17,8 +17,6 @@ | |||
142 | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe |
143 | 18 | ! | 18 | ! |
144 | 19 | ! | 19 | ! |
145 | 20 | USE TIMER_MPI_M, only: timer_mpi | ||
146 | 21 | |||
147 | 22 | IMPLICIT NONE | 20 | IMPLICIT NONE |
148 | 23 | PRIVATE | 21 | PRIVATE |
149 | 24 | 22 | ||
150 | 25 | 23 | ||
151 | === modified file 'Src/MPI/mpi__type_vs.f90' | |||
152 | --- Src/MPI/mpi__type_vs.f90 2009-07-09 15:35:11 +0000 | |||
153 | +++ Src/MPI/mpi__type_vs.f90 2016-07-19 08:21:24 +0000 | |||
154 | @@ -17,8 +17,6 @@ | |||
155 | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe | 17 | ! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe |
156 | 18 | ! | 18 | ! |
157 | 19 | ! | 19 | ! |
158 | 20 | USE TIMER_MPI_M, only: timer_mpi | ||
159 | 21 | |||
160 | 22 | IMPLICIT NONE | 20 | IMPLICIT NONE |
161 | 23 | PRIVATE | 21 | PRIVATE |
162 | 24 | 22 | ||
163 | 25 | 23 | ||
164 | === modified file 'Src/MPI/mpi_siesta.f90' | |||
165 | --- Src/MPI/mpi_siesta.f90 2016-01-25 16:00:16 +0000 | |||
166 | +++ Src/MPI/mpi_siesta.f90 2016-07-19 08:21:24 +0000 | |||
167 | @@ -20,8 +20,6 @@ | |||
168 | 20 | trueMPI_WAIT => MPI_WAIT, & | 20 | trueMPI_WAIT => MPI_WAIT, & |
169 | 21 | trueMPI_WAITALL => MPI_WAITALL | 21 | trueMPI_WAITALL => MPI_WAITALL |
170 | 22 | 22 | ||
171 | 23 | USE TIMER_MPI_M, only: timer_mpi | ||
172 | 24 | |||
173 | 25 | ! The following construction allows to supplant MPI_Comm_World within SIESTA, | 23 | ! The following construction allows to supplant MPI_Comm_World within SIESTA, |
174 | 26 | ! and to use it as a subroutine with its own internal MPI communicator. | 24 | ! and to use it as a subroutine with its own internal MPI communicator. |
175 | 27 | ! JMS. Oct.2010 | 25 | ! JMS. Oct.2010 |
176 | 28 | 26 | ||
177 | === removed file 'Src/MPI/timer_mpi.F90' | |||
178 | --- Src/MPI/timer_mpi.F90 2016-01-25 16:00:16 +0000 | |||
179 | +++ Src/MPI/timer_mpi.F90 1970-01-01 00:00:00 +0000 | |||
180 | @@ -1,26 +0,0 @@ | |||
181 | 1 | ! --- | ||
182 | 2 | ! Copyright (C) 1996-2016 The SIESTA group | ||
183 | 3 | ! This file is distributed under the terms of the | ||
184 | 4 | ! GNU General Public License: see COPYING in the top directory | ||
185 | 5 | ! or http://www.gnu.org/copyleft/gpl.txt . | ||
186 | 6 | ! See Docs/Contributors.txt for a list of contributors. | ||
187 | 7 | ! --- | ||
188 | 8 | MODULE timer_mpi_m | ||
189 | 9 | |||
190 | 10 | ! Disconnectable interface to siesta's timer routine. | ||
191 | 11 | ! J.M.Soler. May.2009 | ||
192 | 12 | |||
193 | 13 | CONTAINS | ||
194 | 14 | |||
195 | 15 | SUBROUTINE timer_mpi( name, opt ) | ||
196 | 16 | character(len=*), intent(in):: name | ||
197 | 17 | integer, intent(in):: opt | ||
198 | 18 | |||
199 | 19 | #ifdef MPI_TIMING | ||
200 | 20 | external timer | ||
201 | 21 | call timer( name, opt ) | ||
202 | 22 | #endif | ||
203 | 23 | |||
204 | 24 | END SUBROUTINE timer_mpi | ||
205 | 25 | |||
206 | 26 | END MODULE timer_mpi_m | ||
207 | 27 | 0 | ||
208 | === modified file 'Src/Makefile' | |||
209 | --- Src/Makefile 2016-07-08 00:16:48 +0000 | |||
210 | +++ Src/Makefile 2016-07-19 08:21:24 +0000 | |||
211 | @@ -44,6 +44,7 @@ | |||
212 | 44 | /^m_ts_io.o:/s/m_tbt_kpoints.o//" Makefile > tmp.Makefile | 44 | /^m_ts_io.o:/s/m_tbt_kpoints.o//" Makefile > tmp.Makefile |
213 | 45 | @mv tmp.Makefile Makefile | 45 | @mv tmp.Makefile Makefile |
214 | 46 | # | 46 | # |
215 | 47 | <<<<<<< TREE | ||
216 | 47 | ARCH_MAKE?=$(MAIN_OBJDIR)/arch.make | 48 | ARCH_MAKE?=$(MAIN_OBJDIR)/arch.make |
217 | 48 | include $(ARCH_MAKE) | 49 | include $(ARCH_MAKE) |
218 | 49 | # | 50 | # |
219 | @@ -57,6 +58,10 @@ | |||
220 | 57 | INCFLAGS:= $(NETCDF_INCFLAGS) $(PSML_INCFLAGS) $(NCPS_INCFLAGS) \ | 58 | INCFLAGS:= $(NETCDF_INCFLAGS) $(PSML_INCFLAGS) $(NCPS_INCFLAGS) \ |
221 | 58 | $(PSOP_INCFLAGS) $(XMLF90_INCFLAGS) $(INCFLAGS) | 59 | $(PSOP_INCFLAGS) $(XMLF90_INCFLAGS) $(INCFLAGS) |
222 | 59 | # | 60 | # |
223 | 61 | ======= | ||
224 | 62 | include arch.make | ||
225 | 63 | INCFLAGS:= -I. $(NETCDF_INCFLAGS) $(INCFLAGS) | ||
226 | 64 | >>>>>>> MERGE-SOURCE | ||
227 | 60 | # For removing any -ipo compilation in sub directories... | 65 | # For removing any -ipo compilation in sub directories... |
228 | 61 | # Later compilers are also having this enabled, and it lets you | 66 | # Later compilers are also having this enabled, and it lets you |
229 | 62 | # specify what to not be used in libraries. | 67 | # specify what to not be used in libraries. |
230 | @@ -96,7 +101,7 @@ | |||
231 | 96 | chempot.o coceri.o coxmol.o cross.o compute_norm.o\ | 101 | chempot.o coceri.o coxmol.o cross.o compute_norm.o\ |
232 | 97 | denmat.o denmatlomem.o detover.o dfscf.o m_diagon.o diagon.o digcel.o \ | 102 | denmat.o denmatlomem.o detover.o dfscf.o m_diagon.o diagon.o digcel.o \ |
233 | 98 | fft.o dhscf.o constr.o diagk_file.o \ | 103 | fft.o dhscf.o constr.o diagk_file.o \ |
235 | 99 | diagg.o diagk.o diagkp.o diag2g.o diag2k.o diagpol.o \ | 104 | diagg.o diagk.o diagkp.o diag2g.o diag2k.o diagmemory.o diagpol.o \ |
236 | 100 | diagsprl.o dipole.o dismin.o dnaefs.o doping_uniform.o dot.o \ | 105 | diagsprl.o dipole.o dismin.o dnaefs.o doping_uniform.o dot.o \ |
237 | 101 | m_efield.o egandd.o ener3.o ener3lomem.o errorf.o extrapolon.o \ | 106 | m_efield.o egandd.o ener3.o ener3lomem.o errorf.o extrapolon.o \ |
238 | 102 | fixed.o interpolation.o gradient.o gradientlomem.o grdsam.o \ | 107 | fixed.o interpolation.o gradient.o gradientlomem.o grdsam.o \ |
239 | @@ -130,7 +135,7 @@ | |||
240 | 130 | precision.o sys.o m_cell.o files.o \ | 135 | precision.o sys.o m_cell.o files.o \ |
241 | 131 | spatial.o parallel.o parallelsubs.o parsing.o chemical.o atom.o atmparams.o \ | 136 | spatial.o parallel.o parallelsubs.o parsing.o chemical.o atom.o atmparams.o \ |
242 | 132 | m_mpi_utils.o m_fdf_global.o m_history.o m_iorho.o \ | 137 | m_mpi_utils.o m_fdf_global.o m_history.o m_iorho.o \ |
244 | 133 | atmfuncs.o listsc.o memoryinfo.o m_memory.o sorting.o \ | 138 | atmfuncs.o listsc.o memory_log.o sorting.o \ |
245 | 134 | atomlist.o atm_types.o old_atmfuncs.o radial.o \ | 139 | atomlist.o atm_types.o old_atmfuncs.o radial.o \ |
246 | 135 | alloc.o spher_harm.o periodic_table.o version.o timestamp.o \ | 140 | alloc.o spher_harm.o periodic_table.o version.o timestamp.o \ |
247 | 136 | basis_types.o xml.o basis_specs.o basis_io.o\ | 141 | basis_types.o xml.o basis_specs.o basis_io.o\ |
248 | @@ -164,7 +169,8 @@ | |||
249 | 164 | write_orb_indx.o \ | 169 | write_orb_indx.o \ |
250 | 165 | m_hs_matrix.o kpoint_convert.o m_glob_sparse.o\ | 170 | m_hs_matrix.o kpoint_convert.o m_glob_sparse.o\ |
251 | 166 | die.o m_dminim.o m_zminim.o m_svd.o compute_max_diff.o \ | 171 | die.o m_dminim.o m_zminim.o m_svd.o compute_max_diff.o \ |
253 | 167 | save_density_matrix.o \ | 172 | save_density_matrix.o alloc_error_report.o\ |
254 | 173 | alloc_memory_event.o\ | ||
255 | 168 | m_rhog.o rhofft.o m_diis.o compute_energies.o \ | 174 | m_rhog.o rhofft.o m_diis.o compute_energies.o \ |
256 | 169 | class_Vector.o class_Pair_Vectors.o class_Fstack_Pair_Vectors.o\ | 175 | class_Vector.o class_Pair_Vectors.o class_Fstack_Pair_Vectors.o\ |
257 | 170 | m_target_stress.o\ | 176 | m_target_stress.o\ |
258 | @@ -179,8 +185,26 @@ | |||
259 | 179 | OBJS += m_cite.o | 185 | OBJS += m_cite.o |
260 | 180 | 186 | ||
261 | 181 | #-------------------------------------------------------------- | 187 | #-------------------------------------------------------------- |
262 | 188 | <<<<<<< TREE | ||
263 | 182 | 189 | ||
264 | 183 | INCFLAGS:=$(INCFLAGS) $(NETCDF_INCFLAGS) | 190 | INCFLAGS:=$(INCFLAGS) $(NETCDF_INCFLAGS) |
265 | 191 | ======= | ||
266 | 192 | # FoX whatnot | ||
267 | 193 | # | ||
268 | 194 | # FoX build targets: | ||
269 | 195 | FoX_configured=FoX/.config | ||
270 | 196 | FoX_built=FoX/.FoX | ||
271 | 197 | # | ||
272 | 198 | # This is how we pick up modules and libraries for FoX: | ||
273 | 199 | FoX_FCFLAGS=`FoX/FoX-config --fcflags` | ||
274 | 200 | FoX_LIBS=`FoX/FoX-config --libs --wcml` | ||
275 | 201 | # | ||
276 | 202 | # And add them to global compiler flags: | ||
277 | 203 | INCFLAGS:=$(INCFLAGS) $(FoX_FCFLAGS) | ||
278 | 204 | # | ||
279 | 205 | # First, it needs to be configured. This may have been done | ||
280 | 206 | # by the main SIESTA configure, but in case not: | ||
281 | 207 | >>>>>>> MERGE-SOURCE | ||
282 | 184 | # | 208 | # |
283 | 185 | FC_DEFAULT:=$(FC) | 209 | FC_DEFAULT:=$(FC) |
284 | 186 | FC_SERIAL?=$(FC_DEFAULT) | 210 | FC_SERIAL?=$(FC_DEFAULT) |
285 | @@ -200,6 +224,7 @@ | |||
286 | 200 | FFFLAGS="$(FFLAGS:$(IPO_FLAG)=)" module) | 224 | FFFLAGS="$(FFLAGS:$(IPO_FLAG)=)" module) |
287 | 201 | # | 225 | # |
288 | 202 | #-------------------------------------------------------------- | 226 | #-------------------------------------------------------------- |
289 | 227 | <<<<<<< TREE | ||
290 | 203 | XC=libSiestaXC.a | 228 | XC=libSiestaXC.a |
291 | 204 | $(XC): | 229 | $(XC): |
292 | 205 | (cd SiestaXC ; $(MAKE) \ | 230 | (cd SiestaXC ; $(MAKE) \ |
293 | @@ -207,6 +232,11 @@ | |||
294 | 207 | "VPATH_ROOT=$(VPATH)" \ | 232 | "VPATH_ROOT=$(VPATH)" \ |
295 | 208 | "INCFLAGS=-I../MPI" \ | 233 | "INCFLAGS=-I../MPI" \ |
296 | 209 | "FFLAGS=$(FFLAGS:$(IPO_FLAG)=)" module ) | 234 | "FFLAGS=$(FFLAGS:$(IPO_FLAG)=)" module ) |
297 | 235 | ======= | ||
298 | 236 | include $(GRIDXC_ROOT)/gridxc.mk | ||
299 | 237 | XC=$(GRIDXC_LIBS) | ||
300 | 238 | INCFLAGS:= $(INCFLAGS) $(GRIDXC_INCFLAGS) | ||
301 | 239 | >>>>>>> MERGE-SOURCE | ||
302 | 210 | #-------------------------------------------------------------- | 240 | #-------------------------------------------------------------- |
303 | 211 | FDF=libfdf.a | 241 | FDF=libfdf.a |
304 | 212 | $(FDF): | 242 | $(FDF): |
305 | @@ -355,10 +385,10 @@ | |||
306 | 355 | (cd psoplib/src ; $(MAKE) ARCH_MAKE=$(ARCH_MAKE) clean) | 385 | (cd psoplib/src ; $(MAKE) ARCH_MAKE=$(ARCH_MAKE) clean) |
307 | 356 | @if [ -d MPI ] ; then (cd MPI && $(MAKE) clean ) ; fi | 386 | @if [ -d MPI ] ; then (cd MPI && $(MAKE) clean ) ; fi |
308 | 357 | (cd Libs ; $(MAKE) clean ) | 387 | (cd Libs ; $(MAKE) clean ) |
309 | 358 | (cd SiestaXC ; $(MAKE) clean ) | ||
310 | 359 | 388 | ||
311 | 360 | # DO NOT DELETE THIS LINE - used by make depend | 389 | # DO NOT DELETE THIS LINE - used by make depend |
313 | 361 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | 390 | alloc_error_report.o: parallel.o |
314 | 391 | alloc_memory_event.o: memory_log.o | ||
315 | 362 | amn.o: alloc.o atmfuncs.o atomlist.o m_orderbands.o m_trialorbitalclass.o | 392 | amn.o: alloc.o atmfuncs.o atomlist.o m_orderbands.o m_trialorbitalclass.o |
316 | 363 | amn.o: matel_registry.o mneighb.o new_matel.o parallel.o parallelsubs.o | 393 | amn.o: matel_registry.o mneighb.o new_matel.o parallel.o parallelsubs.o |
317 | 364 | amn.o: precision.o siesta2wannier90.o siesta_geom.o sys.o | 394 | amn.o: precision.o siesta2wannier90.o siesta_geom.o sys.o |
318 | @@ -389,16 +419,16 @@ | |||
319 | 389 | born_charge.o: siesta_geom.o siesta_options.o sparse_matrices.o | 419 | born_charge.o: siesta_geom.o siesta_options.o sparse_matrices.o |
320 | 390 | broadcast_basis.o: atm_types.o ldau_specs.o m_mpi_utils.o parallel.o radial.o | 420 | broadcast_basis.o: atm_types.o ldau_specs.o m_mpi_utils.o parallel.o radial.o |
321 | 391 | broadcast_projections.o: m_trialorbitalclass.o parallel.o siesta2wannier90.o | 421 | broadcast_projections.o: m_trialorbitalclass.o parallel.o siesta2wannier90.o |
323 | 392 | broyden_optim.o: m_broyddj_nocomm.o m_memory.o parallel.o precision.o | 422 | broyden_optim.o: m_broyddj_nocomm.o memory_log.o parallel.o precision.o |
324 | 393 | broyden_optim.o: siesta_options.o sys.o units.o | 423 | broyden_optim.o: siesta_options.o sys.o units.o |
325 | 394 | bsc_cellxc.o: alloc.o bsc_xcmod.o cellxc_mod.o mesh.o moremeshsubs.o parallel.o | 424 | bsc_cellxc.o: alloc.o bsc_xcmod.o cellxc_mod.o mesh.o moremeshsubs.o parallel.o |
326 | 395 | bsc_cellxc.o: parallelsubs.o precision.o sys.o | 425 | bsc_cellxc.o: parallelsubs.o precision.o sys.o |
327 | 396 | bsc_xcmod.o: parallel.o precision.o sys.o | 426 | bsc_xcmod.o: parallel.o precision.o sys.o |
328 | 397 | cart2frac.o: sys.o | 427 | cart2frac.o: sys.o |
330 | 398 | cdiag.o: alloc.o m_spin.o memoryinfo.o parallel.o precision.o sys.o | 428 | cdiag.o: alloc.o diagmemory.o m_spin.o parallel.o precision.o sys.o |
331 | 399 | cell_broyden_optim.o: m_broyddj_nocomm.o parallel.o precision.o sys.o units.o | 429 | cell_broyden_optim.o: m_broyddj_nocomm.o parallel.o precision.o sys.o units.o |
332 | 400 | cell_broyden_optim.o: zmatrix.o | 430 | cell_broyden_optim.o: zmatrix.o |
334 | 401 | cell_fire_optim.o: alloc.o m_fdf_global.o m_fire.o m_memory.o parallel.o | 431 | cell_fire_optim.o: alloc.o m_fdf_global.o m_fire.o memory_log.o parallel.o |
335 | 402 | cell_fire_optim.o: precision.o siesta_options.o sys.o zmatrix.o | 432 | cell_fire_optim.o: precision.o siesta_options.o sys.o zmatrix.o |
336 | 403 | cellsubs.o: precision.o | 433 | cellsubs.o: precision.o |
337 | 404 | cellxc_mod.o: bsc_xcmod.o sys.o | 434 | cellxc_mod.o: bsc_xcmod.o sys.o |
338 | @@ -463,8 +493,9 @@ | |||
339 | 463 | diagk_file.o: fermid.o iowfs_netcdf.o parallel.o parallelsubs.o precision.o | 493 | diagk_file.o: fermid.o iowfs_netcdf.o parallel.o parallelsubs.o precision.o |
340 | 464 | diagk_file.o: sys.o writewave.o | 494 | diagk_file.o: sys.o writewave.o |
341 | 465 | diagkp.o: alloc.o fermid.o parallel.o parallelsubs.o precision.o sys.o | 495 | diagkp.o: alloc.o fermid.o parallel.o parallelsubs.o precision.o sys.o |
344 | 466 | diagon.o: alloc.o densematrix.o m_diagon.o m_memory.o parallel.o parallelsubs.o | 496 | diagmemory.o: precision.o |
345 | 467 | diagon.o: precision.o siesta_options.o sys.o | 497 | diagon.o: alloc.o densematrix.o m_diagon.o memory_log.o parallel.o |
346 | 498 | diagon.o: parallelsubs.o precision.o siesta_options.o sys.o | ||
347 | 468 | diagonalizeHk.o: alloc.o atomlist.o densematrix.o m_orderbands.o m_spin.o | 499 | diagonalizeHk.o: alloc.o atomlist.o densematrix.o m_orderbands.o m_spin.o |
348 | 469 | diagonalizeHk.o: parallel.o parallelsubs.o precision.o siesta2wannier90.o | 500 | diagonalizeHk.o: parallel.o parallelsubs.o precision.o siesta2wannier90.o |
349 | 470 | diagonalizeHk.o: sparse_matrices.o units.o | 501 | diagonalizeHk.o: sparse_matrices.o units.o |
350 | @@ -488,8 +519,8 @@ | |||
351 | 488 | ener3lomem.o: alloc.o globalise.o m_mpi_utils.o onmod.o precision.o | 519 | ener3lomem.o: alloc.o globalise.o m_mpi_utils.o onmod.o precision.o |
352 | 489 | extrapolon.o: parallel.o precision.o sys.o | 520 | extrapolon.o: parallel.o precision.o sys.o |
353 | 490 | fermid.o: errorf.o parallel.o precision.o sys.o | 521 | fermid.o: errorf.o parallel.o precision.o sys.o |
356 | 491 | fft.o: alloc.o fft1d.o m_timer.o mesh.o parallel.o parallelsubs.o precision.o | 522 | fft.o: alloc.o m_fft_gpfa.o m_timer.o mesh.o parallel.o parallelsubs.o |
357 | 492 | fft.o: sys.o | 523 | fft.o: precision.o sys.o |
358 | 493 | fft1d.o: parallel.o precision.o sys.o | 524 | fft1d.o: parallel.o precision.o sys.o |
359 | 494 | final_H_f_stress.o: alloc.o atomlist.o dnaefs.o files.o grdsam.o kinefsm.o | 525 | final_H_f_stress.o: alloc.o atomlist.o dnaefs.o files.o grdsam.o kinefsm.o |
360 | 495 | final_H_f_stress.o: ldau.o ldau_specs.o m_dipol.o m_energies.o m_forces.o | 526 | final_H_f_stress.o: ldau.o ldau_specs.o m_dipol.o m_energies.o m_forces.o |
361 | @@ -600,7 +631,6 @@ | |||
362 | 600 | m_iostruct.o: alloc.o files.o m_mpi_utils.o parallel.o precision.o | 631 | m_iostruct.o: alloc.o files.o m_mpi_utils.o parallel.o precision.o |
363 | 601 | m_iostruct.o: siesta_geom.o sys.o units.o | 632 | m_iostruct.o: siesta_geom.o sys.o units.o |
364 | 602 | m_kinetic.o: precision.o | 633 | m_kinetic.o: precision.o |
365 | 603 | m_memory.o: memoryinfo.o parallel.o sys.o | ||
366 | 604 | m_mpi_utils.o: precision.o sys.o | 634 | m_mpi_utils.o: precision.o sys.o |
367 | 605 | m_noccbands.o: alloc.o atmfuncs.o m_spin.o parallel.o precision.o siesta_geom.o | 635 | m_noccbands.o: alloc.o atmfuncs.o m_spin.o parallel.o precision.o siesta_geom.o |
368 | 606 | m_noccbands.o: sys.o | 636 | m_noccbands.o: sys.o |
369 | @@ -656,16 +686,21 @@ | |||
370 | 656 | matel_registry.o: m_trialorbitalclass.o precision.o radial.o spher_harm.o sys.o | 686 | matel_registry.o: m_trialorbitalclass.o precision.o radial.o spher_harm.o sys.o |
371 | 657 | md_out.o: files.o m_energies.o precision.o sys.o units.o | 687 | md_out.o: files.o m_energies.o precision.o sys.o units.o |
372 | 658 | md_utils.o: precision.o | 688 | md_utils.o: precision.o |
375 | 659 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 689 | memory.o: memory_log.o parallel.o |
376 | 660 | memoryinfo.o: precision.o | 690 | memory_log.o: m_io.o parallel.o precision.o |
377 | 661 | mesh.o: precision.o | 691 | mesh.o: precision.o |
378 | 662 | meshcomm.o: mesh.o precision.o | 692 | meshcomm.o: mesh.o precision.o |
379 | 663 | meshdscf.o: alloc.o atomlist.o m_dscfcomm.o meshphi.o parallel.o parallelsubs.o | 693 | meshdscf.o: alloc.o atomlist.o m_dscfcomm.o meshphi.o parallel.o parallelsubs.o |
380 | 664 | meshdscf.o: precision.o | 694 | meshdscf.o: precision.o |
381 | 665 | meshphi.o: alloc.o precision.o | 695 | meshphi.o: alloc.o precision.o |
382 | 666 | meshsubs.o: alloc.o atm_types.o atmfuncs.o cellsubs.o cellxc_mod.o chkgmx.o | 696 | meshsubs.o: alloc.o atm_types.o atmfuncs.o cellsubs.o cellxc_mod.o chkgmx.o |
383 | 697 | <<<<<<< TREE | ||
384 | 667 | meshsubs.o: fft1d.o mesh.o meshphi.o moremeshsubs.o parallel.o parallelsubs.o | 698 | meshsubs.o: fft1d.o mesh.o meshphi.o moremeshsubs.o parallel.o parallelsubs.o |
385 | 668 | meshsubs.o: precision.o siesta_cml.o sys.o | 699 | meshsubs.o: precision.o siesta_cml.o sys.o |
386 | 700 | ======= | ||
387 | 701 | meshsubs.o: m_fft_gpfa.o mesh.o meshphi.o moremeshsubs.o parallel.o | ||
388 | 702 | meshsubs.o: parallelsubs.o precision.o radial.o siesta_cml.o sys.o | ||
389 | 703 | >>>>>>> MERGE-SOURCE | ||
390 | 669 | metaforce.o: alloc.o parallel.o precision.o sys.o | 704 | metaforce.o: alloc.o parallel.o precision.o sys.o |
391 | 670 | minvec.o: cellsubs.o precision.o sorting.o sys.o | 705 | minvec.o: cellsubs.o precision.o sorting.o sys.o |
392 | 671 | mixer.o: atomlist.o m_broyden_mixing.o m_fire_mixing.o m_pulay.o m_spin.o | 706 | mixer.o: atomlist.o m_broyden_mixing.o m_fire_mixing.o m_pulay.o m_spin.o |
393 | @@ -734,8 +769,8 @@ | |||
394 | 734 | proximity_check.o: siesta_geom.o siesta_options.o units.o | 769 | proximity_check.o: siesta_geom.o siesta_options.o units.o |
395 | 735 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o | 770 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o |
396 | 736 | radial.o: alloc.o interpolation.o precision.o xml.o | 771 | radial.o: alloc.o interpolation.o precision.o xml.o |
399 | 737 | rdiag.o: alloc.o m_diagon.o memoryinfo.o parallel.o precision.o sys.o | 772 | rdiag.o: alloc.o diagmemory.o m_diagon.o parallel.o precision.o sys.o |
400 | 738 | read_options.o: files.o m_target_stress.o memoryinfo.o parallel.o precision.o | 773 | read_options.o: diagmemory.o files.o m_target_stress.o parallel.o precision.o |
401 | 739 | read_options.o: siesta_cml.o siesta_options.o sys.o units.o | 774 | read_options.o: siesta_cml.o siesta_options.o sys.o units.o |
402 | 740 | read_xc_info.o: parallel.o precision.o sys.o | 775 | read_xc_info.o: parallel.o precision.o sys.o |
403 | 741 | readsp.o: parallel.o precision.o sys.o | 776 | readsp.o: parallel.o precision.o sys.o |
404 | @@ -789,8 +824,8 @@ | |||
405 | 789 | siesta_analysis.o: siesta_geom.o siesta_options.o sparse_matrices.o units.o | 824 | siesta_analysis.o: siesta_geom.o siesta_options.o sparse_matrices.o units.o |
406 | 790 | siesta_analysis.o: write_subs.o writewave.o zmatrix.o | 825 | siesta_analysis.o: write_subs.o writewave.o zmatrix.o |
407 | 791 | siesta_cmlsubs.o: files.o parallel.o siesta_cml.o timestamp.o | 826 | siesta_cmlsubs.o: files.o parallel.o siesta_cml.o timestamp.o |
410 | 792 | siesta_end.o: alloc.o bands.o densematrix.o fixed.o m_dscfcomm.o m_pulay.o | 827 | siesta_end.o: bands.o densematrix.o fixed.o m_dscfcomm.o m_pulay.o m_rhog.o |
411 | 793 | siesta_end.o: m_rhog.o m_wallclock.o meshdscf.o meshphi.o moremeshsubs.o | 828 | siesta_end.o: m_wallclock.o memory_log.o meshdscf.o meshphi.o moremeshsubs.o |
412 | 794 | siesta_end.o: parallel.o siesta_cml.o siesta_cmlsubs.o siesta_master.o | 829 | siesta_end.o: parallel.o siesta_cml.o siesta_cmlsubs.o siesta_master.o |
413 | 795 | siesta_end.o: sparse_matrices.o timestamp.o | 830 | siesta_end.o: sparse_matrices.o timestamp.o |
414 | 796 | siesta_forces.o: compute_dm.o compute_energies.o compute_max_diff.o | 831 | siesta_forces.o: compute_dm.o compute_energies.o compute_max_diff.o |
415 | @@ -806,10 +841,10 @@ | |||
416 | 806 | siesta_init.o: ioxv.o kpoint_grid.o kpoint_pdos.o ksvinit.o m_check_supercell.o | 841 | siesta_init.o: ioxv.o kpoint_grid.o kpoint_pdos.o ksvinit.o m_check_supercell.o |
417 | 807 | siesta_init.o: m_cite.o m_energies.o m_eo.o m_forces.o m_gamma.o m_iostruct.o | 842 | siesta_init.o: m_cite.o m_energies.o m_eo.o m_forces.o m_gamma.o m_iostruct.o |
418 | 808 | siesta_init.o: m_mpi_utils.o m_rmaxh.o m_spin.o m_steps.o m_timer.o | 843 | siesta_init.o: m_mpi_utils.o m_rmaxh.o m_spin.o m_steps.o m_timer.o |
423 | 809 | siesta_init.o: m_wallclock.o metaforce.o molecularmechanics.o parallel.o | 844 | siesta_init.o: m_wallclock.o memory_log.o metaforce.o molecularmechanics.o |
424 | 810 | siesta_init.o: parallelsubs.o projected_DOS.o siesta_cmlsubs.o siesta_geom.o | 845 | siesta_init.o: parallel.o parallelsubs.o projected_DOS.o siesta_cmlsubs.o |
425 | 811 | siesta_init.o: siesta_options.o sparse_matrices.o struct_init.o sys.o timer.o | 846 | siesta_init.o: siesta_geom.o siesta_options.o sparse_matrices.o struct_init.o |
426 | 812 | siesta_init.o: timestamp.o ts_init.o writewave.o zmatrix.o | 847 | siesta_init.o: sys.o timer.o timestamp.o ts_init.o writewave.o zmatrix.o |
427 | 813 | siesta_master.o: iopipes.o iosockets.o m_fdf_global.o precision.o sys.o | 848 | siesta_master.o: iopipes.o iosockets.o m_fdf_global.o precision.o sys.o |
428 | 814 | siesta_move.o: atomlist.o broyden_optim.o cell_broyden_optim.o | 849 | siesta_move.o: atomlist.o broyden_optim.o cell_broyden_optim.o |
429 | 815 | siesta_move.o: cell_fire_optim.o dynamics.o fire_optim.o ioxv.o m_energies.o | 850 | siesta_move.o: cell_fire_optim.o dynamics.o fire_optim.o ioxv.o m_energies.o |
430 | @@ -873,7 +908,6 @@ | |||
431 | 873 | zmatrix.o: alloc.o m_cell.o parallel.o precision.o siesta_geom.o sys.o units.o | 908 | zmatrix.o: alloc.o m_cell.o parallel.o precision.o siesta_geom.o sys.o units.o |
432 | 874 | aux_proj.o: atom.o | 909 | aux_proj.o: atom.o |
433 | 875 | band.o: bands.o | 910 | band.o: bands.o |
434 | 876 | diagmemory.o: memoryinfo.o | ||
435 | 877 | f90sockets.o: fsockets.o | 911 | f90sockets.o: fsockets.o |
436 | 878 | fsiesta.o: fsiesta_sockets.o | 912 | fsiesta.o: fsiesta_sockets.o |
437 | 879 | listsc_module.o: listsc.o | 913 | listsc_module.o: listsc.o |
438 | 880 | 914 | ||
439 | === modified file 'Src/SiestaXC/makefile' | |||
440 | --- Src/SiestaXC/makefile 2015-07-19 05:13:23 +0000 | |||
441 | +++ Src/SiestaXC/makefile 2016-07-19 08:21:24 +0000 | |||
442 | @@ -17,7 +17,7 @@ | |||
443 | 17 | module: libSiestaXC.a | 17 | module: libSiestaXC.a |
444 | 18 | cp *.mod *.a .. | 18 | cp *.mod *.a .. |
445 | 19 | # | 19 | # |
447 | 20 | SIESTA_SRCS= alloc.F90 bessph.f cellsubs.f debugmpi.F \ | 20 | SIESTA_SRCS= alloc.F90 memory_log.F90 bessph.f cellsubs.f debugmpi.F \ |
448 | 21 | chkgmx.f fft1d.F interpolation.f90 \ | 21 | chkgmx.f fft1d.F interpolation.f90 \ |
449 | 22 | minvec.f m_io.f moreParallelSubs.F90 \ | 22 | minvec.f m_io.f moreParallelSubs.F90 \ |
450 | 23 | m_timer.F90 timer_tree.F90 m_walltime.f90 parallel.F \ | 23 | m_timer.F90 timer_tree.F90 m_walltime.f90 parallel.F \ |
451 | @@ -71,7 +71,7 @@ | |||
452 | 71 | rm -fr *.o *.*d *.a siestaXC.tgz | 71 | rm -fr *.o *.*d *.a siestaXC.tgz |
453 | 72 | # | 72 | # |
454 | 73 | # DO NOT DELETE THIS LINE - used by make depend | 73 | # DO NOT DELETE THIS LINE - used by make depend |
456 | 74 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | 74 | alloc.o: memory_log.o |
457 | 75 | am05.o: precision.o sys.o | 75 | am05.o: precision.o sys.o |
458 | 76 | atomxc.o: alloc.o ggaxc.o ldaxc.o mesh1d.o precision.o radfft.o | 76 | atomxc.o: alloc.o ggaxc.o ldaxc.o mesh1d.o precision.o radfft.o |
459 | 77 | atomxc.o: sys.o vdwxc.o xcmod.o | 77 | atomxc.o: sys.o vdwxc.o xcmod.o |
460 | @@ -91,6 +91,7 @@ | |||
461 | 91 | ldaxc.o: precision.o sys.o | 91 | ldaxc.o: precision.o sys.o |
462 | 92 | m_io.o: sys.o | 92 | m_io.o: sys.o |
463 | 93 | m_timer.o: m_io.o m_walltime.o moreParallelSubs.o parallel.o precision.o sys.o | 93 | m_timer.o: m_io.o m_walltime.o moreParallelSubs.o parallel.o precision.o sys.o |
464 | 94 | memory_log.o: precision.o parallel.o m_io.o | ||
465 | 94 | mesh1d.o: precision.o | 95 | mesh1d.o: precision.o |
466 | 95 | mesh3d.o: alloc.o debugxc.o parallel.o precision.o sorting.o sys.o | 96 | mesh3d.o: alloc.o debugxc.o parallel.o precision.o sorting.o sys.o |
467 | 96 | minvec.o: cellsubs.o precision.o sorting.o sys.o | 97 | minvec.o: cellsubs.o precision.o sorting.o sys.o |
468 | 97 | 98 | ||
469 | === modified file 'Src/SiestaXC/siestaxc.F90' | |||
470 | --- Src/SiestaXC/siestaxc.F90 2015-06-09 13:34:25 +0000 | |||
471 | +++ Src/SiestaXC/siestaxc.F90 2016-07-19 08:21:24 +0000 | |||
472 | @@ -20,7 +20,7 @@ | |||
473 | 20 | ! Extra utilities placed here for non-siesta users | 20 | ! Extra utilities placed here for non-siesta users |
474 | 21 | ! See correspondig modules for usage documentation | 21 | ! See correspondig modules for usage documentation |
475 | 22 | ! nfft ! Get allowed sizes for FFTs | 22 | ! nfft ! Get allowed sizes for FFTs |
477 | 23 | ! alloc_report ! Set and print allocation report | 23 | ! memory_report ! Set and print allocation report |
478 | 24 | ! setDebugOutputUnit ! Initialize debug report | 24 | ! setDebugOutputUnit ! Initialize debug report |
479 | 25 | ! closeDebugOutputFile ! Print debug report | 25 | ! closeDebugOutputFile ! Print debug report |
480 | 26 | ! timer_report ! Print report of CPU times | 26 | ! timer_report ! Print report of CPU times |
481 | @@ -429,7 +429,7 @@ | |||
482 | 429 | ! | 429 | ! |
483 | 430 | !****************************************************************************** | 430 | !****************************************************************************** |
484 | 431 | ! | 431 | ! |
486 | 432 | ! SUBROUTINE alloc_report( level, unit, file, printNow, threshold ) | 432 | ! SUBROUTINE memory_report( level, unit, file, printNow, threshold ) |
487 | 433 | ! Sets the output file for the allocation report | 433 | ! Sets the output file for the allocation report |
488 | 434 | ! INPUT (optional): | 434 | ! INPUT (optional): |
489 | 435 | ! integer :: level : Level (detail) of report | 435 | ! integer :: level : Level (detail) of report |
490 | @@ -445,14 +445,14 @@ | |||
491 | 445 | ! level=2 : detailed report created but printed only upon request | 445 | ! level=2 : detailed report created but printed only upon request |
492 | 446 | ! level=3 : detailed report printed at every new memory peak | 446 | ! level=3 : detailed report printed at every new memory peak |
493 | 447 | ! level=4 : print every individual reallocation or deallocation | 447 | ! level=4 : print every individual reallocation or deallocation |
495 | 448 | ! If unit is present, alloc_report merely takes note of it for | 448 | ! If unit is present, memory_report merely takes note of it for |
496 | 449 | ! future use, assuming that it has been already open outside. | 449 | ! future use, assuming that it has been already open outside. |
497 | 450 | ! In this case, file is not used. | 450 | ! In this case, file is not used. |
498 | 451 | ! If unit is absent, and file is present, a file with that | 451 | ! If unit is absent, and file is present, a file with that |
499 | 452 | ! name is open for future use. | 452 | ! name is open for future use. |
500 | 453 | ! If both arguments are absent, a file named 'alloc_report' | 453 | ! If both arguments are absent, a file named 'alloc_report' |
501 | 454 | ! is open for future use. | 454 | ! is open for future use. |
503 | 455 | ! If alloc_report is called with printNow=.true. several times in | 455 | ! If memory_report is called with printNow=.true. several times in |
504 | 456 | ! a program, with the same unit or file argument, the subsequent | 456 | ! a program, with the same unit or file argument, the subsequent |
505 | 457 | ! reports are written consecutively in the same file, each with a | 457 | ! reports are written consecutively in the same file, each with a |
506 | 458 | ! time stamp header. | 458 | ! time stamp header. |
507 | @@ -712,7 +712,7 @@ | |||
508 | 712 | ! Extra utilities placed here for non-siesta users | 712 | ! Extra utilities placed here for non-siesta users |
509 | 713 | ! See correspondig modules for usage documentation | 713 | ! See correspondig modules for usage documentation |
510 | 714 | USE fft1d, only: nfft ! Get allowed sizes for FFTs | 714 | USE fft1d, only: nfft ! Get allowed sizes for FFTs |
512 | 715 | USE alloc, only: alloc_report ! Set and print allocation report | 715 | USE memory_log, only: memory_report ! Set and print allocation report |
513 | 716 | #ifdef DEBUG_XC | 716 | #ifdef DEBUG_XC |
514 | 717 | USE debugXC, only: setDebugOutputUnit ! Set debug report | 717 | USE debugXC, only: setDebugOutputUnit ! Set debug report |
515 | 718 | USE debugXC, only: closeDebugOutputFile ! Print debug report | 718 | USE debugXC, only: closeDebugOutputFile ! Print debug report |
516 | 719 | 719 | ||
517 | === added file 'Src/Sys/GRIDXC.make' | |||
518 | --- Src/Sys/GRIDXC.make 1970-01-01 00:00:00 +0000 | |||
519 | +++ Src/Sys/GRIDXC.make 2016-07-19 08:21:24 +0000 | |||
520 | @@ -0,0 +1,55 @@ | |||
521 | 1 | # | ||
522 | 2 | # This file is part of the SIESTA package. | ||
523 | 3 | # | ||
524 | 4 | # Copyright (c) Fundacion General Universidad Autonoma de Madrid: | ||
525 | 5 | # E.Artacho, J.Gale, A.Garcia, J.Junquera, P.Ordejon, D.Sanchez-Portal | ||
526 | 6 | # and J.M.Soler, 1996- . | ||
527 | 7 | # | ||
528 | 8 | # Use of this software constitutes agreement with the full conditions | ||
529 | 9 | # given in the SIESTA license, as signed by all legitimate users. | ||
530 | 10 | # | ||
531 | 11 | SIESTA_ARCH=gfortran-macosx64-openmpi | ||
532 | 12 | # The only thing you should change is the location of the libraries | ||
533 | 13 | # on your computer | ||
534 | 14 | # | ||
535 | 15 | FC=mpif90 | ||
536 | 16 | FC_SERIAL=gfortran | ||
537 | 17 | # | ||
538 | 18 | GRIDXC_ROOT=$(HOME)/lib/gfortran/gridxc-mpi | ||
539 | 19 | GRIDXC_SERIAL_ROOT=$(HOME)/lib/gfortran/gridxc | ||
540 | 20 | # | ||
541 | 21 | FC_ASIS=$(FC) | ||
542 | 22 | # | ||
543 | 23 | ###FFLAGS= -g -O2 # -Wall | ||
544 | 24 | FFLAGS_CHECKS= -O0 -g -fcheck=all | ||
545 | 25 | FFLAGS= -O0 -g -fcheck=all | ||
546 | 26 | FFLAGS_DEBUG= -g -O0 | ||
547 | 27 | RANLIB=echo | ||
548 | 28 | COMP_LIBS= | ||
549 | 29 | # | ||
550 | 30 | NETCDF_ROOT=/usr/local | ||
551 | 31 | NETCDF_INCFLAGS=-I$(NETCDF_ROOT)/include | ||
552 | 32 | FPPFLAGS_CDF=-DCDF | ||
553 | 33 | NETCDF_LIBS= -L$(NETCDF_ROOT)/lib -lnetcdff | ||
554 | 34 | # | ||
555 | 35 | MPI_INTERFACE=libmpi_f90.a | ||
556 | 36 | MPI_INCLUDE=. # Note . for no-op | ||
557 | 37 | FPPFLAGS_MPI=-DMPI | ||
558 | 38 | |||
559 | 39 | LIBS=-L/opt/scalapack/openmpi-1.6.1-gfortran/lib \ | ||
560 | 40 | -lscalapack -ltmg -lreflapack -lrefblas \ | ||
561 | 41 | $(NETCDF_LIBS) | ||
562 | 42 | |||
563 | 43 | SYS=nag | ||
564 | 44 | FPPFLAGS= $(FPPFLAGS_CDF) $(FPPFLAGS_MPI) -DF2003 | ||
565 | 45 | # | ||
566 | 46 | # | ||
567 | 47 | .F.o: | ||
568 | 48 | $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $< | ||
569 | 49 | .f.o: | ||
570 | 50 | $(FC) -c $(FFLAGS) $(INCFLAGS) $< | ||
571 | 51 | .F90.o: | ||
572 | 52 | $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $< | ||
573 | 53 | .f90.o: | ||
574 | 54 | $(FC) -c $(FFLAGS) $(INCFLAGS) $< | ||
575 | 55 | # | ||
576 | 0 | 56 | ||
577 | === modified file 'Src/alloc.F90' | |||
578 | --- Src/alloc.F90 2016-01-28 13:41:07 +0000 | |||
579 | +++ Src/alloc.F90 2016-07-19 08:21:24 +0000 | |||
580 | @@ -9,7 +9,10 @@ | |||
581 | 9 | ! | 9 | ! |
582 | 10 | ! ================================================================== | 10 | ! ================================================================== |
583 | 11 | ! Allocation, reallocation, and deallocation utility routines | 11 | ! Allocation, reallocation, and deallocation utility routines |
584 | 12 | ! for pointers | ||
585 | 13 | ! | ||
586 | 12 | ! Written by J.M.Soler. May 2000. | 14 | ! Written by J.M.Soler. May 2000. |
587 | 15 | ! Re-organized by A. Garcia, June 2015. | ||
588 | 13 | ! ================================================================== | 16 | ! ================================================================== |
589 | 14 | ! SUBROUTINE alloc_default( old, new, restore, & | 17 | ! SUBROUTINE alloc_default( old, new, restore, & |
590 | 15 | ! copy, shrink, imin, routine ) | 18 | ! copy, shrink, imin, routine ) |
591 | @@ -45,44 +48,6 @@ | |||
592 | 45 | ! Notice that, if the restore call is skipped, the new defaults will | 48 | ! Notice that, if the restore call is skipped, the new defaults will |
593 | 46 | ! stay in effect until a new call to alloc_dafault is made. | 49 | ! stay in effect until a new call to alloc_dafault is made. |
594 | 47 | ! ================================================================== | 50 | ! ================================================================== |
595 | 48 | ! SUBROUTINE alloc_report( level, unit, file, printNow, threshold ) | ||
596 | 49 | ! Sets the output file for the allocation report | ||
597 | 50 | ! INPUT (optional): | ||
598 | 51 | ! integer :: level : Level (detail) of report | ||
599 | 52 | ! integer :: unit : Output file unit | ||
600 | 53 | ! character*(*):: file : Output file name | ||
601 | 54 | ! logical :: printNow : If present & true => print report now | ||
602 | 55 | ! real(dp) :: threshold : Memory threshold (in bytes) to print | ||
603 | 56 | ! the memory use of any given array | ||
604 | 57 | ! BEHAVIOR: | ||
605 | 58 | ! The detail/extent of the report increses with the value of level: | ||
606 | 59 | ! level=0 : no report at all (the default) | ||
607 | 60 | ! level=1 : only total memory peak and where it occurred | ||
608 | 61 | ! level=2 : detailed report created but printed only upon request | ||
609 | 62 | ! level=3 : detailed report printed at every new memory peak | ||
610 | 63 | ! level=4 : print every individual reallocation or deallocation | ||
611 | 64 | ! If unit is present, alloc_report merely takes note of it for | ||
612 | 65 | ! future use, assuming that it has been already open outside. | ||
613 | 66 | ! In this case, file is not used. | ||
614 | 67 | ! If unit is absent, and file is present, a file with that | ||
615 | 68 | ! name is open for future use. | ||
616 | 69 | ! If both arguments are absent, a file named 'alloc_report' | ||
617 | 70 | ! is open for future use. | ||
618 | 71 | ! If alloc_report is called with printNow=.true. several times in | ||
619 | 72 | ! a program, with the same unit or file argument, the subsequent | ||
620 | 73 | ! reports are written consecutively in the same file, each with a | ||
621 | 74 | ! time stamp header. | ||
622 | 75 | ! If threshold is not present, threshold=0 is assumed. | ||
623 | 76 | ! In parallel execution, the report sections that involve every | ||
624 | 77 | ! reallocation (levels 1, 3, and 4) are written only by node 0. | ||
625 | 78 | ! The section that is written upon request (level 2) is written | ||
626 | 79 | ! only by the node with the highest peak of memory up to that time, | ||
627 | 80 | ! but it contains a summary of the memory used by all other nodes. | ||
628 | 81 | ! In parallel execution, the nodes that share the same file | ||
629 | 82 | ! system (e.g. different chip cores or NFS-connected nodes) write | ||
630 | 83 | ! on the same file. Otherwise they write on files with the same name | ||
631 | 84 | ! in their local disks. | ||
632 | 85 | ! ================================================================== | ||
633 | 86 | ! SUBROUTINE re_alloc( array, [i1min,] i1max, | 51 | ! SUBROUTINE re_alloc( array, [i1min,] i1max, |
634 | 87 | ! [[i2min,] i2max, [[i3min,] i3max]], | 52 | ! [[i2min,] i2max, [[i3min,] i3max]], |
635 | 88 | ! name, routine, copy, shrink ) | 53 | ! name, routine, copy, shrink ) |
636 | @@ -138,22 +103,21 @@ | |||
637 | 138 | ! zero (integer and real), .false. (logical), or blank (character). | 103 | ! zero (integer and real), .false. (logical), or blank (character). |
638 | 139 | ! If imin>imax for any dimension, the array pointer returns | 104 | ! If imin>imax for any dimension, the array pointer returns |
639 | 140 | ! associated to a zero-size array. | 105 | ! associated to a zero-size array. |
656 | 141 | ! Besides allocating or reallocating the array, re_alloc keeps a count | 106 | ! |
657 | 142 | ! of memory usage (and prints a report in a file previously fixed by a | 107 | ! Besides allocating or reallocating the array, re_alloc calls |
658 | 143 | ! call to alloc_report). Thus, it is not recommended to call re_alloc | 108 | ! the external routine 'alloc_memory_event' with the number |
659 | 144 | ! to reallocate an array not allocated by it the first time. | 109 | ! of bytes involved in the allocation and a string identifier |
660 | 145 | ! If name is not present, the memory count associated to the | 110 | ! built from the 'routine' and 'name' arguments: 'routine@name'. |
661 | 146 | ! allocation/deallocation is still made, but the allocation report | 111 | ! Clients of this module can process this information at will. |
662 | 147 | ! will account the array under the generic name 'unknown'. | 112 | ! |
663 | 148 | ! The routine argument is NOT used to classify the counting of | 113 | ! Error conditions are reported via a callback to the external |
664 | 149 | ! memory usage. The classification uses only the name argument. | 114 | ! routine 'alloc_error_report', with a string message and an |
665 | 150 | ! This is because a pointer may be allocated in one routine and | 115 | ! integer code. |
666 | 151 | ! deallocated in a different one (i.e. when it is used to return an | 116 | ! Clients of this module can process this information at will. |
667 | 152 | ! array whose size is not known in advance). However, the routine | 117 | ! |
668 | 153 | ! argument is reported when alloc_report=4, and it is also used to | 118 | ! In future, an extra 'stat' argument might be included in the calls |
669 | 154 | ! report in which routine the memory peack occurs. If you want the | 119 | ! to re_alloc and de_alloc for finer control. |
670 | 155 | ! routine name to be used for classification, you should include it | 120 | ! |
655 | 156 | ! as part of the name argument, like in name='matInvert '//'aux'. | ||
671 | 157 | ! ==================================================================--- | 121 | ! ==================================================================--- |
672 | 158 | ! SUBROUTINE de_alloc( array, name, routine ) | 122 | ! SUBROUTINE de_alloc( array, name, routine ) |
673 | 159 | ! INPUT (optional): | 123 | ! INPUT (optional): |
674 | @@ -170,69 +134,47 @@ | |||
675 | 170 | ! Equally, arrays allocated or reallocated by re_alloc should be | 134 | ! Equally, arrays allocated or reallocated by re_alloc should be |
676 | 171 | ! deallocated by dealloc. | 135 | ! deallocated by dealloc. |
677 | 172 | ! ==================================================================--- | 136 | ! ==================================================================--- |
678 | 173 | ! SUBROUTINE alloc_count( delta_size, type, name, routine ) | ||
679 | 174 | ! INPUT: | ||
680 | 175 | ! integer :: delta_size : +/-size(array) | ||
681 | 176 | ! + => allocation | ||
682 | 177 | ! - => deallocation | ||
683 | 178 | ! character :: type : 'I' => integer | ||
684 | 179 | ! 'E' => integer*8 | ||
685 | 180 | ! 'R' => real*4 | ||
686 | 181 | ! 'D' => real*8 | ||
687 | 182 | ! 'L' => logical | ||
688 | 183 | ! 'S' => character (string) | ||
689 | 184 | ! INPUT (optional): | ||
690 | 185 | ! character(len=*) :: name : Actual array name or a label for it | ||
691 | 186 | ! character(len=*) :: routine : Name of the calling routine | ||
692 | 187 | ! or routine section | ||
693 | 188 | ! USAGE: | ||
694 | 189 | ! integer, allocatable:: intArray(:) | ||
695 | 190 | ! double precision,allocatable:: doubleArray(:) | ||
696 | 191 | ! complex, allocatable:: complexArray(:) | ||
697 | 192 | ! allocate( intArray(n), doubleArray(n), complexArray(n) ) | ||
698 | 193 | ! call alloc_count( +n, 'I', 'intArray', programName ) | ||
699 | 194 | ! call alloc_count( +n, 'D', 'doubleArray', programName ) | ||
700 | 195 | ! call alloc_count( +2*n, 'R', 'complexArray', programName ) | ||
701 | 196 | ! deallocate( intArray, doubleArray, complexArray ) | ||
702 | 197 | ! call alloc_count( -n, 'I', 'intArray', programName ) | ||
703 | 198 | ! call alloc_count( -n, 'D', 'doubleArray', programName ) | ||
704 | 199 | ! call alloc_count( -2*n, 'R', 'complexArray', programName ) | ||
705 | 200 | ! | ||
706 | 201 | ! ==================================================================--- | ||
707 | 202 | |||
708 | 203 | MODULE alloc | 137 | MODULE alloc |
729 | 204 | 138 | ! | |
730 | 205 | use precision, only: sp ! Single precision real type | 139 | ! This module has no external build dependencies |
731 | 206 | use precision, only: dp ! Double precision real type | 140 | ! Final executables must resolve the symbols for the two handlers |
732 | 207 | use parallel, only: Node ! My processor node index | 141 | ! alloc_memory_event |
733 | 208 | use parallel, only: Nodes ! Number of parallel processors | 142 | ! alloc_error_report |
734 | 209 | use parallel, only: ionode ! Am I the I/O processor? | 143 | ! with interfaces specified below |
735 | 210 | use parallel, only: parallel_init ! Initialize parallel variables | 144 | ! |
716 | 211 | use sys, only: die ! Termination routine | ||
717 | 212 | use m_io, only: io_assign ! Get and reserve an available IO unit | ||
718 | 213 | #ifdef MPI | ||
719 | 214 | ! use mpi_siesta | ||
720 | 215 | use mpi_siesta, only: MPI_AllGather | ||
721 | 216 | use mpi_siesta, only: MPI_Barrier | ||
722 | 217 | use mpi_siesta, only: MPI_Bcast | ||
723 | 218 | use mpi_siesta, only: MPI_Comm_World | ||
724 | 219 | use mpi_siesta, only: MPI_double_precision | ||
725 | 220 | use mpi_siesta, only: MPI_integer | ||
726 | 221 | use mpi_siesta, only: MPI_character | ||
727 | 222 | #endif | ||
728 | 223 | |||
736 | 224 | implicit none | 145 | implicit none |
737 | 225 | 146 | ||
738 | 226 | PUBLIC :: & | 147 | PUBLIC :: & |
739 | 227 | alloc_default, &! Sets allocation defaults | 148 | alloc_default, &! Sets allocation defaults |
740 | 228 | alloc_report, &! Sets log report defaults | ||
741 | 229 | re_alloc, &! Allocation/reallocation | 149 | re_alloc, &! Allocation/reallocation |
742 | 230 | de_alloc, &! Deallocation | 150 | de_alloc, &! Deallocation |
743 | 231 | alloc_count, &! Memory counting for external allocs | ||
744 | 232 | allocDefaults ! Derived type to hold allocation defaults | 151 | allocDefaults ! Derived type to hold allocation defaults |
745 | 233 | 152 | ||
746 | 234 | PRIVATE ! Nothing is declared public beyond this point | 153 | PRIVATE ! Nothing is declared public beyond this point |
747 | 235 | 154 | ||
748 | 155 | integer, parameter :: sp = selected_real_kind(5,10) | ||
749 | 156 | integer, parameter :: dp = selected_real_kind(10,100) | ||
750 | 157 | |||
751 | 158 | ! Interfaces to external routines that must be provided | ||
752 | 159 | ! by the calling program | ||
753 | 160 | ! | ||
754 | 161 | interface | ||
755 | 162 | ! Error message and integer code | ||
756 | 163 | ! If 'code' is 0, this is the last call in a series | ||
757 | 164 | ! (see below for usage) | ||
758 | 165 | subroutine alloc_error_report(str,code) | ||
759 | 166 | character(len=*), intent(in) :: str | ||
760 | 167 | integer, intent(in) :: code | ||
761 | 168 | end subroutine alloc_error_report | ||
762 | 169 | ! | ||
763 | 170 | ! Logger for memory events | ||
764 | 171 | ! | ||
765 | 172 | subroutine alloc_memory_event(bytes,name) | ||
766 | 173 | integer, intent(in) :: bytes | ||
767 | 174 | character(len=*), intent(in) :: name | ||
768 | 175 | end subroutine alloc_memory_event | ||
769 | 176 | end interface | ||
770 | 177 | |||
771 | 236 | interface de_alloc | 178 | interface de_alloc |
772 | 237 | module procedure & | 179 | module procedure & |
773 | 238 | dealloc_i1, dealloc_i2, dealloc_i3, & | 180 | dealloc_i1, dealloc_i2, dealloc_i3, & |
774 | @@ -265,14 +207,6 @@ | |||
775 | 265 | DEFAULT_NAME = 'unknown_name' ! Array name default | 207 | DEFAULT_NAME = 'unknown_name' ! Array name default |
776 | 266 | character(len=*), parameter :: & | 208 | character(len=*), parameter :: & |
777 | 267 | DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default | 209 | DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default |
778 | 268 | integer, save :: & | ||
779 | 269 | REPORT_LEVEL = 0, &! Level (detail) of allocation report | ||
780 | 270 | REPORT_UNIT = 0 ! Output file unit for report | ||
781 | 271 | character(len=50), save :: & | ||
782 | 272 | REPORT_FILE = 'alloc_report' ! Output file name for report | ||
783 | 273 | real(dp), save :: & | ||
784 | 274 | REPORT_THRESHOLD = 0 ! Memory threshold (in bytes) to print | ||
785 | 275 | ! the memory use of any given array | ||
786 | 276 | 210 | ||
787 | 277 | ! Derived type to hold allocation default options | 211 | ! Derived type to hold allocation default options |
788 | 278 | type allocDefaults | 212 | type allocDefaults |
789 | @@ -286,28 +220,6 @@ | |||
790 | 286 | ! Object to hold present allocation default options | 220 | ! Object to hold present allocation default options |
791 | 287 | type(allocDefaults), save :: DEFAULT | 221 | type(allocDefaults), save :: DEFAULT |
792 | 288 | 222 | ||
793 | 289 | ! Internal auxiliary type for a binary tree | ||
794 | 290 | type TREE | ||
795 | 291 | character(len=80) :: name ! Name of an allocated array | ||
796 | 292 | real(DP) :: mem ! Present memory use of the array | ||
797 | 293 | real(DP) :: max ! Maximum memory use of the array | ||
798 | 294 | real(DP) :: peak ! Memory use of the array during | ||
799 | 295 | ! peak of total memory | ||
800 | 296 | type(TREE), pointer :: left ! Pointer to data of allocated arrays | ||
801 | 297 | ! preceeding in alphabetical order | ||
802 | 298 | type(TREE), pointer :: right ! Pointer to data of allocated arrays | ||
803 | 299 | ! trailing in alphabetical order | ||
804 | 300 | end type TREE | ||
805 | 301 | |||
806 | 302 | ! Global variables used to store allocation data | ||
807 | 303 | real(DP), parameter :: MBYTE = 1.e6_dp | ||
808 | 304 | type(TREE), pointer, save :: REPORT_TREE | ||
809 | 305 | real(DP), save :: TOT_MEM = 0._dp | ||
810 | 306 | real(DP), save :: PEAK_MEM = 0._dp | ||
811 | 307 | character(len=80), save :: PEAK_ARRAY = ' ' | ||
812 | 308 | character(len=32), save :: PEAK_ROUTINE = ' ' | ||
813 | 309 | integer, save :: MAX_LEN = 0 | ||
814 | 310 | |||
815 | 311 | ! Other common variables | 223 | ! Other common variables |
816 | 312 | integer :: IERR | 224 | integer :: IERR |
817 | 313 | logical :: ASSOCIATED_ARRAY, NEEDS_ALLOC, NEEDS_COPY, NEEDS_DEALLOC | 225 | logical :: ASSOCIATED_ARRAY, NEEDS_ALLOC, NEEDS_COPY, NEEDS_DEALLOC |
818 | @@ -336,74 +248,6 @@ | |||
819 | 336 | END SUBROUTINE alloc_default | 248 | END SUBROUTINE alloc_default |
820 | 337 | 249 | ||
821 | 338 | ! ================================================================== | 250 | ! ================================================================== |
822 | 339 | |||
823 | 340 | SUBROUTINE alloc_report( level, unit, file, printNow, threshold ) | ||
824 | 341 | |||
825 | 342 | implicit none | ||
826 | 343 | |||
827 | 344 | integer, optional, intent(in) :: level, unit | ||
828 | 345 | character(len=*), optional, intent(in) :: file | ||
829 | 346 | logical, optional, intent(in) :: printNow | ||
830 | 347 | real(dp), optional, intent(in) :: threshold | ||
831 | 348 | |||
832 | 349 | logical open | ||
833 | 350 | |||
834 | 351 | #ifdef MPI | ||
835 | 352 | integer MPIerror | ||
836 | 353 | #endif | ||
837 | 354 | |||
838 | 355 | if (present(level)) then | ||
839 | 356 | REPORT_LEVEL = level | ||
840 | 357 | end if | ||
841 | 358 | |||
842 | 359 | if (node == 0) then | ||
843 | 360 | if (present(unit)) then ! Assume that unit has been open outside | ||
844 | 361 | if (unit > 0) then | ||
845 | 362 | REPORT_UNIT = unit | ||
846 | 363 | if (present(file)) then | ||
847 | 364 | REPORT_FILE = file | ||
848 | 365 | else | ||
849 | 366 | REPORT_FILE = 'unknown' | ||
850 | 367 | end if | ||
851 | 368 | end if | ||
852 | 369 | else if (present(file)) then ! If file is the same, do nothing | ||
853 | 370 | if (file /= REPORT_FILE) then ! Check if file was open outside | ||
854 | 371 | REPORT_FILE = file | ||
855 | 372 | inquire( file=REPORT_FILE, opened=open, number=REPORT_UNIT ) | ||
856 | 373 | if (.not.open) then ! Open new file | ||
857 | 374 | call io_assign(REPORT_UNIT) | ||
858 | 375 | open( REPORT_UNIT, file=REPORT_FILE, status='unknown') | ||
859 | 376 | write(REPORT_UNIT,*) ' ' ! Overwrite previous reports | ||
860 | 377 | end if | ||
861 | 378 | end if | ||
862 | 379 | else if (REPORT_UNIT==0) then ! No unit has been open yet | ||
863 | 380 | REPORT_FILE = 'alloc_report' | ||
864 | 381 | call io_assign(REPORT_UNIT) | ||
865 | 382 | open( REPORT_UNIT, file=REPORT_FILE, status='unknown') | ||
866 | 383 | write(REPORT_UNIT,*) ' ' ! Overwrite previous reports | ||
867 | 384 | end if | ||
868 | 385 | end if | ||
869 | 386 | |||
870 | 387 | #ifdef MPI | ||
871 | 388 | ! Distribute information to other nodes and open REPORT_UNIT | ||
872 | 389 | call MPI_Bcast(REPORT_LEVEL,1,MPI_integer,0,MPI_Comm_World,MPIerror) | ||
873 | 390 | call MPI_Bcast(REPORT_UNIT,1,MPI_integer,0,MPI_Comm_World,MPIerror) | ||
874 | 391 | call MPI_Bcast(REPORT_FILE,50,MPI_character,0,MPI_Comm_World,MPIerror) | ||
875 | 392 | ! JMS: open file only in node 0 | ||
876 | 393 | !if (node > 0) then | ||
877 | 394 | ! open( REPORT_UNIT, file=REPORT_FILE ) | ||
878 | 395 | !end if | ||
879 | 396 | #endif | ||
880 | 397 | |||
881 | 398 | if (present(threshold)) REPORT_THRESHOLD = threshold | ||
882 | 399 | |||
883 | 400 | if (present(printNow)) then | ||
884 | 401 | if (printNow) call print_report( ) | ||
885 | 402 | end if | ||
886 | 403 | |||
887 | 404 | END SUBROUTINE alloc_report | ||
888 | 405 | |||
889 | 406 | ! ================================================================== | ||
890 | 407 | ! Integer array reallocs | 251 | ! Integer array reallocs |
891 | 408 | ! ================================================================== | 252 | ! ================================================================== |
892 | 409 | 253 | ||
893 | @@ -447,7 +291,6 @@ | |||
894 | 447 | if (NEEDS_DEALLOC .and. .not.NEEDS_COPY) then | 291 | if (NEEDS_DEALLOC .and. .not.NEEDS_COPY) then |
895 | 448 | call alloc_count( -size(old_array), type, name, routine ) | 292 | call alloc_count( -size(old_array), type, name, routine ) |
896 | 449 | deallocate(old_array,stat=IERR) | 293 | deallocate(old_array,stat=IERR) |
897 | 450 | call alloc_err( IERR, name, routine, old_bounds ) | ||
898 | 451 | end if | 294 | end if |
899 | 452 | 295 | ||
900 | 453 | ! Allocate new space | 296 | ! Allocate new space |
901 | @@ -1816,8 +1659,53 @@ | |||
902 | 1816 | 1659 | ||
903 | 1817 | ! ================================================================== | 1660 | ! ================================================================== |
904 | 1818 | 1661 | ||
905 | 1662 | SUBROUTINE alloc_err( ierr, name, routine, bounds ) | ||
906 | 1663 | implicit none | ||
907 | 1664 | |||
908 | 1665 | integer, intent(in) :: ierr | ||
909 | 1666 | character(len=*), optional, intent(in) :: name | ||
910 | 1667 | character(len=*), optional, intent(in) :: routine | ||
911 | 1668 | integer, dimension(:,:), optional, intent(in) :: bounds | ||
912 | 1669 | |||
913 | 1670 | integer i | ||
914 | 1671 | character(len=128) :: msg | ||
915 | 1672 | |||
916 | 1673 | if (ierr/=0) then | ||
917 | 1674 | write(msg,*) 'alloc_err: allocate status error', ierr | ||
918 | 1675 | call alloc_error_report(trim(msg),1) | ||
919 | 1676 | if (present(name).and.present(routine)) then | ||
920 | 1677 | write(msg,*) 'alloc_err: array ', name, & | ||
921 | 1678 | ' requested by ', routine | ||
922 | 1679 | call alloc_error_report(trim(msg),2) | ||
923 | 1680 | elseif (present(name)) then | ||
924 | 1681 | write(msg,*) 'alloc_err: array ', name, & | ||
925 | 1682 | ' requested by unknown' | ||
926 | 1683 | call alloc_error_report(trim(msg),3) | ||
927 | 1684 | elseif (present(routine)) then | ||
928 | 1685 | write(msg,*) 'alloc_err: array unknown', & | ||
929 | 1686 | ' requested by ', routine | ||
930 | 1687 | call alloc_error_report(trim(msg),4) | ||
931 | 1688 | endif | ||
932 | 1689 | if (present(bounds)) then | ||
933 | 1690 | write(msg,'(a,i3,2i10)') ('alloc_err: dim, lbound, ubound:', & | ||
934 | 1691 | i,bounds(1,i),bounds(2,i), & | ||
935 | 1692 | i=1,size(bounds,dim=2)) | ||
936 | 1693 | call alloc_error_report(trim(msg),5) | ||
937 | 1694 | endif | ||
938 | 1695 | call alloc_error_report("alloc_err: end of error report",0) | ||
939 | 1696 | end if | ||
940 | 1697 | |||
941 | 1698 | END SUBROUTINE alloc_err | ||
942 | 1699 | |||
943 | 1700 | ! ================================================================== | ||
944 | 1701 | |||
945 | 1819 | SUBROUTINE alloc_count( delta_size, type, name, routine ) | 1702 | SUBROUTINE alloc_count( delta_size, type, name, routine ) |
946 | 1820 | 1703 | ||
947 | 1704 | ! | ||
948 | 1705 | ! This version simply computes the total size and calls | ||
949 | 1706 | ! the external routine alloc_memory_event with the size | ||
950 | 1707 | ! in bytes and a string identifier of the form 'routine@name'. | ||
951 | 1708 | ! | ||
952 | 1821 | implicit none | 1709 | implicit none |
953 | 1822 | 1710 | ||
954 | 1823 | integer, intent(in) :: delta_size ! +/-size(array) | 1711 | integer, intent(in) :: delta_size ! +/-size(array) |
955 | @@ -1830,114 +1718,32 @@ | |||
956 | 1830 | character(len=*), optional, intent(in) :: name | 1718 | character(len=*), optional, intent(in) :: name |
957 | 1831 | character(len=*), optional, intent(in) :: routine | 1719 | character(len=*), optional, intent(in) :: routine |
958 | 1832 | 1720 | ||
996 | 1833 | character(len=32) :: aname, rname | 1721 | character(len=32) :: aname |
997 | 1834 | character(len=1) :: memType, task | 1722 | integer :: bytes |
961 | 1835 | real(DP) :: delta_mem | ||
962 | 1836 | logical :: newPeak | ||
963 | 1837 | logical, save :: header_written = .false. | ||
964 | 1838 | logical, save :: tree_nullified = .false. | ||
965 | 1839 | integer :: memSize | ||
966 | 1840 | |||
967 | 1841 | ! Set routine name | ||
968 | 1842 | if (present(routine)) then | ||
969 | 1843 | rname = routine | ||
970 | 1844 | else | ||
971 | 1845 | rname = DEFAULT%routine | ||
972 | 1846 | end if | ||
973 | 1847 | |||
974 | 1848 | ! Call siesta counting routine 'memory' | ||
975 | 1849 | ! Switched off in Aug.2009, and made 'memory' call alloc_count instead | ||
976 | 1850 | ! if (delta_size > 0) then | ||
977 | 1851 | ! task = 'A' | ||
978 | 1852 | ! else | ||
979 | 1853 | ! task = 'D' | ||
980 | 1854 | ! end if | ||
981 | 1855 | ! select case( type ) | ||
982 | 1856 | ! case ('R') ! Real --> single | ||
983 | 1857 | ! memType = 'S' | ||
984 | 1858 | ! memSize = abs(delta_size) | ||
985 | 1859 | ! case ('S') ! Character (string) --> integer/4 | ||
986 | 1860 | ! memType = 'I' | ||
987 | 1861 | ! memSize = abs(delta_size) / type_mem('I') | ||
988 | 1862 | ! case default | ||
989 | 1863 | ! memType = type | ||
990 | 1864 | ! memSize = abs(delta_size) | ||
991 | 1865 | ! end select | ||
992 | 1866 | ! call memory( task, memType, memSize, trim(rname) ) | ||
993 | 1867 | |||
994 | 1868 | |||
995 | 1869 | if (REPORT_LEVEL <= 0) return | ||
998 | 1870 | 1723 | ||
999 | 1871 | ! Compound routine+array name | 1724 | ! Compound routine+array name |
1000 | 1872 | if (present(name) .and. present(routine)) then | 1725 | if (present(name) .and. present(routine)) then |
1002 | 1873 | aname = trim(routine)//' '//name | 1726 | aname = trim(routine)//'@'//name |
1003 | 1874 | else if (present(name) .and. DEFAULT%routine/=DEFAULT_ROUTINE) then | 1727 | else if (present(name) .and. DEFAULT%routine/=DEFAULT_ROUTINE) then |
1005 | 1875 | aname = trim(DEFAULT%routine)//' '//name | 1728 | aname = trim(DEFAULT%routine)//'@'//name |
1006 | 1876 | else if (present(name)) then | 1729 | else if (present(name)) then |
1008 | 1877 | aname = name | 1730 | aname = trim(DEFAULT_ROUTINE)//'@'//name |
1009 | 1878 | else if (present(routine)) then | 1731 | else if (present(routine)) then |
1011 | 1879 | aname = trim(routine)//' '//DEFAULT_NAME | 1732 | aname = trim(routine)//'@'//DEFAULT_NAME |
1012 | 1880 | else if (DEFAULT%routine/=DEFAULT_ROUTINE) then | 1733 | else if (DEFAULT%routine/=DEFAULT_ROUTINE) then |
1014 | 1881 | aname = trim(DEFAULT%routine)//' '//DEFAULT_NAME | 1734 | aname = trim(DEFAULT%routine)//'@'//DEFAULT_NAME |
1015 | 1882 | else | 1735 | else |
1017 | 1883 | aname = DEFAULT_ROUTINE//' '//DEFAULT_NAME | 1736 | aname = DEFAULT_ROUTINE//'@'//DEFAULT_NAME |
1018 | 1884 | end if | 1737 | end if |
1019 | 1885 | 1738 | ||
1020 | 1886 | MAX_LEN = max( MAX_LEN, len(trim(aname)) ) | ||
1021 | 1887 | |||
1022 | 1888 | ! Find memory increment and total allocated memory | 1739 | ! Find memory increment and total allocated memory |
1075 | 1889 | delta_mem = delta_size * type_mem(type) | 1740 | bytes = delta_size * type_mem(type) |
1076 | 1890 | TOT_MEM = TOT_MEM + delta_mem | 1741 | |
1077 | 1891 | if (TOT_MEM > PEAK_MEM+0.5_dp) then | 1742 | call alloc_memory_event(bytes,trim(aname)) |
1078 | 1892 | newPeak = .true. | 1743 | |
1079 | 1893 | PEAK_MEM = TOT_MEM | 1744 | CONTAINS |
1080 | 1894 | PEAK_ARRAY = aname | 1745 | |
1081 | 1895 | PEAK_ROUTINE = rname | 1746 | INTEGER FUNCTION type_mem( var_type ) |
1030 | 1896 | ! print'(/,a,f18.6),a,/)', | ||
1031 | 1897 | ! 'alloc_count: Memory peak =', PEAK_MEM/MBYTE, ' Mbytes' | ||
1032 | 1898 | else | ||
1033 | 1899 | newPeak = .false. | ||
1034 | 1900 | end if | ||
1035 | 1901 | |||
1036 | 1902 | ! Add/subtract/classify array memory | ||
1037 | 1903 | if (REPORT_LEVEL > 1) then | ||
1038 | 1904 | if (.not.tree_nullified) then | ||
1039 | 1905 | nullify(report_tree) | ||
1040 | 1906 | tree_nullified = .true. | ||
1041 | 1907 | end if | ||
1042 | 1908 | call tree_add( report_tree, aname, delta_mem ) | ||
1043 | 1909 | if (newPeak) call tree_peak( report_tree ) | ||
1044 | 1910 | end if | ||
1045 | 1911 | |||
1046 | 1912 | ! Print report, but only in node 0, as not all | ||
1047 | 1913 | ! processors may follow the same route here | ||
1048 | 1914 | ! The detail/extent of the report increses with the value of level: | ||
1049 | 1915 | ! level=0 : no report at all (the default) | ||
1050 | 1916 | ! level=1 : only total memory peak and where it occurred | ||
1051 | 1917 | ! level=2 : detailed report created but printed only upon request | ||
1052 | 1918 | ! level=3 : detailed report printed at every new memory peak | ||
1053 | 1919 | ! level=4 : print every individual reallocation or deallocation | ||
1054 | 1920 | |||
1055 | 1921 | |||
1056 | 1922 | if (newPeak .and. (REPORT_LEVEL==1 .or. REPORT_LEVEL==3) .and. & | ||
1057 | 1923 | node == 0) then | ||
1058 | 1924 | call print_report(.false.) | ||
1059 | 1925 | end if | ||
1060 | 1926 | |||
1061 | 1927 | if (REPORT_LEVEL == 4 .and. node == 0) then | ||
1062 | 1928 | if (.not.header_written) then | ||
1063 | 1929 | write(REPORT_UNIT,'(/,a7,9x,1x,a4,28x,1x,2a15)') & | ||
1064 | 1930 | 'Routine', 'Name', 'Incr. (MB)', 'Total (MB)' | ||
1065 | 1931 | header_written = .true. | ||
1066 | 1932 | end if | ||
1067 | 1933 | write(REPORT_UNIT,'(a16,1x,a32,1x,2f15.6)') & | ||
1068 | 1934 | rname, aname, delta_mem/MBYTE, TOT_MEM/MBYTE | ||
1069 | 1935 | end if | ||
1070 | 1936 | END SUBROUTINE alloc_count | ||
1071 | 1937 | |||
1072 | 1938 | ! ================================================================== | ||
1073 | 1939 | |||
1074 | 1940 | INTEGER FUNCTION type_mem( var_type ) | ||
1082 | 1941 | ! | 1747 | ! |
1083 | 1942 | ! It is not clear that the sizes assumed are universal for | 1748 | ! It is not clear that the sizes assumed are universal for |
1084 | 1943 | ! non-Cray machines... | 1749 | ! non-Cray machines... |
1085 | @@ -1971,274 +1777,48 @@ | |||
1086 | 1971 | case default | 1777 | case default |
1087 | 1972 | write(message,"(2a)") & | 1778 | write(message,"(2a)") & |
1088 | 1973 | 'alloc_count: ERROR: unknown type = ', var_type | 1779 | 'alloc_count: ERROR: unknown type = ', var_type |
1090 | 1974 | call die(trim(message)) | 1780 | call alloc_error_report(trim(message),0) |
1091 | 1975 | end select | 1781 | end select |
1092 | 1976 | 1782 | ||
1093 | 1977 | END FUNCTION type_mem | 1783 | END FUNCTION type_mem |
1094 | 1978 | 1784 | ||
1359 | 1979 | ! ================================================================== | 1785 | END SUBROUTINE alloc_count |
1096 | 1980 | |||
1097 | 1981 | RECURSIVE SUBROUTINE tree_add( t, name, delta_mem ) | ||
1098 | 1982 | |||
1099 | 1983 | implicit none | ||
1100 | 1984 | type(TREE), pointer :: t | ||
1101 | 1985 | character(len=*), intent(in) :: name | ||
1102 | 1986 | real(DP), intent(in) :: delta_mem | ||
1103 | 1987 | |||
1104 | 1988 | logical, save :: warn_negative = .true. | ||
1105 | 1989 | |||
1106 | 1990 | if (.not.associated(t)) then | ||
1107 | 1991 | allocate( t ) | ||
1108 | 1992 | t%name = name | ||
1109 | 1993 | t%mem = delta_mem | ||
1110 | 1994 | t%max = delta_mem | ||
1111 | 1995 | t%peak = 0._dp | ||
1112 | 1996 | nullify( t%left, t%right ) | ||
1113 | 1997 | else if (name == t%name) then | ||
1114 | 1998 | t%mem = t%mem + delta_mem | ||
1115 | 1999 | ! The abs is to handle the case of apparent de_allocs without re_allocs, | ||
1116 | 2000 | ! caused by routine/name argument mismatches | ||
1117 | 2001 | if (abs(t%mem) > abs(t%max)) t%max = t%mem | ||
1118 | 2002 | else if ( llt(name,t%name) ) then | ||
1119 | 2003 | call tree_add( t%left, name, delta_mem ) | ||
1120 | 2004 | else | ||
1121 | 2005 | call tree_add( t%right, name, delta_mem ) | ||
1122 | 2006 | end if | ||
1123 | 2007 | |||
1124 | 2008 | if (warn_negative .and. t%mem<0._dp) then | ||
1125 | 2009 | call parallel_init() ! Make sure that node and Nodes are initialized | ||
1126 | 2010 | if (Node==0) then | ||
1127 | 2011 | write(6,'(/,a,/,2a,/,a,f18.0,a)') & | ||
1128 | 2012 | 'WARNING: alloc-realloc-dealloc name mismatch', & | ||
1129 | 2013 | ' Name: ', trim(name), & | ||
1130 | 2014 | ' Size: ', t%mem, ' Bytes' | ||
1131 | 2015 | if (Nodes>1) write(6,'(9x,a,i6)') 'Node:', Node | ||
1132 | 2016 | write(6,'(9x,a)') 'Subsequent mismatches will not be reported' | ||
1133 | 2017 | warn_negative = .false. ! Print this warning only once | ||
1134 | 2018 | end if | ||
1135 | 2019 | end if | ||
1136 | 2020 | |||
1137 | 2021 | END SUBROUTINE tree_add | ||
1138 | 2022 | |||
1139 | 2023 | ! ================================================================== | ||
1140 | 2024 | |||
1141 | 2025 | RECURSIVE SUBROUTINE tree_peak( t ) | ||
1142 | 2026 | |||
1143 | 2027 | implicit none | ||
1144 | 2028 | type(TREE), pointer :: t | ||
1145 | 2029 | |||
1146 | 2030 | if (.not.associated(t)) return | ||
1147 | 2031 | |||
1148 | 2032 | t%peak = t%mem | ||
1149 | 2033 | call tree_peak( t%left ) | ||
1150 | 2034 | call tree_peak( t%right ) | ||
1151 | 2035 | |||
1152 | 2036 | END SUBROUTINE tree_peak | ||
1153 | 2037 | |||
1154 | 2038 | ! ================================================================== | ||
1155 | 2039 | |||
1156 | 2040 | RECURSIVE SUBROUTINE tree_print( t ) | ||
1157 | 2041 | |||
1158 | 2042 | implicit none | ||
1159 | 2043 | type(TREE), pointer :: t | ||
1160 | 2044 | |||
1161 | 2045 | if (.not.associated(t)) return | ||
1162 | 2046 | |||
1163 | 2047 | call tree_print( t%left ) | ||
1164 | 2048 | |||
1165 | 2049 | if (abs(t%max) >= REPORT_THRESHOLD) then | ||
1166 | 2050 | write(REPORT_UNIT,'(a,1x,3f15.6,f9.2)') & | ||
1167 | 2051 | t%name(1:MAX_LEN), t%mem/MBYTE, t%max/MBYTE, t%peak/MBYTE, & | ||
1168 | 2052 | 100._dp * t%peak / (PEAK_MEM + tiny(PEAK_MEM) ) | ||
1169 | 2053 | end if | ||
1170 | 2054 | |||
1171 | 2055 | call tree_print( t%right ) | ||
1172 | 2056 | |||
1173 | 2057 | END SUBROUTINE tree_print | ||
1174 | 2058 | |||
1175 | 2059 | ! ================================================================== | ||
1176 | 2060 | |||
1177 | 2061 | SUBROUTINE print_report(all) | ||
1178 | 2062 | |||
1179 | 2063 | implicit none | ||
1180 | 2064 | |||
1181 | 2065 | ! Whether MPI reductions should be performed | ||
1182 | 2066 | ! If, not then ensure that no MPI calls are performed | ||
1183 | 2067 | logical, intent(in), optional :: all | ||
1184 | 2068 | |||
1185 | 2069 | character(len=80) :: string = 'Name' | ||
1186 | 2070 | character :: date*8, time*10, zone*5 | ||
1187 | 2071 | integer :: iNode, peakNode | ||
1188 | 2072 | real(dp) :: maxPeak | ||
1189 | 2073 | real(dp),allocatable:: nodeMem(:), nodePeak(:) | ||
1190 | 2074 | logical :: lall | ||
1191 | 2075 | |||
1192 | 2076 | #ifdef MPI | ||
1193 | 2077 | integer :: MPIerror | ||
1194 | 2078 | #endif | ||
1195 | 2079 | |||
1196 | 2080 | ! Enables parallel call of print-report | ||
1197 | 2081 | lall = .true. | ||
1198 | 2082 | if ( present(all) ) lall = all | ||
1199 | 2083 | |||
1200 | 2084 | ! Only if MPI should all be used | ||
1201 | 2085 | if ( lall ) then | ||
1202 | 2086 | ! Make sure that variables node and Nodes are initialized | ||
1203 | 2087 | call parallel_init() | ||
1204 | 2088 | end if | ||
1205 | 2089 | |||
1206 | 2090 | ! Allocate and initialize two small arrays | ||
1207 | 2091 | allocate( nodeMem(0:Nodes-1), nodePeak(0:Nodes-1) ) | ||
1208 | 2092 | ! initialize (in case all == .false.) | ||
1209 | 2093 | nodeMem = 0._dp | ||
1210 | 2094 | nodePeak = 0._dp | ||
1211 | 2095 | |||
1212 | 2096 | ! Initializations for Nodes=1 (serial case) | ||
1213 | 2097 | nodeMem(node) = TOT_MEM | ||
1214 | 2098 | nodePeak(node) = PEAK_MEM | ||
1215 | 2099 | peakNode = node | ||
1216 | 2100 | |||
1217 | 2101 | ! In parallel, find the memory values of all nodes | ||
1218 | 2102 | #ifdef MPI | ||
1219 | 2103 | if (Nodes > 1 .and. lall ) then | ||
1220 | 2104 | ! Gather the present and peak memories of all nodes | ||
1221 | 2105 | call MPI_AllGather( TOT_MEM, 1, MPI_double_precision, & | ||
1222 | 2106 | nodeMem, 1, MPI_double_precision, & | ||
1223 | 2107 | MPI_COMM_WORLD, MPIerror ) | ||
1224 | 2108 | call MPI_AllGather( PEAK_MEM, 1, MPI_double_precision, & | ||
1225 | 2109 | nodePeak, 1, MPI_double_precision, & | ||
1226 | 2110 | MPI_COMM_WORLD, MPIerror ) | ||
1227 | 2111 | ! Find the node with the highest peak of memory | ||
1228 | 2112 | maxPeak = 0 | ||
1229 | 2113 | do iNode = 0,Nodes-1 | ||
1230 | 2114 | if (nodePeak(iNode) > maxPeak) then | ||
1231 | 2115 | peakNode = iNode | ||
1232 | 2116 | maxPeak = nodePeak(iNode) | ||
1233 | 2117 | end if | ||
1234 | 2118 | end do ! iNode | ||
1235 | 2119 | ! Change the writing node for the peak-node information | ||
1236 | 2120 | if (node==0 .and. peakNode/=0) close( unit=REPORT_UNIT ) | ||
1237 | 2121 | call MPI_Barrier( MPI_COMM_WORLD, MPIerror ) | ||
1238 | 2122 | if (node==peakNode .and. peakNode/=0) & | ||
1239 | 2123 | open( unit=REPORT_UNIT, file=REPORT_FILE, & | ||
1240 | 2124 | status='unknown', position='append' ) | ||
1241 | 2125 | end if ! (Nodes>1) | ||
1242 | 2126 | #endif | ||
1243 | 2127 | |||
1244 | 2128 | ! The report is printed by the highest-peak node | ||
1245 | 2129 | if (node == peakNode) then | ||
1246 | 2130 | |||
1247 | 2131 | ! AG: Commented out to allow multiple batches of information | ||
1248 | 2132 | ! if (REPORT_LEVEL < 4) rewind(REPORT_UNIT) | ||
1249 | 2133 | |||
1250 | 2134 | call date_and_time( date, time, zone ) | ||
1251 | 2135 | |||
1252 | 2136 | write(REPORT_UNIT,'(/,a,16a)') & | ||
1253 | 2137 | 'Allocation summary at ', & | ||
1254 | 2138 | date(1:4),'/',date(5:6),'/',date(7:8),' ', & | ||
1255 | 2139 | time(1:2),':',time(3:4),':',time(5:10),' ', & | ||
1256 | 2140 | zone(1:3),':',zone(4:5) | ||
1257 | 2141 | |||
1258 | 2142 | if (Nodes > 1) then | ||
1259 | 2143 | write(REPORT_UNIT,'(/,(a,f18.6,a))') & | ||
1260 | 2144 | 'Present memory all nodes : ', sum(nodeMem)/MBYTE, ' MB', & | ||
1261 | 2145 | 'Added peak mem all nodes : ', sum(nodePeak)/MBYTE, ' MB', & | ||
1262 | 2146 | 'Min peak memory in a node: ', minval(nodePeak)/MBYTE, ' MB', & | ||
1263 | 2147 | 'Max peak memory in a node: ', maxval(nodePeak)/MBYTE, ' MB' | ||
1264 | 2148 | ! Impractical for many nodes: | ||
1265 | 2149 | ! write(REPORT_UNIT,'(/,a,/,(i6,f12.6))') & | ||
1266 | 2150 | ! 'Memory peaks of individual nodes (Mb):', & | ||
1267 | 2151 | ! (iNode,nodePeak(iNode)/MBYTE,iNode=0,Nodes-1) | ||
1268 | 2152 | write(REPORT_UNIT,'(/,a,i6)') & | ||
1269 | 2153 | 'Maximum peak of memory occurred in node:', peakNode | ||
1270 | 2154 | end if | ||
1271 | 2155 | |||
1272 | 2156 | write(REPORT_UNIT,'(2(/,a,f18.6,a),/,2a,/,2a)') & | ||
1273 | 2157 | 'Present memory allocation: ', TOT_MEM/MBYTE, ' MB', & | ||
1274 | 2158 | 'Maximum memory allocation: ', PEAK_MEM/MBYTE, ' MB', & | ||
1275 | 2159 | 'Occurred after allocating: ', trim(PEAK_ARRAY), & | ||
1276 | 2160 | 'In routine: ', trim(PEAK_ROUTINE) | ||
1277 | 2161 | |||
1278 | 2162 | if (REPORT_LEVEL > 1) then | ||
1279 | 2163 | if (REPORT_THRESHOLD > 0._dp) then | ||
1280 | 2164 | write(REPORT_UNIT,'(/,a,f12.6,a,/,a,1x,3a15,a9)') & | ||
1281 | 2165 | 'Allocated sizes (in MByte) of arrays larger than ', & | ||
1282 | 2166 | REPORT_THRESHOLD/MBYTE, ' MB:', & | ||
1283 | 2167 | string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%' | ||
1284 | 2168 | else | ||
1285 | 2169 | write(REPORT_UNIT,'(/,a,/,a,1x,3a15,a9)') & | ||
1286 | 2170 | 'Allocated array sizes (in MByte):', & | ||
1287 | 2171 | string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%' | ||
1288 | 2172 | end if | ||
1289 | 2173 | call tree_print( report_tree ) | ||
1290 | 2174 | end if | ||
1291 | 2175 | |||
1292 | 2176 | end if ! (node == peakNode) | ||
1293 | 2177 | |||
1294 | 2178 | ! Change again the writing node for the rest of the report | ||
1295 | 2179 | #ifdef MPI | ||
1296 | 2180 | if (node==peakNode .and. peakNode/=0) close( unit=REPORT_UNIT ) | ||
1297 | 2181 | if (lall) call MPI_Barrier( MPI_COMM_WORLD, MPIerror ) | ||
1298 | 2182 | if (node==0 .and. peakNode/=0) & | ||
1299 | 2183 | open( unit=REPORT_UNIT, file=REPORT_FILE, & | ||
1300 | 2184 | status='unknown', position='append' ) | ||
1301 | 2185 | #endif | ||
1302 | 2186 | |||
1303 | 2187 | deallocate( nodeMem, nodePeak ) | ||
1304 | 2188 | |||
1305 | 2189 | END SUBROUTINE print_report | ||
1306 | 2190 | |||
1307 | 2191 | ! ================================================================== | ||
1308 | 2192 | |||
1309 | 2193 | SUBROUTINE alloc_err( ierr, name, routine, bounds ) | ||
1310 | 2194 | #ifdef DEBUG | ||
1311 | 2195 | use debugMpi, only : mpiUnit | ||
1312 | 2196 | #endif | ||
1313 | 2197 | implicit none | ||
1314 | 2198 | |||
1315 | 2199 | integer, intent(in) :: ierr | ||
1316 | 2200 | character(len=*), optional, intent(in) :: name | ||
1317 | 2201 | character(len=*), optional, intent(in) :: routine | ||
1318 | 2202 | integer, dimension(:,:), optional, intent(in) :: bounds | ||
1319 | 2203 | |||
1320 | 2204 | integer i | ||
1321 | 2205 | |||
1322 | 2206 | if (ierr/=0) then | ||
1323 | 2207 | if (ionode) print*, 'alloc_err: allocate status error', ierr | ||
1324 | 2208 | if (present(name).and.present(routine)) then | ||
1325 | 2209 | if (ionode) print*, 'alloc_err: array ', name, & | ||
1326 | 2210 | ' requested by ', routine | ||
1327 | 2211 | elseif (present(name)) then | ||
1328 | 2212 | if (ionode) print*, 'alloc_err: array ', name, & | ||
1329 | 2213 | ' requested by unknown' | ||
1330 | 2214 | elseif (present(routine)) then | ||
1331 | 2215 | if (ionode) print* , 'alloc_err: array unknown', & | ||
1332 | 2216 | ' requested by ', routine | ||
1333 | 2217 | endif | ||
1334 | 2218 | if (ionode.and.present(bounds)) & | ||
1335 | 2219 | print '(a,i3,2i10)', ('alloc_err: dim, lbound, ubound:', & | ||
1336 | 2220 | i,bounds(1,i),bounds(2,i), & | ||
1337 | 2221 | i=1,size(bounds,dim=2)) | ||
1338 | 2222 | #ifdef DEBUG | ||
1339 | 2223 | write(mpiUnit,*) 'alloc_err: allocate status error', ierr | ||
1340 | 2224 | if (present(name).and.present(routine)) then | ||
1341 | 2225 | write(mpiUnit,*) 'alloc_err: array ', name, ' requested by ', routine | ||
1342 | 2226 | elseif (present(name)) then | ||
1343 | 2227 | write(mpiUnit,*) 'alloc_err: array ', name, ' requested by unknown' | ||
1344 | 2228 | elseif (present(routine)) then | ||
1345 | 2229 | write(mpiUnit,*) 'alloc_err: array unknown requested by ', routine | ||
1346 | 2230 | endif | ||
1347 | 2231 | write(mpiUnit,'(a,i3,2i10)') ('alloc_err: dim, lbound, ubound:', & | ||
1348 | 2232 | i,bounds(1,i),bounds(2,i), & | ||
1349 | 2233 | i=1,size(bounds,dim=2)) | ||
1350 | 2234 | call pxfflush(mpiUnit) | ||
1351 | 2235 | #endif | ||
1352 | 2236 | |||
1353 | 2237 | call die('alloc_err: allocate error') | ||
1354 | 2238 | end if | ||
1355 | 2239 | |||
1356 | 2240 | END SUBROUTINE alloc_err | ||
1357 | 2241 | |||
1358 | 2242 | ! ================================================================== | ||
1360 | 2243 | 1786 | ||
1361 | 2244 | END MODULE alloc | 1787 | END MODULE alloc |
1362 | 1788 | |||
1363 | 1789 | #ifdef __TEST__MODULE__ALLOC__ | ||
1364 | 1790 | ! Optional test code | ||
1365 | 1791 | ! | ||
1366 | 1792 | program testalloc | ||
1367 | 1793 | use alloc, only: re_alloc, de_alloc | ||
1368 | 1794 | |||
1369 | 1795 | real, pointer :: x(:) => null() | ||
1370 | 1796 | real(kind=kind(1.d0)), pointer :: y(:,:) => null() | ||
1371 | 1797 | |||
1372 | 1798 | call re_alloc(x,1,10,"x","testalloc") | ||
1373 | 1799 | call re_alloc(y,-3,4,1,3,"y","testalloc") | ||
1374 | 1800 | print *, "Shape of x: ", shape(x) | ||
1375 | 1801 | print *, "Shape of y: ", shape(y) | ||
1376 | 1802 | call de_alloc(x,"x","testalloc") | ||
1377 | 1803 | call de_alloc(y,"y","testalloc") | ||
1378 | 1804 | |||
1379 | 1805 | end program testalloc | ||
1380 | 1806 | ! | ||
1381 | 1807 | ! Handlers | ||
1382 | 1808 | ! Note: In systems with weak symbols, these handlers | ||
1383 | 1809 | ! could be compiled marked as such. (Future extension) | ||
1384 | 1810 | ! | ||
1385 | 1811 | subroutine alloc_memory_event(bytes,name) | ||
1386 | 1812 | integer, intent(in) :: bytes | ||
1387 | 1813 | character(len=*), intent(in) :: name | ||
1388 | 1814 | write(*,*) "alloc: allocated ", bytes, "bytes for "//trim(name) | ||
1389 | 1815 | end subroutine alloc_memory_event | ||
1390 | 1816 | |||
1391 | 1817 | subroutine alloc_error_report(name,code) | ||
1392 | 1818 | character(len=*), intent(in) :: name | ||
1393 | 1819 | integer, intent(in) :: code | ||
1394 | 1820 | write(*,*) "alloc error: "//trim(name) | ||
1395 | 1821 | end subroutine alloc_error_report | ||
1396 | 1822 | |||
1397 | 1823 | #endif | ||
1398 | 1824 | |||
1399 | 2245 | 1825 | ||
1400 | === added file 'Src/alloc_error_report.F' | |||
1401 | --- Src/alloc_error_report.F 1970-01-01 00:00:00 +0000 | |||
1402 | +++ Src/alloc_error_report.F 2016-07-19 08:21:24 +0000 | |||
1403 | @@ -0,0 +1,55 @@ | |||
1404 | 1 | !-------------------------------------------------- | ||
1405 | 2 | ! Stand-alone routine to capture error messages from | ||
1406 | 3 | ! the alloc module | ||
1407 | 4 | ! | ||
1408 | 5 | ! This functionality could be made more general, | ||
1409 | 6 | ! and use a uniform interface for all the utility | ||
1410 | 7 | ! modules developed in-house. (Let's say, call it | ||
1411 | 8 | ! 'error_report' with severity arguments, etc). | ||
1412 | 9 | ! | ||
1413 | 10 | ! Each program using the alloc module needs to | ||
1414 | 11 | ! provide a routine with the proper interface, but | ||
1415 | 12 | ! accomodating the needs and conventions of the program. | ||
1416 | 13 | ! For example, in Siesta: | ||
1417 | 14 | ! | ||
1418 | 15 | ! - The tagging of the message by Node. | ||
1419 | 16 | ! - The use of 'unit 6' as output and '0' as error. | ||
1420 | 17 | ! | ||
1421 | 18 | ! Routines using this functionality should include | ||
1422 | 19 | ! the following | ||
1423 | 20 | ! | ||
1424 | 21 | ! subroutine alloc_error_report(str,code) | ||
1425 | 22 | ! character(len=*), intent(in) :: str | ||
1426 | 23 | ! integer, intent(in) :: code | ||
1427 | 24 | ! end subroutine alloc_error_report | ||
1428 | 25 | ! | ||
1429 | 26 | !------------------------------------------------------ | ||
1430 | 27 | |||
1431 | 28 | subroutine alloc_error_report(str,code) | ||
1432 | 29 | |||
1433 | 30 | use parallel, only : Node | ||
1434 | 31 | |||
1435 | 32 | character(len=*), intent(in) :: str | ||
1436 | 33 | integer, intent(in) :: code | ||
1437 | 34 | |||
1438 | 35 | ! Even though formally (in MPI 1.X), only the master node | ||
1439 | 36 | ! can do I/O, in those systems that allow it having each | ||
1440 | 37 | ! node state its complaint can be useful. | ||
1441 | 38 | |||
1442 | 39 | write(6,'(a,i0,1x,a)') 'Node: ', Node, trim(str) | ||
1443 | 40 | write(0,'(a,i0,1x,a)') 'Node: ', Node, trim(str) | ||
1444 | 41 | |||
1445 | 42 | ! The convention for this reporter, which can | ||
1446 | 43 | ! send multi-call messages, is that code=0 | ||
1447 | 44 | ! signals the end of the series | ||
1448 | 45 | ! We choose to kill the program | ||
1449 | 46 | ! | ||
1450 | 47 | ! This is actually too stringent, as a given failed | ||
1451 | 48 | ! allocation could be handled more gracefully at | ||
1452 | 49 | ! the point at which it is made. But in absence of | ||
1453 | 50 | ! a 'stat' argument for the re_alloc and de_alloc | ||
1454 | 51 | ! routines, this is the only thing we can do.... | ||
1455 | 52 | ! | ||
1456 | 53 | if (code == 0) call die(str) | ||
1457 | 54 | |||
1458 | 55 | end subroutine alloc_error_report | ||
1459 | 0 | 56 | ||
1460 | === added file 'Src/alloc_memory_event.F' | |||
1461 | --- Src/alloc_memory_event.F 1970-01-01 00:00:00 +0000 | |||
1462 | +++ Src/alloc_memory_event.F 2016-07-19 08:21:24 +0000 | |||
1463 | @@ -0,0 +1,30 @@ | |||
1464 | 1 | !-------------------------------------------------- | ||
1465 | 2 | ! Stand-alone routine to capture memory events from | ||
1466 | 3 | ! the alloc module | ||
1467 | 4 | ! | ||
1468 | 5 | ! Each program using the alloc module needs to | ||
1469 | 6 | ! provide a routine with the proper interface, but | ||
1470 | 7 | ! accomodating the needs and conventions of the program. | ||
1471 | 8 | ! For example, in Siesta | ||
1472 | 9 | ! | ||
1473 | 10 | ! - The use of the memory_log module for reports | ||
1474 | 11 | ! | ||
1475 | 12 | ! Routines using this functionality should include | ||
1476 | 13 | ! the following | ||
1477 | 14 | ! | ||
1478 | 15 | ! subroutine alloc_memory_event(str,code) | ||
1479 | 16 | ! character(len=*), intent(in) :: str | ||
1480 | 17 | ! integer, intent(in) :: code | ||
1481 | 18 | ! end subroutine alloc_memory_event | ||
1482 | 19 | ! | ||
1483 | 20 | !------------------------------------------------------ | ||
1484 | 21 | |||
1485 | 22 | subroutine alloc_memory_event(bytes,name) | ||
1486 | 23 | use memory_log, only: memory_event | ||
1487 | 24 | |||
1488 | 25 | integer, intent(in) :: bytes | ||
1489 | 26 | character(len=*), intent(in) :: name | ||
1490 | 27 | |||
1491 | 28 | call memory_event(bytes,name) | ||
1492 | 29 | |||
1493 | 30 | end subroutine alloc_memory_event | ||
1494 | 0 | 31 | ||
1495 | === modified file 'Src/atom.F' | |||
1496 | --- Src/atom.F 2016-07-12 13:38:13 +0000 | |||
1497 | +++ Src/atom.F 2016-07-19 08:21:24 +0000 | |||
1498 | @@ -48,8 +48,8 @@ | |||
1499 | 48 | use fdf | 48 | use fdf |
1500 | 49 | use m_ncps, only: pseudopotential_t => froyen_ps_t | 49 | use m_ncps, only: pseudopotential_t => froyen_ps_t |
1501 | 50 | #ifndef BSC_CELLXC | 50 | #ifndef BSC_CELLXC |
1504 | 51 | use siestaXC, only: atomXC ! XC for a spherical charge | 51 | use gridXC, only: atomXC=>gridxc_atomXC ! XC for a spherical charge |
1505 | 52 | use siestaXC, only: getXC ! Returns the XC functional to be used | 52 | use gridXC, only: getXC=>gridxc_getXC ! Returns the XC functional to be used |
1506 | 53 | #endif /* ! BSC_CELLXC */ | 53 | #endif /* ! BSC_CELLXC */ |
1507 | 54 | 54 | ||
1508 | 55 | implicit none | 55 | implicit none |
1509 | 56 | 56 | ||
1510 | === modified file 'Src/broyden_optim.F' | |||
1511 | --- Src/broyden_optim.F 2016-01-25 16:00:16 +0000 | |||
1512 | +++ Src/broyden_optim.F 2016-07-19 08:21:24 +0000 | |||
1513 | @@ -68,7 +68,7 @@ | |||
1514 | 68 | $ broyden_destroy, broyden_init, | 68 | $ broyden_destroy, broyden_init, |
1515 | 69 | $ broyden_is_setup | 69 | $ broyden_is_setup |
1516 | 70 | 70 | ||
1518 | 71 | use m_memory, only: memory, mem_stat | 71 | use memory_log, only: memory, mem_stat |
1519 | 72 | use parallel, only : ionode | 72 | use parallel, only : ionode |
1520 | 73 | 73 | ||
1521 | 74 | ! Subroutine arguments: | 74 | ! Subroutine arguments: |
1522 | 75 | 75 | ||
1523 | === modified file 'Src/cell_fire_optim.F' | |||
1524 | --- Src/cell_fire_optim.F 2016-01-25 16:00:16 +0000 | |||
1525 | +++ Src/cell_fire_optim.F 2016-07-19 08:21:24 +0000 | |||
1526 | @@ -18,7 +18,7 @@ | |||
1527 | 18 | use m_fire | 18 | use m_fire |
1528 | 19 | use siesta_options, only: dt | 19 | use siesta_options, only: dt |
1529 | 20 | 20 | ||
1531 | 21 | use m_memory, only: memory, mem_stat | 21 | use memory_log, only: memory, mem_stat |
1532 | 22 | use parallel, only : ionode | 22 | use parallel, only : ionode |
1533 | 23 | 23 | ||
1534 | 24 | implicit none | 24 | implicit none |
1535 | 25 | 25 | ||
1536 | === modified file 'Src/cellxc_mod.F' | |||
1537 | --- Src/cellxc_mod.F 2016-01-25 16:00:16 +0000 | |||
1538 | +++ Src/cellxc_mod.F 2016-07-19 08:21:24 +0000 | |||
1539 | @@ -12,7 +12,7 @@ | |||
1540 | 12 | CONTAINS | 12 | CONTAINS |
1541 | 13 | subroutine setGGA( ) | 13 | subroutine setGGA( ) |
1542 | 14 | #ifndef BSC_CELLXC | 14 | #ifndef BSC_CELLXC |
1544 | 15 | use siestaXC, only : getXC ! Returns the XC functional used | 15 | use gridXC, only : gridxc_getXC ! Returns the XC functional used |
1545 | 16 | #else /* BSC_CELLXC */ | 16 | #else /* BSC_CELLXC */ |
1546 | 17 | use bsc_xcmod, only : nXCfunc, XCfunc | 17 | use bsc_xcmod, only : nXCfunc, XCfunc |
1547 | 18 | #endif /* BSC_CELLXC */ | 18 | #endif /* BSC_CELLXC */ |
1548 | @@ -28,7 +28,7 @@ | |||
1549 | 28 | 28 | ||
1550 | 29 | !---------------------------------------------------------------------- BEGIN | 29 | !---------------------------------------------------------------------- BEGIN |
1551 | 30 | #ifndef BSC_CELLXC | 30 | #ifndef BSC_CELLXC |
1553 | 31 | call getXC( nXCfunc, XCfunc, XCauth ) | 31 | call gridxc_getXC( nXCfunc, XCfunc, XCauth ) |
1554 | 32 | #endif /* ! BSC_CELLXC */ | 32 | #endif /* ! BSC_CELLXC */ |
1555 | 33 | do nf = 1,nXCfunc | 33 | do nf = 1,nXCfunc |
1556 | 34 | if ( XCfunc(nf).eq.'GGA' .or. XCfunc(nf).eq.'gga') then | 34 | if ( XCfunc(nf).eq.'GGA' .or. XCfunc(nf).eq.'gga') then |
1557 | 35 | 35 | ||
1558 | === modified file 'Src/dhscf.F' | |||
1559 | --- Src/dhscf.F 2016-01-25 16:00:16 +0000 | |||
1560 | +++ Src/dhscf.F 2016-07-19 08:21:24 +0000 | |||
1561 | @@ -64,7 +64,7 @@ | |||
1562 | 64 | use mesh, only : xdsp, nsm, nsp | 64 | use mesh, only : xdsp, nsm, nsp |
1563 | 65 | use parsing | 65 | use parsing |
1564 | 66 | #ifndef BSC_CELLXC | 66 | #ifndef BSC_CELLXC |
1566 | 67 | use siestaXC, only : getXC ! Returns the XC functional used | 67 | use gridXC, only : getXC=>gridxc_getXC ! Returns the XC functional used |
1567 | 68 | #else /* BSC_CELLXC */ | 68 | #else /* BSC_CELLXC */ |
1568 | 69 | use bsc_xcmod, only : nXCfunc, XCauth | 69 | use bsc_xcmod, only : nXCfunc, XCauth |
1569 | 70 | #endif /* BSC_CELLXC */ | 70 | #endif /* BSC_CELLXC */ |
1570 | @@ -546,9 +546,9 @@ | |||
1571 | 546 | use m_partial_charges, only: want_partial_charges | 546 | use m_partial_charges, only: want_partial_charges |
1572 | 547 | #ifndef BSC_CELLXC | 547 | #ifndef BSC_CELLXC |
1573 | 548 | 548 | ||
1577 | 549 | use siestaXC, only : cellXC ! Finds xc energy and potential | 549 | use gridXC, only : cellXC=>gridxc_cellXC ! Finds xc energy and potential |
1578 | 550 | use siestaXC, only : myMeshBox ! Returns my processor mesh box | 550 | use gridXC, only : myMeshBox ! Returns my processor mesh box |
1579 | 551 | use siestaXC, only : jms_setMeshDistr => setMeshDistr | 551 | use gridXC, only : jms_setMeshDistr => setMeshDistr |
1580 | 552 | ! Sets a distribution of mesh | 552 | ! Sets a distribution of mesh |
1581 | 553 | ! points over parallel processors | 553 | ! points over parallel processors |
1582 | 554 | #endif /* BSC_CELLXC */ | 554 | #endif /* BSC_CELLXC */ |
1583 | 555 | 555 | ||
1584 | === renamed file 'Src/memoryinfo.F' => 'Src/diagmemory.F' | |||
1585 | --- Src/memoryinfo.F 2016-01-25 16:00:16 +0000 | |||
1586 | +++ Src/diagmemory.F 2016-07-19 08:21:24 +0000 | |||
1587 | @@ -5,51 +5,6 @@ | |||
1588 | 5 | ! or http://www.gnu.org/copyleft/gpl.txt. | 5 | ! or http://www.gnu.org/copyleft/gpl.txt. |
1589 | 6 | ! See Docs/Contributors.txt for a list of contributors. | 6 | ! See Docs/Contributors.txt for a list of contributors. |
1590 | 7 | ! | 7 | ! |
1591 | 8 | module memoryinfo | ||
1592 | 9 | |||
1593 | 10 | C | ||
1594 | 11 | C WordsInteger = number of words of memory for integer variables | ||
1595 | 12 | C WordsSP = number of words of memory for single precision variables | ||
1596 | 13 | C WordsDP = number of words of memory for double precision variables | ||
1597 | 14 | C WordsLogical = number of words of memory for logical variables | ||
1598 | 15 | C WordsSC = number of words of memory for single complex variables | ||
1599 | 16 | C WordsDC = number of words of memory for double complex variables | ||
1600 | 17 | C PeakMemory = maximum amount of dynamic memory used | ||
1601 | 18 | C PeakRoutine = routine name where memory peak was reached | ||
1602 | 19 | C ByteSize = array of values specifying the size of a word for | ||
1603 | 20 | C each data type | ||
1604 | 21 | C | ||
1605 | 22 | implicit none | ||
1606 | 23 | |||
1607 | 24 | integer*8, save :: | ||
1608 | 25 | . WordsInteger, WordsSP, WordsDP, WordsLogical, WordsSC, WordsDC, | ||
1609 | 26 | . WordsString, WordsLongInt, | ||
1610 | 27 | . PeakMemory, CurrentMemory | ||
1611 | 28 | |||
1612 | 29 | character(len=30), save :: | ||
1613 | 30 | . PeakRoutine | ||
1614 | 31 | |||
1615 | 32 | data | ||
1616 | 33 | . WordsInteger / 0 /, | ||
1617 | 34 | . WordsSP / 0 /, | ||
1618 | 35 | . WordsDP / 0 /, | ||
1619 | 36 | . WordsLogical / 0 /, | ||
1620 | 37 | . WordsSC / 0 /, | ||
1621 | 38 | . WordsDC / 0 /, | ||
1622 | 39 | . WordsString / 0 /, | ||
1623 | 40 | . WordsLongInt / 0 /, | ||
1624 | 41 | . PeakMemory / 0 /, | ||
1625 | 42 | . CurrentMemory / 0 / | ||
1626 | 43 | |||
1627 | 44 | integer, parameter, dimension(8) :: ByteSize = | ||
1628 | 45 | #ifdef OLD_CRAY | ||
1629 | 46 | . (/8,8,8,8,8,16,8,8/) | ||
1630 | 47 | #else | ||
1631 | 48 | . (/4,4,8,4,8,16,4,8/) | ||
1632 | 49 | #endif | ||
1633 | 50 | |||
1634 | 51 | end module memoryinfo | ||
1635 | 52 | |||
1636 | 53 | module diagmemory | 8 | module diagmemory |
1637 | 54 | C | 9 | C |
1638 | 55 | C Stores the factor used to scale the default memory in rdiag/cdiag | 10 | C Stores the factor used to scale the default memory in rdiag/cdiag |
1639 | 56 | 11 | ||
1640 | === modified file 'Src/diagon.F' | |||
1641 | --- Src/diagon.F 2016-01-25 16:00:16 +0000 | |||
1642 | +++ Src/diagon.F 2016-07-19 08:21:24 +0000 | |||
1643 | @@ -98,7 +98,7 @@ | |||
1644 | 98 | use m_diagon, only : qspiral, spiral, frstme | 98 | use m_diagon, only : qspiral, spiral, frstme |
1645 | 99 | use fdf | 99 | use fdf |
1646 | 100 | use alloc | 100 | use alloc |
1648 | 101 | use m_memory | 101 | use memory_log |
1649 | 102 | #ifdef MPI | 102 | #ifdef MPI |
1650 | 103 | use m_diagon, only : paralleloverk | 103 | use m_diagon, only : paralleloverk |
1651 | 104 | use mpi_siesta, only : mpi_bcast, mpi_comm_world, | 104 | use mpi_siesta, only : mpi_bcast, mpi_comm_world, |
1652 | 105 | 105 | ||
1653 | === modified file 'Src/fft.F' | |||
1654 | --- Src/fft.F 2016-01-25 16:00:16 +0000 | |||
1655 | +++ Src/fft.F 2016-07-19 08:21:24 +0000 | |||
1656 | @@ -53,8 +53,8 @@ | |||
1657 | 53 | use sys, only : die | 53 | use sys, only : die |
1658 | 54 | use alloc, only : re_alloc, de_alloc | 54 | use alloc, only : re_alloc, de_alloc |
1659 | 55 | use mesh, only : nsm | 55 | use mesh, only : nsm |
1662 | 56 | use fft1d, only : gpfa ! 1-D FFT routine | 56 | use m_fft_gpfa, only : gpfa ! 1-D FFT routine |
1663 | 57 | use fft1d, only : setgpfa ! Sets gpfa routine | 57 | use m_fft_gpfa, only : setgpfa=>setgpfa_check ! Sets gpfa routine |
1664 | 58 | use m_timer, only : timer_start ! Start counting CPU time | 58 | use m_timer, only : timer_start ! Start counting CPU time |
1665 | 59 | use m_timer, only : timer_stop ! Stop counting CPU time | 59 | use m_timer, only : timer_stop ! Stop counting CPU time |
1666 | 60 | #ifdef MPI | 60 | #ifdef MPI |
1667 | 61 | 61 | ||
1668 | === modified file 'Src/forhar.F' | |||
1669 | --- Src/forhar.F 2016-01-25 16:00:16 +0000 | |||
1670 | +++ Src/forhar.F 2016-07-19 08:21:24 +0000 | |||
1671 | @@ -11,9 +11,9 @@ | |||
1672 | 11 | #ifndef BSC_CELLXC | 11 | #ifndef BSC_CELLXC |
1673 | 12 | use parallel, only : ProcessorY | 12 | use parallel, only : ProcessorY |
1674 | 13 | use mesh, only : NSM | 13 | use mesh, only : NSM |
1678 | 14 | use siestaXC, only : cellXC ! Finds xc energy and potential | 14 | use gridXC, only : cellXC=>gridxc_cellXC ! Finds xc energy and potential |
1679 | 15 | use siestaXC, only : myMeshBox ! Returns my processor mesh box | 15 | use gridXC, only : myMeshBox ! Returns my processor mesh box |
1680 | 16 | use siestaXC, only : jms_setMeshDistr => setMeshDistr | 16 | use gridXC , only : jms_setMeshDistr => setMeshDistr |
1681 | 17 | ! Sets a distribution of mesh | 17 | ! Sets a distribution of mesh |
1682 | 18 | ! points over parallel processors | 18 | ! points over parallel processors |
1683 | 19 | 19 | ||
1684 | 20 | 20 | ||
1685 | === modified file 'Src/ldau_specs.f' | |||
1686 | --- Src/ldau_specs.f 2016-06-29 04:22:46 +0000 | |||
1687 | +++ Src/ldau_specs.f 2016-07-19 08:21:24 +0000 | |||
1688 | @@ -658,8 +658,8 @@ | |||
1689 | 658 | use basis_specs, only : restricted_grid | 658 | use basis_specs, only : restricted_grid |
1690 | 659 | use basis_specs, only : rmax_radial_grid | 659 | use basis_specs, only : rmax_radial_grid |
1691 | 660 | 660 | ||
1694 | 661 | use siestaXC, only : setXC | 661 | use gridXC, only : setXC=>gridxc_setXC |
1695 | 662 | use siestaXC, only : atomXC | 662 | use gridXC, only : atomXC=>gridxc_atomXC |
1696 | 663 | 663 | ||
1697 | 664 | integer, intent(in) :: isp ! Species index | 664 | integer, intent(in) :: isp ! Species index |
1698 | 665 | 665 | ||
1699 | 666 | 666 | ||
1700 | === removed file 'Src/m_memory.F' | |||
1701 | --- Src/m_memory.F 2016-01-25 16:00:16 +0000 | |||
1702 | +++ Src/m_memory.F 1970-01-01 00:00:00 +0000 | |||
1703 | @@ -1,134 +0,0 @@ | |||
1704 | 1 | ! | ||
1705 | 2 | ! Copyright (C) 1996-2016 The SIESTA group | ||
1706 | 3 | ! This file is distributed under the terms of the | ||
1707 | 4 | ! GNU General Public License: see COPYING in the top directory | ||
1708 | 5 | ! or http://www.gnu.org/copyleft/gpl.txt. | ||
1709 | 6 | ! See Docs/Contributors.txt for a list of contributors. | ||
1710 | 7 | ! | ||
1711 | 8 | module m_memory | ||
1712 | 9 | |||
1713 | 10 | integer, public :: mem_stat ! For use in calls to allocate | ||
1714 | 11 | ! and deallocate | ||
1715 | 12 | |||
1716 | 13 | public :: memory | ||
1717 | 14 | private | ||
1718 | 15 | |||
1719 | 16 | CONTAINS | ||
1720 | 17 | |||
1721 | 18 | subroutine memory( Task, Type, NElements, CallingRoutine, | ||
1722 | 19 | $ stat,id) | ||
1723 | 20 | C | ||
1724 | 21 | C This subroutine keeps track of information relating to the use | ||
1725 | 22 | C of dynamic memory | ||
1726 | 23 | C | ||
1727 | 24 | C Input : | ||
1728 | 25 | C | ||
1729 | 26 | C character*1 Task : job type = 'A' -> allocate | ||
1730 | 27 | C : 'D' -> deallocate | ||
1731 | 28 | C character*1 Type : type of variable = 'I' = integer | ||
1732 | 29 | C : 'S' = single precision real | ||
1733 | 30 | C : 'D' = double precision real | ||
1734 | 31 | C : 'X' = grid precision real | ||
1735 | 32 | C : 'L' = logical | ||
1736 | 33 | C : 'C' = single precision complex | ||
1737 | 34 | C : 'Z' = double precision complex | ||
1738 | 35 | C : 'S' = character data (we assume takes one word) | ||
1739 | 36 | C : 'E' = double precision integer | ||
1740 | 37 | C integer NElements : number of array elements being | ||
1741 | 38 | C : allocated/deallocated | ||
1742 | 39 | C character : | ||
1743 | 40 | C CallingRoutine : string containing the name of the calling routine | ||
1744 | 41 | C | ||
1745 | 42 | C Created by J.D. Gale, October 1999 | ||
1746 | 43 | C | ||
1747 | 44 | C Stat and ID keyword arguments added by Alberto Garcia, 2005 | ||
1748 | 45 | |||
1749 | 46 | use memoryinfo | ||
1750 | 47 | use sys, only: die | ||
1751 | 48 | use parallel, only: Node | ||
1752 | 49 | |||
1753 | 50 | implicit none | ||
1754 | 51 | |||
1755 | 52 | integer, intent(in) :: NElements | ||
1756 | 53 | character(len=1), intent(in) :: Task, Type | ||
1757 | 54 | character(len=*), intent(in) :: CallingRoutine | ||
1758 | 55 | integer, intent(in), optional :: stat | ||
1759 | 56 | character(len=*), intent(in), optional :: id | ||
1760 | 57 | |||
1761 | 58 | C Local variables | ||
1762 | 59 | integer Sign | ||
1763 | 60 | C | ||
1764 | 61 | C CAG | ||
1765 | 62 | C if (Node.eq.0) then | ||
1766 | 63 | C write(66,'(a,a,a,a,i10)') "---memory: ", CallingRoutine // " ", | ||
1767 | 64 | C $ task // " ", | ||
1768 | 65 | C $ type // " ", nelements | ||
1769 | 66 | C call flush(66) | ||
1770 | 67 | C endif | ||
1771 | 68 | if (present(stat)) then | ||
1772 | 69 | if (stat .ne. 0) then | ||
1773 | 70 | if (present(id)) then | ||
1774 | 71 | call die(Task // "-llocation failed in " // | ||
1775 | 72 | $ CallingRoutine // id) | ||
1776 | 73 | else | ||
1777 | 74 | call die(Task // "-llocation failed in " // | ||
1778 | 75 | $ CallingRoutine) | ||
1779 | 76 | endif | ||
1780 | 77 | endif | ||
1781 | 78 | endif | ||
1782 | 79 | |||
1783 | 80 | C Assign sign of operation based on task | ||
1784 | 81 | if (Task .eq. 'A' .or. Task .eq. 'a') then | ||
1785 | 82 | Sign = +1 | ||
1786 | 83 | else | ||
1787 | 84 | Sign = -1 | ||
1788 | 85 | endif | ||
1789 | 86 | |||
1790 | 87 | C Add number of elements to appropriate pointer | ||
1791 | 88 | if (Type .eq. 'I' .or. Type .eq. 'i') then | ||
1792 | 89 | WordsInteger = WordsInteger + Sign*NElements | ||
1793 | 90 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(1) | ||
1794 | 91 | elseif (Type .eq. 'S' .or. Type .eq. 's') then | ||
1795 | 92 | WordsSP = WordsSP + Sign*NElements | ||
1796 | 93 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2) | ||
1797 | 94 | elseif (Type .eq. 'D' .or. Type .eq. 'd') then | ||
1798 | 95 | WordsDP = WordsDP + Sign*NElements | ||
1799 | 96 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3) | ||
1800 | 97 | ! | ||
1801 | 98 | ! Support for flexible precision in grid-related arrays | ||
1802 | 99 | ! | ||
1803 | 100 | elseif (Type .eq. 'X' .or. Type .eq. 'x') then | ||
1804 | 101 | #ifdef GRID_DP | ||
1805 | 102 | WordsDP = WordsDP + Sign*NElements | ||
1806 | 103 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3) | ||
1807 | 104 | #else | ||
1808 | 105 | WordsSP = WordsSP + Sign*NElements | ||
1809 | 106 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2) | ||
1810 | 107 | #endif | ||
1811 | 108 | |||
1812 | 109 | elseif (Type .eq. 'L' .or. Type .eq. 'l') then | ||
1813 | 110 | WordsLogical = WordsLogical + Sign*NElements | ||
1814 | 111 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(4) | ||
1815 | 112 | elseif (Type .eq. 'C' .or. Type .eq. 'c') then | ||
1816 | 113 | WordsSC = WordsSC + Sign*NElements | ||
1817 | 114 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(5) | ||
1818 | 115 | elseif (Type .eq. 'Z' .or. Type .eq. 'z') then | ||
1819 | 116 | WordsDC = WordsDC + Sign*NElements | ||
1820 | 117 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(6) | ||
1821 | 118 | elseif (Type .eq. 'S' .or. Type .eq. 's') then | ||
1822 | 119 | WordsString = WordsString + Sign*NElements | ||
1823 | 120 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(7) | ||
1824 | 121 | elseif (Type .eq. 'E' .or. Type .eq. 'e') then | ||
1825 | 122 | WordsLongInt = WordsLongInt + Sign*NElements | ||
1826 | 123 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(8) | ||
1827 | 124 | endif | ||
1828 | 125 | |||
1829 | 126 | C Check whether memory is greater than peak memory so far | ||
1830 | 127 | if (CurrentMemory .gt. PeakMemory) then | ||
1831 | 128 | PeakMemory = CurrentMemory | ||
1832 | 129 | PeakRoutine = CallingRoutine | ||
1833 | 130 | endif | ||
1834 | 131 | |||
1835 | 132 | end subroutine memory | ||
1836 | 133 | |||
1837 | 134 | end module m_memory | ||
1838 | 135 | 0 | ||
1839 | === modified file 'Src/m_timer.F90' | |||
1840 | --- Src/m_timer.F90 2016-01-25 16:00:16 +0000 | |||
1841 | +++ Src/m_timer.F90 2016-07-19 08:21:24 +0000 | |||
1842 | @@ -12,6 +12,10 @@ | |||
1843 | 12 | ! Provides utility routines for CPU timing | 12 | ! Provides utility routines for CPU timing |
1844 | 13 | ! Written by J.M.Soler. July 2009 | 13 | ! Written by J.M.Soler. July 2009 |
1845 | 14 | !=============================================================================== | 14 | !=============================================================================== |
1846 | 15 | |||
1847 | 16 | ! The user must provide an external function 'use_walltime_in_timer' | ||
1848 | 17 | ! with the interface specified below to set the value of 'use_walltime' | ||
1849 | 18 | ! | ||
1850 | 15 | ! Used MPI routines and parameters | 19 | ! Used MPI routines and parameters |
1851 | 16 | ! use mpi_siesta, only: MPI_AllGather | 20 | ! use mpi_siesta, only: MPI_AllGather |
1852 | 17 | ! use mpi_siesta, only: MPI_Bcast | 21 | ! use mpi_siesta, only: MPI_Bcast |
1853 | @@ -97,6 +101,7 @@ | |||
1854 | 97 | ! ALGORITHMS: | 101 | ! ALGORITHMS: |
1855 | 98 | ! Calls intrinsic routine cpu_time and stores the present time, associated | 102 | ! Calls intrinsic routine cpu_time and stores the present time, associated |
1856 | 99 | ! to the prog name, for future use by timer_stop | 103 | ! to the prog name, for future use by timer_stop |
1857 | 104 | ! If use_walltime is .true., it uses wall_time instead | ||
1858 | 100 | !=============================================================================== | 105 | !=============================================================================== |
1859 | 101 | ! SUBROUTINE timer_stop( prog ) | 106 | ! SUBROUTINE timer_stop( prog ) |
1860 | 102 | ! Stops counting time for a program or code section | 107 | ! Stops counting time for a program or code section |
1861 | @@ -226,6 +231,12 @@ | |||
1862 | 226 | 231 | ||
1863 | 227 | PRIVATE ! Nothing is declared public beyond this point | 232 | PRIVATE ! Nothing is declared public beyond this point |
1864 | 228 | 233 | ||
1865 | 234 | interface | ||
1866 | 235 | function use_walltime_in_timer() result(use_walltime) | ||
1867 | 236 | logical :: use_walltime | ||
1868 | 237 | end function use_walltime_in_timer | ||
1869 | 238 | end interface | ||
1870 | 239 | |||
1871 | 229 | ! Parameters | 240 | ! Parameters |
1872 | 230 | character(len=*),parameter:: myName = 'timer ' | 241 | character(len=*),parameter:: myName = 'timer ' |
1873 | 231 | character(len=*),parameter:: errHead = myName//'ERROR: ' | 242 | character(len=*),parameter:: errHead = myName//'ERROR: ' |
1874 | @@ -246,6 +257,7 @@ | |||
1875 | 246 | end type times_t | 257 | end type times_t |
1876 | 247 | 258 | ||
1877 | 248 | ! Module variables and arrays | 259 | ! Module variables and arrays |
1878 | 260 | logical, save :: use_walltime ! wall-time or cpu-time? | ||
1879 | 249 | real(dp),save :: minRepTime = 0.0_dp ! Min reported CPU time fraction | 261 | real(dp),save :: minRepTime = 0.0_dp ! Min reported CPU time fraction |
1880 | 250 | integer, save :: nProgs=0 ! Number of timed programs | 262 | integer, save :: nProgs=0 ! Number of timed programs |
1881 | 251 | type(times_t), target, save:: progData(maxProgs) ! Holds data of timed progs | 263 | type(times_t), target, save:: progData(maxProgs) ! Holds data of timed progs |
1882 | @@ -287,8 +299,7 @@ | |||
1883 | 287 | writingTimes = .true. | 299 | writingTimes = .true. |
1884 | 288 | 300 | ||
1885 | 289 | ! Find present CPU time and convert it to double precision | 301 | ! Find present CPU time and convert it to double precision |
1888 | 290 | call cpu_time( treal ) | 302 | call current_time(timeNow) |
1887 | 291 | timeNow = treal | ||
1889 | 292 | totalTime = timeNow - time0 | 303 | totalTime = timeNow - time0 |
1890 | 293 | call wall_time( wallTime ) | 304 | call wall_time( wallTime ) |
1891 | 294 | wallTime = wallTime - wallTime0 | 305 | wallTime = wallTime - wallTime0 |
1892 | @@ -404,15 +415,17 @@ | |||
1893 | 404 | 'Calc: Sum, Avge, myNode, Avg/Max =', & | 415 | 'Calc: Sum, Avge, myNode, Avg/Max =', & |
1894 | 405 | sum(nodeCalTime), sum(nodeCalTime)/nNodes, totalCalTime, & | 416 | sum(nodeCalTime), sum(nodeCalTime)/nNodes, totalCalTime, & |
1895 | 406 | sum(nodeCalTime)/nNodes / maxval(nodeCalTime) | 417 | sum(nodeCalTime)/nNodes / maxval(nodeCalTime) |
1897 | 407 | #ifdef MPI_TIMING | 418 | |
1898 | 408 | write(iu,'(a,3f12.3,f8.3)') & | 419 | write(iu,'(a,3f12.3,f8.3)') & |
1899 | 409 | 'Comm: Sum, Avge, myNode, Avg/Max =', & | 420 | 'Comm: Sum, Avge, myNode, Avg/Max =', & |
1900 | 410 | sum(nodeComTime), sum(nodeComTime)/nNodes, totalComTime, & | 421 | sum(nodeComTime), sum(nodeComTime)/nNodes, totalComTime, & |
1901 | 411 | sum(nodeComTime)/nNodes / maxval(nodeComTime) | 422 | sum(nodeComTime)/nNodes / maxval(nodeComTime) |
1906 | 412 | #else | 423 | |
1907 | 413 | totalComTime = huge(1.0_dp) ! Avoid division by zero in prog table output | 424 | if (totalComTime < 1.0e-4) then |
1908 | 414 | write(iu,'(a)') 'No communications time available. Compile with -DMPI_TIMING' | 425 | ! Avoid division by zero in prog table output when not timing comms |
1909 | 415 | #endif | 426 | totalComTime = huge(1.0_dp) |
1910 | 427 | endif | ||
1911 | 428 | |||
1912 | 416 | write(iu,'(a,3f12.3,f8.3)') & | 429 | write(iu,'(a,3f12.3,f8.3)') & |
1913 | 417 | 'Tot: Sum, Avge, myNode, Avg/Max =', & | 430 | 'Tot: Sum, Avge, myNode, Avg/Max =', & |
1914 | 418 | sum(nodeTotTime), sum(nodeTotTime)/nNodes, totalTime, & | 431 | sum(nodeTotTime), sum(nodeTotTime)/nNodes, totalTime, & |
1915 | @@ -471,13 +484,14 @@ | |||
1916 | 471 | 484 | ||
1917 | 472 | ! Write total communications time | 485 | ! Write total communications time |
1918 | 473 | if (myNode==writerNode) then | 486 | if (myNode==writerNode) then |
1920 | 474 | #ifdef MPI_TIMING | 487 | |
1921 | 488 | if (totalComTime > huge(1.0_dp)/2.0_dp) then | ||
1922 | 489 | ! Set back to 0 | ||
1923 | 490 | totalComTime = 0.0_dp | ||
1924 | 491 | endif | ||
1925 | 475 | write(iu,'(a15,i9,2(f12.3,f9.4))') & | 492 | write(iu,'(a15,i9,2(f12.3,f9.4))') & |
1926 | 476 | 'MPI total ', totalComCalls, & | 493 | 'MPI total ', totalComCalls, & |
1927 | 477 | totalComTime, 1., totalComTime, totalComTime/totalTime | 494 | totalComTime, 1., totalComTime, totalComTime/totalTime |
1928 | 478 | #else | ||
1929 | 479 | write(iu,'(a)') 'No communications time available. Compile with -DMPI_TIMING' | ||
1930 | 480 | #endif | ||
1931 | 481 | endif ! (myNode==writerNode) | 495 | endif ! (myNode==writerNode) |
1932 | 482 | 496 | ||
1933 | 483 | 497 | ||
1934 | @@ -650,12 +664,11 @@ | |||
1935 | 650 | 664 | ||
1936 | 651 | subroutine timer_init() ! Initialize timing | 665 | subroutine timer_init() ! Initialize timing |
1937 | 652 | 666 | ||
1940 | 653 | ! Internal variables | 667 | use_walltime = use_walltime_in_timer() |
1939 | 654 | real :: treal | ||
1941 | 655 | 668 | ||
1942 | 656 | call wall_time( wallTime0 ) | 669 | call wall_time( wallTime0 ) |
1945 | 657 | call cpu_time( treal ) ! Notice single precision | 670 | call current_time(time0) |
1946 | 658 | time0 = treal | 671 | |
1947 | 659 | nProgs = 0 | 672 | nProgs = 0 |
1948 | 660 | 673 | ||
1949 | 661 | ! (Re)initialize data array | 674 | ! (Re)initialize data array |
1950 | @@ -717,9 +730,7 @@ | |||
1951 | 717 | ! Do not change data if writing a report | 730 | ! Do not change data if writing a report |
1952 | 718 | if (writingTimes) return | 731 | if (writingTimes) return |
1953 | 719 | 732 | ||
1957 | 720 | ! Find present CPU time and convert it to double precision | 733 | call current_time(timeNow) |
1955 | 721 | call cpu_time( treal ) ! Standard Fortran95 | ||
1956 | 722 | timeNow = treal | ||
1958 | 723 | 734 | ||
1959 | 724 | ! Find program index | 735 | ! Find program index |
1960 | 725 | iProg = prog_index( prog ) | 736 | iProg = prog_index( prog ) |
1961 | @@ -757,9 +768,7 @@ | |||
1962 | 757 | ! Do not change data if writing a report | 768 | ! Do not change data if writing a report |
1963 | 758 | if (writingTimes) return | 769 | if (writingTimes) return |
1964 | 759 | 770 | ||
1968 | 760 | ! Find present CPU time and convert it to double precision | 771 | call current_time(timeNow) |
1966 | 761 | call cpu_time( treal ) ! Standard Fortran95 | ||
1967 | 762 | timeNow = treal | ||
1969 | 763 | 772 | ||
1970 | 764 | ! Find program index | 773 | ! Find program index |
1971 | 765 | iProg = prog_index( prog, found ) | 774 | iProg = prog_index( prog, found ) |
1972 | @@ -818,6 +827,23 @@ | |||
1973 | 818 | enddo | 827 | enddo |
1974 | 819 | end subroutine timer_all_stop | 828 | end subroutine timer_all_stop |
1975 | 820 | 829 | ||
1976 | 830 | !------------------------------------------------ | ||
1977 | 831 | subroutine current_time(t) | ||
1978 | 832 | ! | ||
1979 | 833 | ! CPU or walltime, depending on the setting of 'use_walltime' | ||
1980 | 834 | ! | ||
1981 | 835 | use m_walltime, only: wall_time | ||
1982 | 836 | real(dp), intent(out) :: t | ||
1983 | 837 | |||
1984 | 838 | real :: treal ! for call to cpu_time | ||
1985 | 839 | |||
1986 | 840 | if (use_walltime) then | ||
1987 | 841 | call wall_time(t) | ||
1988 | 842 | else | ||
1989 | 843 | call cpu_time(treal) | ||
1990 | 844 | t = treal | ||
1991 | 845 | endif | ||
1992 | 846 | end subroutine current_time | ||
1993 | 821 | 847 | ||
1994 | 822 | END MODULE m_timer | 848 | END MODULE m_timer |
1995 | 823 | 849 | ||
1996 | 824 | 850 | ||
1997 | === modified file 'Src/memory.F' | |||
1998 | --- Src/memory.F 2016-01-25 16:00:16 +0000 | |||
1999 | +++ Src/memory.F 2016-07-19 08:21:24 +0000 | |||
2000 | @@ -30,9 +30,8 @@ | |||
2001 | 30 | C | 30 | C |
2002 | 31 | C Created by J.D. Gale, October 1999 | 31 | C Created by J.D. Gale, October 1999 |
2003 | 32 | C | 32 | C |
2004 | 33 | use memoryinfo | ||
2005 | 34 | use parallel, only: Node | 33 | use parallel, only: Node |
2007 | 35 | use alloc, only: alloc_count | 34 | use memory_log, only: memory_event, type_mem |
2008 | 36 | 35 | ||
2009 | 37 | implicit none | 36 | implicit none |
2010 | 38 | 37 | ||
2011 | @@ -41,71 +40,9 @@ | |||
2012 | 41 | character(len=*), intent(in) :: CallingRoutine | 40 | character(len=*), intent(in) :: CallingRoutine |
2013 | 42 | 41 | ||
2014 | 43 | C Local variables | 42 | C Local variables |
2018 | 44 | integer :: Sign | 43 | integer :: allocSize, bytes |
2016 | 45 | integer*8 :: prevMem | ||
2017 | 46 | integer :: allocSize | ||
2019 | 47 | character(len=1):: allocType | 44 | character(len=1):: allocType |
2081 | 48 | CAG | 45 | |
2021 | 49 | ! if (Node.eq.0) then | ||
2022 | 50 | ! write(66,'(a,a,a,a,i10)') "---memory: ", CallingRoutine // " ", | ||
2023 | 51 | ! $ task // " ", | ||
2024 | 52 | ! $ type // " ", nelements | ||
2025 | 53 | ! call flush(66) | ||
2026 | 54 | ! endif | ||
2027 | 55 | prevMem = CurrentMemory | ||
2028 | 56 | C Assign sign of operation based on task | ||
2029 | 57 | if (Task .eq. 'A' .or. Task .eq. 'a') then | ||
2030 | 58 | Sign = +1 | ||
2031 | 59 | else | ||
2032 | 60 | Sign = -1 | ||
2033 | 61 | endif | ||
2034 | 62 | |||
2035 | 63 | C Add number of elements to appropriate pointer | ||
2036 | 64 | if (Type .eq. 'I' .or. Type .eq. 'i') then | ||
2037 | 65 | WordsInteger = WordsInteger + Sign*NElements | ||
2038 | 66 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(1) | ||
2039 | 67 | elseif (Type .eq. 'S' .or. Type .eq. 's') then | ||
2040 | 68 | WordsSP = WordsSP + Sign*NElements | ||
2041 | 69 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2) | ||
2042 | 70 | elseif (Type .eq. 'D' .or. Type .eq. 'd') then | ||
2043 | 71 | WordsDP = WordsDP + Sign*NElements | ||
2044 | 72 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3) | ||
2045 | 73 | ! | ||
2046 | 74 | ! Support for flexible precision in grid-related arrays | ||
2047 | 75 | ! | ||
2048 | 76 | elseif (Type .eq. 'X' .or. Type .eq. 'x') then | ||
2049 | 77 | #ifdef GRID_DP | ||
2050 | 78 | WordsDP = WordsDP + Sign*NElements | ||
2051 | 79 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3) | ||
2052 | 80 | #else | ||
2053 | 81 | WordsSP = WordsSP + Sign*NElements | ||
2054 | 82 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2) | ||
2055 | 83 | #endif | ||
2056 | 84 | |||
2057 | 85 | elseif (Type .eq. 'L' .or. Type .eq. 'l') then | ||
2058 | 86 | WordsLogical = WordsLogical + Sign*NElements | ||
2059 | 87 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(4) | ||
2060 | 88 | elseif (Type .eq. 'C' .or. Type .eq. 'c') then | ||
2061 | 89 | WordsSC = WordsSC + Sign*NElements | ||
2062 | 90 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(5) | ||
2063 | 91 | elseif (Type .eq. 'Z' .or. Type .eq. 'z') then | ||
2064 | 92 | WordsDC = WordsDC + Sign*NElements | ||
2065 | 93 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(6) | ||
2066 | 94 | elseif (Type .eq. 'S' .or. Type .eq. 's') then | ||
2067 | 95 | WordsString = WordsString + Sign*NElements | ||
2068 | 96 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(7) | ||
2069 | 97 | elseif (Type .eq. 'E' .or. Type .eq. 'e') then | ||
2070 | 98 | WordsLongInt = WordsLongInt + Sign*NElements | ||
2071 | 99 | CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(8) | ||
2072 | 100 | endif | ||
2073 | 101 | |||
2074 | 102 | C Check whether memory is greater than peak memory so far | ||
2075 | 103 | if (CurrentMemory .gt. PeakMemory) then | ||
2076 | 104 | PeakMemory = CurrentMemory | ||
2077 | 105 | PeakRoutine = CallingRoutine | ||
2078 | 106 | endif | ||
2079 | 107 | |||
2080 | 108 | C Call alloc_count routine | ||
2082 | 109 | select case(Type) | 46 | select case(Type) |
2083 | 110 | case('S') | 47 | case('S') |
2084 | 111 | allocType = 'R' | 48 | allocType = 'R' |
2085 | @@ -128,82 +65,8 @@ | |||
2086 | 128 | allocSize = NElements | 65 | allocSize = NElements |
2087 | 129 | end select | 66 | end select |
2088 | 130 | if (Task=='D') allocSize = -allocSize | 67 | if (Task=='D') allocSize = -allocSize |
2091 | 131 | call alloc_count( allocSize, allocType, | 68 | bytes = allocSize*type_mem(allocType) |
2092 | 132 | . name=trim(CallingRoutine)//' unknown' ) | 69 | call memory_event(bytes, |
2093 | 70 | $ aname=trim(CallingRoutine)//'@'//'unknown' ) | ||
2094 | 133 | 71 | ||
2095 | 134 | end subroutine memory | 72 | end subroutine memory |
2096 | 135 | |||
2097 | 136 | subroutine printmemory( Unit, Level ) | ||
2098 | 137 | C | ||
2099 | 138 | C Outputs the information about the dynamic memory useage | ||
2100 | 139 | C | ||
2101 | 140 | C Created by J.D. Gale, October 1999 | ||
2102 | 141 | C | ||
2103 | 142 | C Input : | ||
2104 | 143 | C | ||
2105 | 144 | C integer Unit : channel number for output | ||
2106 | 145 | C integer Level : number controlling the level of output | ||
2107 | 146 | C : 0 = peak memory details only | ||
2108 | 147 | C : 1 = peak memory on all Nodes | ||
2109 | 148 | C | ||
2110 | 149 | use memoryinfo | ||
2111 | 150 | use precision | ||
2112 | 151 | use parallel, only : Node, Nodes | ||
2113 | 152 | #ifdef MPI | ||
2114 | 153 | use mpi_siesta | ||
2115 | 154 | #endif | ||
2116 | 155 | implicit none | ||
2117 | 156 | C Passed arguments | ||
2118 | 157 | integer :: Unit, Level | ||
2119 | 158 | C Local arguments | ||
2120 | 159 | integer :: n | ||
2121 | 160 | integer*8 :: MaxMemory | ||
2122 | 161 | integer*8, pointer :: maxmemlist(:) | ||
2123 | 162 | #ifdef MPI | ||
2124 | 163 | integer :: MPIerror | ||
2125 | 164 | #endif | ||
2126 | 165 | |||
2127 | 166 | C Find peak memory use over all Nodes | ||
2128 | 167 | #ifdef MPI | ||
2129 | 168 | call MPI_AllReduce( PeakMemory, MaxMemory, 1, MPI_INTEGER8, | ||
2130 | 169 | & MPI_MAX, MPI_COMM_WORLD, MPIerror ) | ||
2131 | 170 | #else | ||
2132 | 171 | MaxMemory = PeakMemory | ||
2133 | 172 | #endif | ||
2134 | 173 | |||
2135 | 174 | C Output memory use information | ||
2136 | 175 | if (Node.eq.0) then | ||
2137 | 176 | write(Unit,'(a)') ' ' | ||
2138 | 177 | endif | ||
2139 | 178 | if (Level.eq.0) then | ||
2140 | 179 | if (Node.eq.0) then | ||
2141 | 180 | write(Unit,'(''* Maximum dynamic memory allocated = '',i5, | ||
2142 | 181 | & '' MB'')') (MaxMemory/1000000)+1 | ||
2143 | 182 | endif | ||
2144 | 183 | else | ||
2145 | 184 | nullify(maxmemlist) | ||
2146 | 185 | if (node==0) then | ||
2147 | 186 | allocate(maxmemlist(nodes)) | ||
2148 | 187 | else | ||
2149 | 188 | allocate(maxmemlist(1)) | ||
2150 | 189 | endif | ||
2151 | 190 | #ifdef MPI | ||
2152 | 191 | call mpi_gather( peakmemory, 1, MPI_INTEGER8, | ||
2153 | 192 | & maxmemlist, 1, MPI_INTEGER8, | ||
2154 | 193 | & 0, MPI_COMM_WORLD, MPIerror ) | ||
2155 | 194 | #else | ||
2156 | 195 | maxmemlist=peakmemory | ||
2157 | 196 | #endif | ||
2158 | 197 | if (node==0) then | ||
2159 | 198 | do n=0,Nodes-1 | ||
2160 | 199 | write(Unit,'(''* Maximum dynamic memory allocated : Node '' | ||
2161 | 200 | & ,i4,'' = '',i5,'' MB'')') n,(maxmemlist(n+1)/1000000)+1 | ||
2162 | 201 | enddo | ||
2163 | 202 | write(Unit,'(a)') ' ' | ||
2164 | 203 | write(Unit,'(''* Maximum memory occured during '',a30)') | ||
2165 | 204 | & PeakRoutine | ||
2166 | 205 | endif | ||
2167 | 206 | deallocate(maxmemlist) | ||
2168 | 207 | endif | ||
2169 | 208 | |||
2170 | 209 | end subroutine printmemory | ||
2171 | 210 | 73 | ||
2172 | === added file 'Src/memory_log.F90' | |||
2173 | --- Src/memory_log.F90 1970-01-01 00:00:00 +0000 | |||
2174 | +++ Src/memory_log.F90 2016-07-19 08:21:24 +0000 | |||
2175 | @@ -0,0 +1,587 @@ | |||
2176 | 1 | ! --- | ||
2177 | 2 | ! Copyright (C) 1996-2016 The SIESTA group | ||
2178 | 3 | ! This file is distributed under the terms of the | ||
2179 | 4 | ! GNU General Public License: see COPYING in the top directory | ||
2180 | 5 | ! or http://www.gnu.org/copyleft/gpl.txt . | ||
2181 | 6 | ! See Docs/Contributors.txt for a list of contributors. | ||
2182 | 7 | ! --- | ||
2183 | 8 | ! ================================================================== | ||
2184 | 9 | |||
2185 | 10 | ! Written by J.M.Soler. May 2000. | ||
2186 | 11 | ! Re-organized by A. Garcia, June 2015 | ||
2187 | 12 | ! | ||
2188 | 13 | ! ================================================================== | ||
2189 | 14 | ! SUBROUTINE memory_report( level, unit, file, printNow, threshold ) | ||
2190 | 15 | ! Sets the output file for the allocation report | ||
2191 | 16 | ! INPUT (optional): | ||
2192 | 17 | ! integer :: level : Level (detail) of report | ||
2193 | 18 | ! integer :: unit : Output file unit | ||
2194 | 19 | ! character*(*):: file : Output file name | ||
2195 | 20 | ! logical :: printNow : If present & true => print report now | ||
2196 | 21 | ! real(dp) :: threshold : Memory threshold (in bytes) to print | ||
2197 | 22 | ! the memory use of any given array | ||
2198 | 23 | ! BEHAVIOR: | ||
2199 | 24 | ! The detail/extent of the report increses with the value of level: | ||
2200 | 25 | ! level=0 : no report at all (the default) | ||
2201 | 26 | ! level=1 : only total memory peak and where it occurred | ||
2202 | 27 | ! level=2 : detailed report created but printed only upon request | ||
2203 | 28 | ! level=3 : detailed report printed at every new memory peak | ||
2204 | 29 | ! level=4 : print every individual reallocation or deallocation | ||
2205 | 30 | ! If unit is present, memory_report merely takes note of it for | ||
2206 | 31 | ! future use, assuming that it has been already open outside. | ||
2207 | 32 | ! In this case, file is not used. | ||
2208 | 33 | ! If unit is absent, and file is present, a file with that | ||
2209 | 34 | ! name is open for future use. | ||
2210 | 35 | ! If both arguments are absent, a file named 'memory_report' | ||
2211 | 36 | ! is open for future use. | ||
2212 | 37 | ! If memory_report is called with printNow=.true. several times in | ||
2213 | 38 | ! a program, with the same unit or file argument, the subsequent | ||
2214 | 39 | ! reports are written consecutively in the same file, each with a | ||
2215 | 40 | ! time stamp header. | ||
2216 | 41 | ! If threshold is not present, threshold=0 is assumed. | ||
2217 | 42 | ! In parallel execution, the report sections that involve every | ||
2218 | 43 | ! reallocation (levels 1, 3, and 4) are written only by node 0. | ||
2219 | 44 | ! The section that is written upon request (level 2) is written | ||
2220 | 45 | ! only by the node with the highest peak of memory up to that time, | ||
2221 | 46 | ! but it contains a summary of the memory used by all other nodes. | ||
2222 | 47 | ! In parallel execution, the nodes that share the same file | ||
2223 | 48 | ! system (e.g. different chip cores or NFS-connected nodes) write | ||
2224 | 49 | ! on the same file. Otherwise they write on files with the same name | ||
2225 | 50 | ! in their local disks. | ||
2226 | 51 | ! ==================================================================--- | ||
2227 | 52 | |||
2228 | 53 | MODULE memory_log | ||
2229 | 54 | |||
2230 | 55 | use precision, only: dp ! Double precision real type | ||
2231 | 56 | use parallel, only: Node ! My processor node index | ||
2232 | 57 | use parallel, only: Nodes ! Number of parallel processors | ||
2233 | 58 | use parallel, only: ionode ! Am I the I/O processor? | ||
2234 | 59 | use parallel, only: parallel_init ! Initialize parallel variables | ||
2235 | 60 | use m_io, only: io_assign ! Get and reserve an available IO unit | ||
2236 | 61 | #ifdef MPI | ||
2237 | 62 | ! use mpi_siesta | ||
2238 | 63 | use mpi_siesta, only: MPI_AllGather | ||
2239 | 64 | use mpi_siesta, only: MPI_Barrier | ||
2240 | 65 | use mpi_siesta, only: MPI_Bcast | ||
2241 | 66 | use mpi_siesta, only: MPI_Comm_World | ||
2242 | 67 | use mpi_siesta, only: MPI_double_precision | ||
2243 | 68 | use mpi_siesta, only: MPI_integer | ||
2244 | 69 | use mpi_siesta, only: MPI_character | ||
2245 | 70 | #endif | ||
2246 | 71 | |||
2247 | 72 | implicit none | ||
2248 | 73 | |||
2249 | 74 | PUBLIC :: & | ||
2250 | 75 | memory_report, &! Sets log report defaults | ||
2251 | 76 | memory_event, &! Memory counting for allocs | ||
2252 | 77 | type_mem ! Converter | ||
2253 | 78 | |||
2254 | 79 | public :: memory ! The old (re-furbished) routine | ||
2255 | 80 | |||
2256 | 81 | integer, public :: mem_stat ! (legacy) For use in calls to allocate | ||
2257 | 82 | ! and deallocate | ||
2258 | 83 | |||
2259 | 84 | PRIVATE ! Nothing is declared public beyond this point | ||
2260 | 85 | |||
2261 | 86 | ! Initial default values | ||
2262 | 87 | character(len=*), parameter :: & | ||
2263 | 88 | DEFAULT_NAME = 'unknown_name' ! Array name default | ||
2264 | 89 | character(len=*), parameter :: & | ||
2265 | 90 | DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default | ||
2266 | 91 | |||
2267 | 92 | integer, save :: & | ||
2268 | 93 | REPORT_LEVEL = 0, &! Level (detail) of allocation report | ||
2269 | 94 | REPORT_UNIT = 0 ! Output file unit for report | ||
2270 | 95 | |||
2271 | 96 | character(len=50), save :: & | ||
2272 | 97 | REPORT_FILE = 'memory_report' ! Output file name for report | ||
2273 | 98 | real(dp), save :: & | ||
2274 | 99 | REPORT_THRESHOLD = 0 ! Memory threshold (in bytes) to print | ||
2275 | 100 | ! the memory use of any given array | ||
2276 | 101 | |||
2277 | 102 | ! Internal auxiliary type for a binary tree | ||
2278 | 103 | type TREE | ||
2279 | 104 | character(len=80) :: name ! Name of an allocated array | ||
2280 | 105 | real(DP) :: mem ! Present memory use of the array | ||
2281 | 106 | real(DP) :: max ! Maximum memory use of the array | ||
2282 | 107 | real(DP) :: peak ! Memory use of the array during | ||
2283 | 108 | ! peak of total memory | ||
2284 | 109 | type(TREE), pointer :: left ! Pointer to data of allocated arrays | ||
2285 | 110 | ! preceeding in alphabetical order | ||
2286 | 111 | type(TREE), pointer :: right ! Pointer to data of allocated arrays | ||
2287 | 112 | ! trailing in alphabetical order | ||
2288 | 113 | end type TREE | ||
2289 | 114 | |||
2290 | 115 | ! Global variables used to store allocation data | ||
2291 | 116 | real(DP), parameter :: MBYTE = 1.e6_dp | ||
2292 | 117 | type(TREE), pointer, save :: REPORT_TREE | ||
2293 | 118 | real(DP), save :: TOT_MEM = 0._dp | ||
2294 | 119 | real(DP), save :: PEAK_MEM = 0._dp | ||
2295 | 120 | character(len=80), save :: PEAK_ARRAY = ' ' | ||
2296 | 121 | character(len=32), save :: PEAK_ROUTINE = ' ' | ||
2297 | 122 | integer, save :: MAX_LEN = 0 | ||
2298 | 123 | |||
2299 | 124 | CONTAINS | ||
2300 | 125 | |||
2301 | 126 | ! ================================================================== | ||
2302 | 127 | |||
2303 | 128 | SUBROUTINE memory_report( level, unit, file, printNow, threshold ) | ||
2304 | 129 | |||
2305 | 130 | implicit none | ||
2306 | 131 | |||
2307 | 132 | integer, optional, intent(in) :: level, unit | ||
2308 | 133 | character(len=*), optional, intent(in) :: file | ||
2309 | 134 | logical, optional, intent(in) :: printNow | ||
2310 | 135 | real(dp), optional, intent(in) :: threshold | ||
2311 | 136 | |||
2312 | 137 | logical open | ||
2313 | 138 | |||
2314 | 139 | #ifdef MPI | ||
2315 | 140 | integer MPIerror | ||
2316 | 141 | #endif | ||
2317 | 142 | |||
2318 | 143 | if (present(level)) then | ||
2319 | 144 | REPORT_LEVEL = level | ||
2320 | 145 | end if | ||
2321 | 146 | |||
2322 | 147 | if (node == 0) then | ||
2323 | 148 | if (present(unit)) then ! Assume that unit has been open outside | ||
2324 | 149 | if (unit > 0) then | ||
2325 | 150 | REPORT_UNIT = unit | ||
2326 | 151 | if (present(file)) then | ||
2327 | 152 | REPORT_FILE = file | ||
2328 | 153 | else | ||
2329 | 154 | REPORT_FILE = 'unknown' | ||
2330 | 155 | end if | ||
2331 | 156 | end if | ||
2332 | 157 | else if (present(file)) then ! If file is the same, do nothing | ||
2333 | 158 | if (file /= REPORT_FILE) then ! Check if file was open outside | ||
2334 | 159 | REPORT_FILE = file | ||
2335 | 160 | inquire( file=REPORT_FILE, opened=open, number=REPORT_UNIT ) | ||
2336 | 161 | if (.not.open) then ! Open new file | ||
2337 | 162 | call io_assign(REPORT_UNIT) | ||
2338 | 163 | open( REPORT_UNIT, file=REPORT_FILE, status='unknown') | ||
2339 | 164 | write(REPORT_UNIT,*) ' ' ! Overwrite previous reports | ||
2340 | 165 | end if | ||
2341 | 166 | end if | ||
2342 | 167 | else if (REPORT_UNIT==0) then ! No unit has been open yet | ||
2343 | 168 | REPORT_FILE = 'memory_report' | ||
2344 | 169 | call io_assign(REPORT_UNIT) | ||
2345 | 170 | open( REPORT_UNIT, file=REPORT_FILE, status='unknown') | ||
2346 | 171 | write(REPORT_UNIT,*) ' ' ! Overwrite previous reports | ||
2347 | 172 | end if | ||
2348 | 173 | end if | ||
2349 | 174 | |||
2350 | 175 | #ifdef MPI | ||
2351 | 176 | ! Distribute information to other nodes and open REPORT_UNIT | ||
2352 | 177 | call MPI_Bcast(REPORT_LEVEL,1,MPI_integer,0,MPI_Comm_World,MPIerror) | ||
2353 | 178 | call MPI_Bcast(REPORT_UNIT,1,MPI_integer,0,MPI_Comm_World,MPIerror) | ||
2354 | 179 | call MPI_Bcast(REPORT_FILE,50,MPI_character,0,MPI_Comm_World,MPIerror) | ||
2355 | 180 | ! JMS: open file only in node 0 | ||
2356 | 181 | !if (node > 0) then | ||
2357 | 182 | ! open( REPORT_UNIT, file=REPORT_FILE ) | ||
2358 | 183 | !end if | ||
2359 | 184 | #endif | ||
2360 | 185 | |||
2361 | 186 | if (present(threshold)) REPORT_THRESHOLD = threshold | ||
2362 | 187 | |||
2363 | 188 | if (present(printNow)) then | ||
2364 | 189 | if (printNow) call print_report( ) | ||
2365 | 190 | end if | ||
2366 | 191 | |||
2367 | 192 | END SUBROUTINE memory_report | ||
2368 | 193 | |||
2369 | 194 | ! ================================================================== | ||
2370 | 195 | ! Internal subroutines | ||
2371 | 196 | ! ================================================================== | ||
2372 | 197 | |||
2373 | 198 | SUBROUTINE memory_event( bytes, aname ) | ||
2374 | 199 | |||
2375 | 200 | implicit none | ||
2376 | 201 | |||
2377 | 202 | integer, intent(in) :: bytes | ||
2378 | 203 | character(len=*), intent(in) :: aname | ||
2379 | 204 | |||
2380 | 205 | character(len=1) :: memType, task | ||
2381 | 206 | real(DP) :: delta_mem | ||
2382 | 207 | logical :: newPeak | ||
2383 | 208 | logical, save :: header_written = .false. | ||
2384 | 209 | logical, save :: tree_nullified = .false. | ||
2385 | 210 | integer :: memSize | ||
2386 | 211 | |||
2387 | 212 | if (REPORT_LEVEL <= 0) return | ||
2388 | 213 | |||
2389 | 214 | MAX_LEN = max( MAX_LEN, len(trim(aname)) ) | ||
2390 | 215 | |||
2391 | 216 | ! Find memory increment and total allocated memory | ||
2392 | 217 | delta_mem = real(bytes,kind=dp) | ||
2393 | 218 | TOT_MEM = TOT_MEM + delta_mem | ||
2394 | 219 | if (TOT_MEM > PEAK_MEM+0.5_dp) then | ||
2395 | 220 | newPeak = .true. | ||
2396 | 221 | PEAK_MEM = TOT_MEM | ||
2397 | 222 | PEAK_ARRAY = aname | ||
2398 | 223 | PEAK_ROUTINE = '-' | ||
2399 | 224 | ! print'(/,a,f18.6),a,/)', | ||
2400 | 225 | ! 'memory: Memory peak =', PEAK_MEM/MBYTE, ' Mbytes' | ||
2401 | 226 | else | ||
2402 | 227 | newPeak = .false. | ||
2403 | 228 | end if | ||
2404 | 229 | |||
2405 | 230 | ! Add/subtract/classify array memory | ||
2406 | 231 | if (REPORT_LEVEL > 1) then | ||
2407 | 232 | if (.not.tree_nullified) then | ||
2408 | 233 | nullify(report_tree) | ||
2409 | 234 | tree_nullified = .true. | ||
2410 | 235 | end if | ||
2411 | 236 | call tree_add( report_tree, aname, delta_mem ) | ||
2412 | 237 | if (newPeak) call tree_peak( report_tree ) | ||
2413 | 238 | end if | ||
2414 | 239 | |||
2415 | 240 | ! Print report, but only in node 0, as not all | ||
2416 | 241 | ! processors may follow the same route here | ||
2417 | 242 | ! The detail/extent of the report increses with the value of level: | ||
2418 | 243 | ! level=0 : no report at all (the default) | ||
2419 | 244 | ! level=1 : only total memory peak and where it occurred | ||
2420 | 245 | ! level=2 : detailed report created but printed only upon request | ||
2421 | 246 | ! level=3 : detailed report printed at every new memory peak | ||
2422 | 247 | ! level=4 : print every individual reallocation or deallocation | ||
2423 | 248 | |||
2424 | 249 | |||
2425 | 250 | if (newPeak .and. (REPORT_LEVEL==1 .or. REPORT_LEVEL==3) .and. & | ||
2426 | 251 | node == 0) then | ||
2427 | 252 | call print_report | ||
2428 | 253 | end if | ||
2429 | 254 | |||
2430 | 255 | if (REPORT_LEVEL == 4 .and. node == 0) then | ||
2431 | 256 | if (.not.header_written) then | ||
2432 | 257 | write(REPORT_UNIT,'(/,a7,9x,1x,a4,28x,1x,2a15)') & | ||
2433 | 258 | 'Routine', 'Name', 'Incr. (MB)', 'Total (MB)' | ||
2434 | 259 | header_written = .true. | ||
2435 | 260 | end if | ||
2436 | 261 | write(REPORT_UNIT,'(a32,1x,2f15.6)') & | ||
2437 | 262 | aname, delta_mem/MBYTE, TOT_MEM/MBYTE | ||
2438 | 263 | end if | ||
2439 | 264 | END SUBROUTINE memory_event | ||
2440 | 265 | |||
2441 | 266 | ! ================================================================== | ||
2442 | 267 | |||
2443 | 268 | INTEGER FUNCTION type_mem( var_type ) | ||
2444 | 269 | ! | ||
2445 | 270 | ! It is not clear that the sizes assumed are universal for | ||
2446 | 271 | ! non-Cray machines... | ||
2447 | 272 | ! | ||
2448 | 273 | implicit none | ||
2449 | 274 | character, intent(in) :: var_type | ||
2450 | 275 | character(len=40) :: message | ||
2451 | 276 | |||
2452 | 277 | select case( var_type ) | ||
2453 | 278 | #ifdef OLD_CRAY | ||
2454 | 279 | case('I') | ||
2455 | 280 | type_mem = 8 | ||
2456 | 281 | case('R') | ||
2457 | 282 | type_mem = 8 | ||
2458 | 283 | case('L') | ||
2459 | 284 | type_mem = 8 | ||
2460 | 285 | #else | ||
2461 | 286 | case('I') | ||
2462 | 287 | type_mem = 4 | ||
2463 | 288 | case('R') | ||
2464 | 289 | type_mem = 4 | ||
2465 | 290 | case('L') | ||
2466 | 291 | type_mem = 4 | ||
2467 | 292 | #endif | ||
2468 | 293 | case('E') | ||
2469 | 294 | type_mem = 8 | ||
2470 | 295 | case('D') | ||
2471 | 296 | type_mem = 8 | ||
2472 | 297 | case('S') | ||
2473 | 298 | type_mem = 1 | ||
2474 | 299 | case default | ||
2475 | 300 | write(message,"(2a)") & | ||
2476 | 301 | 'memory_log: ERROR: unknown type = ', var_type | ||
2477 | 302 | call die(trim(message)) | ||
2478 | 303 | end select | ||
2479 | 304 | |||
2480 | 305 | END FUNCTION type_mem | ||
2481 | 306 | |||
2482 | 307 | ! ================================================================== | ||
2483 | 308 | |||
2484 | 309 | RECURSIVE SUBROUTINE tree_add( t, name, delta_mem ) | ||
2485 | 310 | |||
2486 | 311 | implicit none | ||
2487 | 312 | type(TREE), pointer :: t | ||
2488 | 313 | character(len=*), intent(in) :: name | ||
2489 | 314 | real(DP), intent(in) :: delta_mem | ||
2490 | 315 | |||
2491 | 316 | logical, save :: warn_negative = .true. | ||
2492 | 317 | |||
2493 | 318 | if (.not.associated(t)) then | ||
2494 | 319 | allocate( t ) | ||
2495 | 320 | t%name = name | ||
2496 | 321 | t%mem = delta_mem | ||
2497 | 322 | t%max = delta_mem | ||
2498 | 323 | t%peak = 0._dp | ||
2499 | 324 | nullify( t%left, t%right ) | ||
2500 | 325 | else if (name == t%name) then | ||
2501 | 326 | t%mem = t%mem + delta_mem | ||
2502 | 327 | ! The abs is to handle the case of apparent de_allocs without re_allocs, | ||
2503 | 328 | ! caused by routine/name argument mismatches | ||
2504 | 329 | if (abs(t%mem) > abs(t%max)) t%max = t%mem | ||
2505 | 330 | else if ( llt(name,t%name) ) then | ||
2506 | 331 | call tree_add( t%left, name, delta_mem ) | ||
2507 | 332 | else | ||
2508 | 333 | call tree_add( t%right, name, delta_mem ) | ||
2509 | 334 | end if | ||
2510 | 335 | |||
2511 | 336 | if (warn_negative .and. t%mem<0._dp) then | ||
2512 | 337 | call parallel_init() ! Make sure that node and Nodes are initialized | ||
2513 | 338 | if (Node==0) then | ||
2514 | 339 | write(6,'(/,a,/,2a,/,a,f18.0,a)') & | ||
2515 | 340 | 'WARNING: alloc-realloc-dealloc name mismatch', & | ||
2516 | 341 | ' Name: ', trim(name), & | ||
2517 | 342 | ' Size: ', t%mem, ' Bytes' | ||
2518 | 343 | if (Nodes>1) write(6,'(9x,a,i6)') 'Node:', Node | ||
2519 | 344 | write(6,'(9x,a)') 'Subsequent mismatches will not be reported' | ||
2520 | 345 | warn_negative = .false. ! Print this warning only once | ||
2521 | 346 | end if | ||
2522 | 347 | end if | ||
2523 | 348 | |||
2524 | 349 | END SUBROUTINE tree_add | ||
2525 | 350 | |||
2526 | 351 | ! ================================================================== | ||
2527 | 352 | |||
2528 | 353 | RECURSIVE SUBROUTINE tree_peak( t ) | ||
2529 | 354 | |||
2530 | 355 | implicit none | ||
2531 | 356 | type(TREE), pointer :: t | ||
2532 | 357 | |||
2533 | 358 | if (.not.associated(t)) return | ||
2534 | 359 | |||
2535 | 360 | t%peak = t%mem | ||
2536 | 361 | call tree_peak( t%left ) | ||
2537 | 362 | call tree_peak( t%right ) | ||
2538 | 363 | |||
2539 | 364 | END SUBROUTINE tree_peak | ||
2540 | 365 | |||
2541 | 366 | ! ================================================================== | ||
2542 | 367 | |||
2543 | 368 | RECURSIVE SUBROUTINE tree_print( t ) | ||
2544 | 369 | |||
2545 | 370 | implicit none | ||
2546 | 371 | type(TREE), pointer :: t | ||
2547 | 372 | |||
2548 | 373 | if (.not.associated(t)) return | ||
2549 | 374 | |||
2550 | 375 | call tree_print( t%left ) | ||
2551 | 376 | |||
2552 | 377 | if (abs(t%max) >= REPORT_THRESHOLD) then | ||
2553 | 378 | write(REPORT_UNIT,'(a,1x,3f15.6,f9.2)') & | ||
2554 | 379 | t%name(1:MAX_LEN), t%mem/MBYTE, t%max/MBYTE, t%peak/MBYTE, & | ||
2555 | 380 | 100._dp * t%peak / (PEAK_MEM + tiny(PEAK_MEM) ) | ||
2556 | 381 | end if | ||
2557 | 382 | |||
2558 | 383 | call tree_print( t%right ) | ||
2559 | 384 | |||
2560 | 385 | END SUBROUTINE tree_print | ||
2561 | 386 | |||
2562 | 387 | ! ================================================================== | ||
2563 | 388 | |||
2564 | 389 | SUBROUTINE print_report | ||
2565 | 390 | |||
2566 | 391 | implicit none | ||
2567 | 392 | |||
2568 | 393 | character(len=80) :: string = 'Name' | ||
2569 | 394 | character :: date*8, time*10, zone*5 | ||
2570 | 395 | integer :: iNode, peakNode | ||
2571 | 396 | real(dp) :: maxPeak | ||
2572 | 397 | real(dp),allocatable:: nodeMem(:), nodePeak(:) | ||
2573 | 398 | |||
2574 | 399 | #ifdef MPI | ||
2575 | 400 | integer :: MPIerror | ||
2576 | 401 | #endif | ||
2577 | 402 | |||
2578 | 403 | ! Make sure that variables node and Nodes are initialized | ||
2579 | 404 | call parallel_init() | ||
2580 | 405 | |||
2581 | 406 | ! Allocate and initialize two small arrays | ||
2582 | 407 | allocate( nodeMem(0:Nodes-1), nodePeak(0:Nodes-1) ) | ||
2583 | 408 | |||
2584 | 409 | ! Initializations for Nodes=1 (serial case) | ||
2585 | 410 | nodeMem(node) = TOT_MEM | ||
2586 | 411 | nodePeak(node) = PEAK_MEM | ||
2587 | 412 | peakNode = node | ||
2588 | 413 | |||
2589 | 414 | ! In parallel, find the memory values of all nodes | ||
2590 | 415 | #ifdef MPI | ||
2591 | 416 | if (Nodes > 1) then | ||
2592 | 417 | ! Gather the present and peak memories of all nodes | ||
2593 | 418 | call MPI_AllGather( TOT_MEM, 1, MPI_double_precision, & | ||
2594 | 419 | nodeMem, 1, MPI_double_precision, & | ||
2595 | 420 | MPI_COMM_WORLD, MPIerror ) | ||
2596 | 421 | call MPI_AllGather( PEAK_MEM, 1, MPI_double_precision, & | ||
2597 | 422 | nodePeak, 1, MPI_double_precision, & | ||
2598 | 423 | MPI_COMM_WORLD, MPIerror ) | ||
2599 | 424 | ! Find the node with the highest peak of memory | ||
2600 | 425 | maxPeak = 0 | ||
2601 | 426 | do iNode = 0,Nodes-1 | ||
2602 | 427 | if (nodePeak(iNode) > maxPeak) then | ||
2603 | 428 | peakNode = iNode | ||
2604 | 429 | maxPeak = nodePeak(iNode) | ||
2605 | 430 | end if | ||
2606 | 431 | end do ! iNode | ||
2607 | 432 | ! Change the writing node for the peak-node information | ||
2608 | 433 | if (node==0 .and. peakNode/=0) close( unit=REPORT_UNIT ) | ||
2609 | 434 | call MPI_Barrier( MPI_COMM_WORLD, MPIerror ) | ||
2610 | 435 | if (node==peakNode .and. peakNode/=0) & | ||
2611 | 436 | open( unit=REPORT_UNIT, file=REPORT_FILE, & | ||
2612 | 437 | status='unknown', position='append' ) | ||
2613 | 438 | end if ! (Nodes>1) | ||
2614 | 439 | #endif | ||
2615 | 440 | |||
2616 | 441 | ! The report is printed by the highest-peak node | ||
2617 | 442 | if (node == peakNode) then | ||
2618 | 443 | |||
2619 | 444 | ! AG: Commented out to allow multiple batches of information | ||
2620 | 445 | ! if (REPORT_LEVEL < 4) rewind(REPORT_UNIT) | ||
2621 | 446 | |||
2622 | 447 | call date_and_time( date, time, zone ) | ||
2623 | 448 | |||
2624 | 449 | write(REPORT_UNIT,'(/,a,16a)') & | ||
2625 | 450 | 'Allocation summary at ', & | ||
2626 | 451 | date(1:4),'/',date(5:6),'/',date(7:8),' ', & | ||
2627 | 452 | time(1:2),':',time(3:4),':',time(5:10),' ', & | ||
2628 | 453 | zone(1:3),':',zone(4:5) | ||
2629 | 454 | |||
2630 | 455 | if (Nodes > 1) then | ||
2631 | 456 | write(REPORT_UNIT,'(/,(a,f18.6,a))') & | ||
2632 | 457 | 'Present memory all nodes : ', sum(nodeMem)/MBYTE, ' MB', & | ||
2633 | 458 | 'Added peak mem all nodes : ', sum(nodePeak)/MBYTE, ' MB', & | ||
2634 | 459 | 'Min peak memory in a node: ', minval(nodePeak)/MBYTE, ' MB', & | ||
2635 | 460 | 'Max peak memory in a node: ', maxval(nodePeak)/MBYTE, ' MB' | ||
2636 | 461 | ! Impractical for many nodes: | ||
2637 | 462 | ! write(REPORT_UNIT,'(/,a,/,(i6,f12.6))') & | ||
2638 | 463 | ! 'Memory peaks of individual nodes (Mb):', & | ||
2639 | 464 | ! (iNode,nodePeak(iNode)/MBYTE,iNode=0,Nodes-1) | ||
2640 | 465 | write(REPORT_UNIT,'(/,a,i6)') & | ||
2641 | 466 | 'Maximum peak of memory occurred in node:', peakNode | ||
2642 | 467 | end if | ||
2643 | 468 | |||
2644 | 469 | write(REPORT_UNIT,'(2(/,a,f18.6,a),/,2a,/,2a)') & | ||
2645 | 470 | 'Present memory allocation: ', TOT_MEM/MBYTE, ' MB', & | ||
2646 | 471 | 'Maximum memory allocation: ', PEAK_MEM/MBYTE, ' MB', & | ||
2647 | 472 | 'Occurred after allocating: ', trim(PEAK_ARRAY), & | ||
2648 | 473 | 'In routine: ', trim(PEAK_ROUTINE) | ||
2649 | 474 | |||
2650 | 475 | if (REPORT_LEVEL > 1) then | ||
2651 | 476 | if (REPORT_THRESHOLD > 0._dp) then | ||
2652 | 477 | write(REPORT_UNIT,'(/,a,f12.6,a,/,a,1x,3a15,a9)') & | ||
2653 | 478 | 'Allocated sizes (in MByte) of arrays larger than ', & | ||
2654 | 479 | REPORT_THRESHOLD/MBYTE, ' MB:', & | ||
2655 | 480 | string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%' | ||
2656 | 481 | else | ||
2657 | 482 | write(REPORT_UNIT,'(/,a,/,a,1x,3a15,a9)') & | ||
2658 | 483 | 'Allocated array sizes (in MByte):', & | ||
2659 | 484 | string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%' | ||
2660 | 485 | end if | ||
2661 | 486 | call tree_print( report_tree ) | ||
2662 | 487 | end if | ||
2663 | 488 | |||
2664 | 489 | end if ! (node == peakNode) | ||
2665 | 490 | |||
2666 | 491 | ! Change again the writing node for the rest of the report | ||
2667 | 492 | #ifdef MPI | ||
2668 | 493 | if (node==peakNode .and. peakNode/=0) close( unit=REPORT_UNIT ) | ||
2669 | 494 | call MPI_Barrier( MPI_COMM_WORLD, MPIerror ) | ||
2670 | 495 | if (node==0 .and. peakNode/=0) & | ||
2671 | 496 | open( unit=REPORT_UNIT, file=REPORT_FILE, & | ||
2672 | 497 | status='unknown', position='append' ) | ||
2673 | 498 | #endif | ||
2674 | 499 | |||
2675 | 500 | deallocate( nodeMem, nodePeak ) | ||
2676 | 501 | |||
2677 | 502 | END SUBROUTINE print_report | ||
2678 | 503 | ! | ||
2679 | 504 | ! This routine is called "by hand" when allocations are not | ||
2680 | 505 | ! handled by the 'alloc' mechanism, which is only suitable | ||
2681 | 506 | ! for pointers. | ||
2682 | 507 | ! | ||
2683 | 508 | subroutine memory( Task, Type, NElements, CallingRoutine, & | ||
2684 | 509 | stat,id) | ||
2685 | 510 | ! | ||
2686 | 511 | ! This subroutine keeps track of information relating to the use | ||
2687 | 512 | ! of dynamic memory | ||
2688 | 513 | |||
2689 | 514 | ! Input : | ||
2690 | 515 | ! character*1 Task : job type = 'A' -> allocate | ||
2691 | 516 | ! : 'D' -> deallocate | ||
2692 | 517 | ! character*1 Type : type of variable = 'I' = integer | ||
2693 | 518 | ! : 'S' = single precision real | ||
2694 | 519 | ! : 'D' = double precision real | ||
2695 | 520 | ! : 'X' = grid precision real | ||
2696 | 521 | ! : 'L' = logical | ||
2697 | 522 | ! : 'C' = single precision complex | ||
2698 | 523 | ! : 'Z' = double precision complex | ||
2699 | 524 | ! : 'S' = character data (we assume takes one word) | ||
2700 | 525 | ! : 'E' = double precision integer | ||
2701 | 526 | ! integer NElements : number of array elements being | ||
2702 | 527 | ! : allocated/deallocated | ||
2703 | 528 | ! character : | ||
2704 | 529 | ! CallingRoutine : string containing the name of the calling routine | ||
2705 | 530 | |||
2706 | 531 | ! Created by J.D. Gale, October 1999 | ||
2707 | 532 | |||
2708 | 533 | ! Stat and ID keyword arguments added by Alberto Garcia, 2005 | ||
2709 | 534 | |||
2710 | 535 | implicit none | ||
2711 | 536 | |||
2712 | 537 | integer, intent(in) :: NElements | ||
2713 | 538 | character(len=1), intent(in) :: Task, Type | ||
2714 | 539 | character(len=*), intent(in) :: CallingRoutine | ||
2715 | 540 | integer, intent(in), optional :: stat | ||
2716 | 541 | character(len=*), intent(in), optional :: id | ||
2717 | 542 | |||
2718 | 543 | ! Local variables | ||
2719 | 544 | integer :: allocSize, bytes | ||
2720 | 545 | character(len=1):: allocType | ||
2721 | 546 | |||
2722 | 547 | if (present(stat)) then | ||
2723 | 548 | if (stat .ne. 0) then | ||
2724 | 549 | if (present(id)) then | ||
2725 | 550 | call die(Task // "-llocation failed in " // & | ||
2726 | 551 | CallingRoutine // id) | ||
2727 | 552 | else | ||
2728 | 553 | call die(Task // "-llocation failed in " // & | ||
2729 | 554 | CallingRoutine) | ||
2730 | 555 | endif | ||
2731 | 556 | endif | ||
2732 | 557 | endif | ||
2733 | 558 | |||
2734 | 559 | select case(Type) | ||
2735 | 560 | case('S') | ||
2736 | 561 | allocType = 'R' | ||
2737 | 562 | allocSize = NElements | ||
2738 | 563 | case('C') | ||
2739 | 564 | allocType = 'R' | ||
2740 | 565 | allocSize = NElements*2 | ||
2741 | 566 | case('Z') | ||
2742 | 567 | allocType = 'D' | ||
2743 | 568 | allocSize = NElements*2 | ||
2744 | 569 | case('X') | ||
2745 | 570 | #ifdef GRID_DP | ||
2746 | 571 | allocType = 'D' | ||
2747 | 572 | #else | ||
2748 | 573 | allocType = 'R' | ||
2749 | 574 | #endif | ||
2750 | 575 | allocSize = NElements | ||
2751 | 576 | case default | ||
2752 | 577 | allocType = Type | ||
2753 | 578 | allocSize = NElements | ||
2754 | 579 | end select | ||
2755 | 580 | if (Task=='D') allocSize = -allocSize | ||
2756 | 581 | bytes = allocSize*type_mem(allocType) | ||
2757 | 582 | call memory_event(bytes, & | ||
2758 | 583 | aname=trim(CallingRoutine)//'@'//'unknown' ) | ||
2759 | 584 | |||
2760 | 585 | end subroutine memory | ||
2761 | 586 | |||
2762 | 587 | END MODULE memory_log | ||
2763 | 0 | 588 | ||
2764 | === modified file 'Src/meshsubs.F' | |||
2765 | --- Src/meshsubs.F 2016-06-29 04:07:55 +0000 | |||
2766 | +++ Src/meshsubs.F 2016-07-19 08:21:24 +0000 | |||
2767 | @@ -261,7 +261,7 @@ | |||
2768 | 261 | use precision, only : dp | 261 | use precision, only : dp |
2769 | 262 | use cellsubs, only : reclat ! Finds reciprocal unit cell | 262 | use cellsubs, only : reclat ! Finds reciprocal unit cell |
2770 | 263 | use m_chkgmx, only : chkgmx ! Checks planewave cutoff of a mesh | 263 | use m_chkgmx, only : chkgmx ! Checks planewave cutoff of a mesh |
2772 | 264 | use fft1d, only : nfft ! Finds allowed value for 1-D FFT | 264 | use m_fft_gpfa, only : nfft ! Finds allowed value for 1-D FFT |
2773 | 265 | use fdf | 265 | use fdf |
2774 | 266 | use sys, only : die, message | 266 | use sys, only : die, message |
2775 | 267 | 267 | ||
2776 | @@ -490,7 +490,7 @@ | |||
2777 | 490 | ! (Re)allocate atom-mesh arrays | 490 | ! (Re)allocate atom-mesh arrays |
2778 | 491 | call allocIpaDistr( distr, na ) | 491 | call allocIpaDistr( distr, na ) |
2779 | 492 | if (na.ne.lastna) then | 492 | if (na.ne.lastna) then |
2781 | 493 | call re_alloc( dxa, 1,3, 1,na, myName//'dxa' ) | 493 | call re_alloc( dxa, 1,3, 1,na, 'dxa', myName ) |
2782 | 494 | call re_alloc( iatfold, 1,3, 1,na, myName//'iatfold' ) | 494 | call re_alloc( iatfold, 1,3, 1,na, myName//'iatfold' ) |
2783 | 495 | endif | 495 | endif |
2784 | 496 | lastna = na | 496 | lastna = na |
2785 | 497 | 497 | ||
2786 | === modified file 'Src/moreParallelSubs.F90' | |||
2787 | --- Src/moreParallelSubs.F90 2016-01-25 16:00:16 +0000 | |||
2788 | +++ Src/moreParallelSubs.F90 2016-07-19 08:21:24 +0000 | |||
2789 | @@ -559,7 +559,7 @@ | |||
2790 | 559 | call MPI_AllReduce( sendBuff, recvBuff, n, MPI_Integer, & | 559 | call MPI_AllReduce( sendBuff, recvBuff, n, MPI_Integer, & |
2791 | 560 | MPI_Min, MPI_Comm_World, MPIerror ) | 560 | MPI_Min, MPI_Comm_World, MPIerror ) |
2792 | 561 | else | 561 | else |
2794 | 562 | call die(errHead//'unknown operator') | 562 | call die(errHead//'unknown operator:'//op) |
2795 | 563 | end if | 563 | end if |
2796 | 564 | 564 | ||
2797 | 565 | ! Unpack recvBuff | 565 | ! Unpack recvBuff |
2798 | @@ -738,7 +738,7 @@ | |||
2799 | 738 | call MPI_AllReduce( sendBuff, recvBuff, n, MPI_double_precision, & | 738 | call MPI_AllReduce( sendBuff, recvBuff, n, MPI_double_precision, & |
2800 | 739 | MPI_Min, MPI_Comm_World, MPIerror ) | 739 | MPI_Min, MPI_Comm_World, MPIerror ) |
2801 | 740 | else | 740 | else |
2803 | 741 | call die(errHead//'unknown operator') | 741 | call die(errHead//'unknown operator:'//op) |
2804 | 742 | end if | 742 | end if |
2805 | 743 | 743 | ||
2806 | 744 | ! Unpack recvBuff | 744 | ! Unpack recvBuff |
2807 | 745 | 745 | ||
2808 | === modified file 'Src/obj_setup.sh' | |||
2809 | --- Src/obj_setup.sh 2015-11-25 17:03:59 +0000 | |||
2810 | +++ Src/obj_setup.sh 2016-07-19 08:21:24 +0000 | |||
2811 | @@ -55,6 +55,15 @@ | |||
2812 | 55 | cp -f $relpath/*.h ${destdir}/$relpath | 55 | cp -f $relpath/*.h ${destdir}/$relpath |
2813 | 56 | done | 56 | done |
2814 | 57 | ) | 57 | ) |
2815 | 58 | # Replicate any .inc files | ||
2816 | 59 | # | ||
2817 | 60 | (cd $srcdir; | ||
2818 | 61 | for i in $(find . -name '*.inc' ); do | ||
2819 | 62 | relpath=${i%/*} | ||
2820 | 63 | mkdir -p ${destdir}/$relpath | ||
2821 | 64 | cp -f $relpath/*.inc ${destdir}/$relpath | ||
2822 | 65 | done | ||
2823 | 66 | ) | ||
2824 | 58 | # | 67 | # |
2825 | 59 | sed "s#VPATH=\.#VPATH=${srcdir}#g" ${srcdir}/Makefile | \ | 68 | sed "s#VPATH=\.#VPATH=${srcdir}#g" ${srcdir}/Makefile | \ |
2826 | 60 | sed "s#MAIN_OBJDIR=\.#MAIN_OBJDIR=${objdir}#g" > ${destdir}/Makefile | 69 | sed "s#MAIN_OBJDIR=\.#MAIN_OBJDIR=${objdir}#g" > ${destdir}/Makefile |
2827 | 61 | 70 | ||
2828 | === modified file 'Src/read_xc_info.F' | |||
2829 | --- Src/read_xc_info.F 2016-01-25 16:00:16 +0000 | |||
2830 | +++ Src/read_xc_info.F 2016-07-19 08:21:24 +0000 | |||
2831 | @@ -11,7 +11,7 @@ | |||
2832 | 11 | C and calls setXC to store it | 11 | C and calls setXC to store it |
2833 | 12 | C | 12 | C |
2834 | 13 | use precision, only : dp | 13 | use precision, only : dp |
2836 | 14 | use SiestaXC, only : setXC | 14 | use gridXC, only : setXC=>gridxc_setXC |
2837 | 15 | use fdf | 15 | use fdf |
2838 | 16 | use parallel, only : Node | 16 | use parallel, only : Node |
2839 | 17 | use sys, only : die | 17 | use sys, only : die |
2840 | 18 | 18 | ||
2841 | === modified file 'Src/siesta_end.F' | |||
2842 | --- Src/siesta_end.F 2016-01-25 16:00:16 +0000 | |||
2843 | +++ Src/siesta_end.F 2016-07-19 08:21:24 +0000 | |||
2844 | @@ -12,7 +12,7 @@ | |||
2845 | 12 | CONTAINS | 12 | CONTAINS |
2846 | 13 | 13 | ||
2847 | 14 | subroutine siesta_end( ) | 14 | subroutine siesta_end( ) |
2849 | 15 | use alloc, only : alloc_report | 15 | use memory_log, only : memory_report |
2850 | 16 | use siesta_cml, only : cml_p, mainXML, cmlEndModule | 16 | use siesta_cml, only : cml_p, mainXML, cmlEndModule |
2851 | 17 | use siesta_cmlsubs, only : siesta_cml_exit | 17 | use siesta_cmlsubs, only : siesta_cml_exit |
2852 | 18 | use siesta_master, only : siesta_subroutine ! Is siesta a subroutine? | 18 | use siesta_master, only : siesta_subroutine ! Is siesta a subroutine? |
2853 | @@ -61,7 +61,7 @@ | |||
2854 | 61 | !! call printmemory( 6, 1 ) | 61 | !! call printmemory( 6, 1 ) |
2855 | 62 | 62 | ||
2856 | 63 | ! Print allocation report | 63 | ! Print allocation report |
2858 | 64 | call alloc_report( printNow=.true. ) | 64 | call memory_report( printNow=.true. ) |
2859 | 65 | 65 | ||
2860 | 66 | #ifdef DEBUG_XC | 66 | #ifdef DEBUG_XC |
2861 | 67 | ! Close debug outup file | 67 | ! Close debug outup file |
2862 | 68 | 68 | ||
2863 | === modified file 'Src/siesta_init.F' | |||
2864 | --- Src/siesta_init.F 2016-05-02 15:51:23 +0000 | |||
2865 | +++ Src/siesta_init.F 2016-07-19 08:21:24 +0000 | |||
2866 | @@ -20,6 +20,8 @@ | |||
2867 | 20 | use m_struct_init, only: struct_init | 20 | use m_struct_init, only: struct_init |
2868 | 21 | use siesta_options | 21 | use siesta_options |
2869 | 22 | use timer_options, only: use_tree_timer | 22 | use timer_options, only: use_tree_timer |
2870 | 23 | use timer_options, only: time_mpi_calls | ||
2871 | 24 | use timer_options, only: use_walltime | ||
2872 | 23 | use sparse_matrices | 25 | use sparse_matrices |
2873 | 24 | use siesta_geom | 26 | use siesta_geom |
2874 | 25 | use atomlist, only: no_u, rmaxkb, amass, lasto, qtot, | 27 | use atomlist, only: no_u, rmaxkb, amass, lasto, qtot, |
2875 | @@ -29,11 +31,14 @@ | |||
2876 | 29 | use sys, only: die, bye | 31 | use sys, only: die, bye |
2877 | 30 | #ifdef BSC_CELLXC | 32 | #ifdef BSC_CELLXC |
2878 | 31 | use bsc_xcmod, only: setXC | 33 | use bsc_xcmod, only: setXC |
2879 | 34 | #else | ||
2880 | 35 | use gridxc, only: gridxc_init | ||
2881 | 32 | #endif /* BSC_CELLXC */ | 36 | #endif /* BSC_CELLXC */ |
2882 | 33 | use molecularmechanics, only: inittwobody | 37 | use molecularmechanics, only: inittwobody |
2883 | 34 | use metaforce, only: initmeta | 38 | use metaforce, only: initmeta |
2884 | 35 | use m_mpi_utils, only: broadcast | 39 | use m_mpi_utils, only: broadcast |
2886 | 36 | use alloc, only: re_alloc, alloc_report | 40 | use alloc, only: re_alloc |
2887 | 41 | use memory_log, only: memory_report | ||
2888 | 37 | use parallelsubs, only: getnodeorbs | 42 | use parallelsubs, only: getnodeorbs |
2889 | 38 | use m_iostruct, only: write_struct, read_struct | 43 | use m_iostruct, only: write_struct, read_struct |
2890 | 39 | use zmatrix, only: lUseZmatrix | 44 | use zmatrix, only: lUseZmatrix |
2891 | @@ -165,11 +170,12 @@ | |||
2892 | 165 | call siesta_cml_init( ) | 170 | call siesta_cml_init( ) |
2893 | 166 | 171 | ||
2894 | 167 | ! Set timer report file and threshold ................................. | 172 | ! Set timer report file and threshold ................................. |
2895 | 168 | threshold = fdf_get('timer_report_threshold', 0._dp) | ||
2896 | 169 | call timer_report( file=trim(slabel)//'.times', | 173 | call timer_report( file=trim(slabel)//'.times', |
2899 | 170 | . threshold=threshold ) | 174 | . threshold=fdf_get('timer_report_threshold', 0._dp)) |
2900 | 171 | ! This variable lives in siesta_options | 175 | |
2901 | 172 | use_tree_timer = fdf_get('UseTreeTimer', .false.) | 176 | use_tree_timer = fdf_get('UseTreeTimer', .false.) |
2902 | 177 | time_mpi_calls = fdf_get('time-mpi-calls', .false.) | ||
2903 | 178 | use_walltime = fdf_get('use-walltime', use_tree_timer) | ||
2904 | 173 | 179 | ||
2905 | 174 | ! Start time counter | 180 | ! Start time counter |
2906 | 175 | ! Note new placement of this first use, so that | 181 | ! Note new placement of this first use, so that |
2907 | @@ -180,12 +186,10 @@ | |||
2908 | 180 | call timer( 'Setup', 1 ) | 186 | call timer( 'Setup', 1 ) |
2909 | 181 | 187 | ||
2910 | 182 | ! Set allocation report level ......................................... | 188 | ! Set allocation report level ......................................... |
2917 | 183 | ! variables level and threshold imported from module siesta_options | 189 | call memory_report( level=fdf_get('alloc_report_level',0), |
2918 | 184 | level = fdf_get('alloc_report_level', 0) | 190 | $ file=trim(slabel)//'.alloc', |
2919 | 185 | threshold = fdf_get('alloc_report_threshold', 0._dp) | 191 | . threshold=fdf_get('alloc_report_threshold', 0._dp), |
2920 | 186 | call alloc_report( level=level, file=trim(slabel)//'.alloc', | 192 | & printNow=.false. ) |
2915 | 187 | . threshold=threshold, | ||
2916 | 188 | & printNow=.false. ) | ||
2921 | 189 | 193 | ||
2922 | 190 | if ( IONode ) then | 194 | if ( IONode ) then |
2923 | 191 | ! Add citations | 195 | ! Add citations |
2924 | @@ -196,6 +200,12 @@ | |||
2925 | 196 | ! Initialise exchange-correlation functional information | 200 | ! Initialise exchange-correlation functional information |
2926 | 197 | #ifndef BSC_CELLXC | 201 | #ifndef BSC_CELLXC |
2927 | 198 | call read_xc_info() | 202 | call read_xc_info() |
2928 | 203 | #ifdef MPI | ||
2929 | 204 | call gridxc_init(comm=MPI_Comm_World, | ||
2930 | 205 | $ time_mpi_calls=fdf_get('gridxc-time-mpi-calls',.false.)) | ||
2931 | 206 | #else | ||
2932 | 207 | call gridxc_init() | ||
2933 | 208 | #endif | ||
2934 | 199 | #else /* BSC_CELLXC */ | 209 | #else /* BSC_CELLXC */ |
2935 | 200 | call setXC( ) | 210 | call setXC( ) |
2936 | 201 | #endif /* BSC_CELLXC */ | 211 | #endif /* BSC_CELLXC */ |
2937 | 202 | 212 | ||
2938 | === modified file 'Src/siesta_options.F90' | |||
2939 | --- Src/siesta_options.F90 2016-01-25 16:00:16 +0000 | |||
2940 | +++ Src/siesta_options.F90 2016-07-19 08:21:24 +0000 | |||
2941 | @@ -132,7 +132,6 @@ | |||
2942 | 132 | integer :: min_nscf ! Minimum number of SCF iteration steps | 132 | integer :: min_nscf ! Minimum number of SCF iteration steps |
2943 | 133 | integer :: pmax | 133 | integer :: pmax |
2944 | 134 | integer :: neigwanted ! Wanted number of eigenstates (per k point) | 134 | integer :: neigwanted ! Wanted number of eigenstates (per k point) |
2945 | 135 | integer :: level ! Option for allocation report level of detail | ||
2946 | 136 | integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM | 135 | integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM |
2947 | 137 | integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step) | 136 | integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step) |
2948 | 138 | logical :: hasnobup ! Is the number of bands with spin up for | 137 | logical :: hasnobup ! Is the number of bands with spin up for |
2949 | @@ -172,7 +171,6 @@ | |||
2950 | 172 | real(dp) :: taurelax ! Relaxation time to reach desired T and P in anneal | 171 | real(dp) :: taurelax ! Relaxation time to reach desired T and P in anneal |
2951 | 173 | real(dp) :: temp | 172 | real(dp) :: temp |
2952 | 174 | real(dp) :: tempinit ! Initial ionic temperature read in redata | 173 | real(dp) :: tempinit ! Initial ionic temperature read in redata |
2953 | 175 | real(dp) :: threshold ! Min. size of arrays printed by alloc_report | ||
2954 | 176 | real(dp) :: tp ! Target pressure. Read in redata. Used in dynamics routines | 174 | real(dp) :: tp ! Target pressure. Read in redata. Used in dynamics routines |
2955 | 177 | real(dp) :: ts ! Total spin read from redata but not used | 175 | real(dp) :: ts ! Total spin read from redata but not used |
2956 | 178 | real(dp) :: tt ! Target temperature. Read in redata. Used in dynamics rout. | 176 | real(dp) :: tt ! Target temperature. Read in redata. Used in dynamics rout. |
2957 | 179 | 177 | ||
2958 | === modified file 'Src/state_init.F' | |||
2959 | --- Src/state_init.F 2016-05-02 15:51:23 +0000 | |||
2960 | +++ Src/state_init.F 2016-07-19 08:21:24 +0000 | |||
2961 | @@ -27,7 +27,7 @@ | |||
2962 | 27 | & lastkb, lasto, superc, rmaxv, indxuo, | 27 | & lastkb, lasto, superc, rmaxv, indxuo, |
2963 | 28 | & no_u, no_s | 28 | & no_u, no_s |
2964 | 29 | use atomlist, only: no_l, iza | 29 | use atomlist, only: no_l, iza |
2966 | 30 | use alloc, only: re_alloc, de_alloc, alloc_report | 30 | use alloc, only: re_alloc, de_alloc |
2967 | 31 | use m_hsparse, only: hsparse | 31 | use m_hsparse, only: hsparse |
2968 | 32 | use m_overlap, only: overlap | 32 | use m_overlap, only: overlap |
2969 | 33 | use m_check_supercell, only: check_sc_factors | 33 | use m_check_supercell, only: check_sc_factors |
2970 | 34 | 34 | ||
2971 | === modified file 'Src/timer.F90' | |||
2972 | --- Src/timer.F90 2016-01-25 16:00:16 +0000 | |||
2973 | +++ Src/timer.F90 2016-07-19 08:21:24 +0000 | |||
2974 | @@ -24,7 +24,9 @@ | |||
2975 | 24 | ! WRITTEN BY J.SOLER. JUL.2009 | 24 | ! WRITTEN BY J.SOLER. JUL.2009 |
2976 | 25 | !============================================================================= | 25 | !============================================================================= |
2977 | 26 | module timer_options | 26 | module timer_options |
2979 | 27 | logical, public :: use_tree_timer | 27 | logical, public :: use_walltime |
2980 | 28 | logical, public :: use_tree_timer | ||
2981 | 29 | logical, public :: time_mpi_calls | ||
2982 | 28 | end module timer_options | 30 | end module timer_options |
2983 | 29 | 31 | ||
2984 | 30 | subroutine timer( prog, iOpt ) | 32 | subroutine timer( prog, iOpt ) |
2985 | @@ -85,3 +87,32 @@ | |||
2986 | 85 | 87 | ||
2987 | 86 | end subroutine timer | 88 | end subroutine timer |
2988 | 87 | 89 | ||
2989 | 90 | subroutine timer_mpi( prog, iOpt ) | ||
2990 | 91 | use timer_options, only : time_mpi_calls | ||
2991 | 92 | |||
2992 | 93 | implicit none | ||
2993 | 94 | character(len=*),intent(in):: prog ! Name of program to time | ||
2994 | 95 | integer, intent(in):: iOpt ! Action option | ||
2995 | 96 | |||
2996 | 97 | if (time_mpi_calls) then | ||
2997 | 98 | call timer(prog,iOpt) | ||
2998 | 99 | endif | ||
2999 | 100 | |||
3000 | 101 | end subroutine timer_mpi | ||
3001 | 102 | |||
3002 | 103 | function use_walltime_in_timer() | ||
3003 | 104 | use timer_options, only: use_walltime | ||
3004 | 105 | |||
3005 | 106 | logical :: use_walltime_in_timer | ||
3006 | 107 | use_walltime_in_timer = use_walltime | ||
3007 | 108 | end function use_walltime_in_timer | ||
3008 | 109 | |||
3009 | 110 | subroutine gridxc_timer_start(str) | ||
3010 | 111 | character(len=*), intent(in) :: str | ||
3011 | 112 | call timer("gridxc@"//trim(str),1) | ||
3012 | 113 | end subroutine gridxc_timer_start | ||
3013 | 114 | ! | ||
3014 | 115 | subroutine gridxc_timer_stop(str) | ||
3015 | 116 | character(len=*), intent(in) :: str | ||
3016 | 117 | call timer("gridxc@"//trim(str),2) | ||
3017 | 118 | end subroutine gridxc_timer_stop | ||
3018 | 88 | 119 | ||
3019 | === modified file 'Src/timer_tree.f90' | |||
3020 | --- Src/timer_tree.f90 2016-01-25 16:00:16 +0000 | |||
3021 | +++ Src/timer_tree.f90 2016-07-19 08:21:24 +0000 | |||
3022 | @@ -52,6 +52,9 @@ | |||
3023 | 52 | ! specified below to properly abort the calling program in the event | 52 | ! specified below to properly abort the calling program in the event |
3024 | 53 | ! of an error (the routine could simply ignore timing errors...) | 53 | ! of an error (the routine could simply ignore timing errors...) |
3025 | 54 | ! | 54 | ! |
3026 | 55 | ! The user must provide an external function 'use_walltime_in_timer' | ||
3027 | 56 | ! with the interface specified below to set the value of 'use_walltime' | ||
3028 | 57 | ! | ||
3029 | 55 | ! Alberto Garcia, January 2013-, re-using some pieces of code by Jose Soler | 58 | ! Alberto Garcia, January 2013-, re-using some pieces of code by Jose Soler |
3030 | 56 | ! | 59 | ! |
3031 | 57 | implicit none | 60 | implicit none |
3032 | @@ -85,7 +88,6 @@ | |||
3033 | 85 | type(section_t), pointer :: last_active => null() | 88 | type(section_t), pointer :: last_active => null() |
3034 | 86 | 89 | ||
3035 | 87 | real(dp) :: globaltime | 90 | real(dp) :: globaltime |
3036 | 88 | logical,public :: use_walltime = .true. | ||
3037 | 89 | 91 | ||
3038 | 90 | type(section_t), pointer :: p | 92 | type(section_t), pointer :: p |
3039 | 91 | type(times_t), pointer :: pd | 93 | type(times_t), pointer :: pd |
3040 | @@ -94,6 +96,8 @@ | |||
3041 | 94 | real(dp) :: deltaTime | 96 | real(dp) :: deltaTime |
3042 | 95 | character(len=256) :: msg | 97 | character(len=256) :: msg |
3043 | 96 | 98 | ||
3044 | 99 | logical, save :: use_walltime | ||
3045 | 100 | |||
3046 | 97 | 101 | ||
3047 | 98 | public :: timer_on, timer_off, timer_report | 102 | public :: timer_on, timer_off, timer_report |
3048 | 99 | private | 103 | private |
3049 | @@ -102,6 +106,9 @@ | |||
3050 | 102 | subroutine die(str) | 106 | subroutine die(str) |
3051 | 103 | character(len=*), intent(in), optional :: str | 107 | character(len=*), intent(in), optional :: str |
3052 | 104 | end subroutine die | 108 | end subroutine die |
3053 | 109 | function use_walltime_in_timer() result(use_walltime) | ||
3054 | 110 | logical :: use_walltime | ||
3055 | 111 | end function use_walltime_in_timer | ||
3056 | 105 | end interface | 112 | end interface |
3057 | 106 | 113 | ||
3058 | 107 | CONTAINS | 114 | CONTAINS |
3059 | @@ -116,6 +123,11 @@ | |||
3060 | 116 | ! so that multiple user "trees" can be supported | 123 | ! so that multiple user "trees" can be supported |
3061 | 117 | 124 | ||
3062 | 118 | if (.not. associated(global_section)) then | 125 | if (.not. associated(global_section)) then |
3063 | 126 | ! Initialization | ||
3064 | 127 | ! Get the value of this variable before | ||
3065 | 128 | ! calling current_time... | ||
3066 | 129 | use_walltime = use_walltime_in_timer() | ||
3067 | 130 | ! | ||
3068 | 119 | allocate(global_section) | 131 | allocate(global_section) |
3069 | 120 | p => global_section | 132 | p => global_section |
3070 | 121 | p%active = .true. | 133 | p%active = .true. |
3071 | 122 | 134 | ||
3072 | === modified file 'Util/Denchar/Src/Makefile' | |||
3073 | --- Util/Denchar/Src/Makefile 2016-07-12 13:38:13 +0000 | |||
3074 | +++ Util/Denchar/Src/Makefile 2016-07-19 08:21:24 +0000 | |||
3075 | @@ -73,7 +73,7 @@ | |||
3076 | 73 | bessph.o chkdim.o dismin.o \ | 73 | bessph.o chkdim.o dismin.o \ |
3077 | 74 | dot.o readpla.o readsts.o \ | 74 | dot.o readpla.o readsts.o \ |
3078 | 75 | io.o iodm.o itochar.o length.o \ | 75 | io.o iodm.o itochar.o length.o \ |
3080 | 76 | matvect.o memory.o colinear.o\ | 76 | matvect.o memory.o memory_log.o colinear.o\ |
3081 | 77 | neighb.o paste.o pxf.o \ | 77 | neighb.o paste.o pxf.o \ |
3082 | 78 | radfft.o m_fft_gpfa.o ranger.o \ | 78 | radfft.o m_fft_gpfa.o ranger.o \ |
3083 | 79 | readwavesx.o rhoofr.o wavofr.o \ | 79 | readwavesx.o rhoofr.o wavofr.o \ |
3084 | @@ -97,13 +97,17 @@ | |||
3085 | 97 | # This is crude but will have to do for now. | 97 | # This is crude but will have to do for now. |
3086 | 98 | # Note : precision must be the first module | 98 | # Note : precision must be the first module |
3087 | 99 | # | 99 | # |
3089 | 100 | MOD_OBJS=precision.o parallel.o debugmpi.o sys.o m_io.o alloc.o memoryinfo.o listsc.o \ | 100 | MOD_OBJS=precision.o parallel.o debugmpi.o sys.o m_io.o alloc.o listsc.o \ |
3090 | 101 | atmparams.o atom_options.o atmfuncs.o atm_types.o \ | 101 | atmparams.o atom_options.o atmfuncs.o atm_types.o \ |
3091 | 102 | radial.o spher_harm.o basis_io.o basis_types.o parallelsubs.o \ | 102 | radial.o spher_harm.o basis_io.o basis_types.o parallelsubs.o \ |
3092 | 103 | schecomm.o sparse_matrices.o\ | 103 | schecomm.o sparse_matrices.o\ |
3093 | 104 | files.o interpolation.o chemical.o xml.o \ | 104 | files.o interpolation.o chemical.o xml.o \ |
3094 | 105 | domain_decom.o printmatrix.o qsort.o mmio.o pspltm1.o lenstr.o \ | 105 | domain_decom.o printmatrix.o qsort.o mmio.o pspltm1.o lenstr.o \ |
3095 | 106 | <<<<<<< TREE | ||
3096 | 106 | spatial.o timer_local.o | 107 | spatial.o timer_local.o |
3097 | 108 | ======= | ||
3098 | 109 | spatial.o timer_local.o die.o alloc_handlers.o | ||
3099 | 110 | >>>>>>> MERGE-SOURCE | ||
3100 | 107 | # | 111 | # |
3101 | 108 | COM_OBJS_DENCHAR=$(OBJS_DENCHAR) $(SYSOBJ) | 112 | COM_OBJS_DENCHAR=$(OBJS_DENCHAR) $(SYSOBJ) |
3102 | 109 | ALL_OBJS_DENCHAR=$(MOD_OBJS) $(COM_OBJS_DENCHAR) | 113 | ALL_OBJS_DENCHAR=$(MOD_OBJS) $(COM_OBJS_DENCHAR) |
3103 | @@ -141,8 +145,6 @@ | |||
3104 | 141 | debugmpi.o: parallel.o | 145 | debugmpi.o: parallel.o |
3105 | 142 | sys.o: parallel.o | 146 | sys.o: parallel.o |
3106 | 143 | m_io.o: sys.o | 147 | m_io.o: sys.o |
3107 | 144 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | ||
3108 | 145 | memoryinfo.o: precision.o | ||
3109 | 146 | listsc.o: alloc.o | 148 | listsc.o: alloc.o |
3110 | 147 | atom_options.o: sys.o | 149 | atom_options.o: sys.o |
3111 | 148 | atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o | 150 | atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o |
3112 | @@ -169,7 +171,8 @@ | |||
3113 | 169 | readsts.o: precision.o | 171 | readsts.o: precision.o |
3114 | 170 | io.o: sys.o | 172 | io.o: sys.o |
3115 | 171 | iodm.o: alloc.o files.o parallel.o parallelsubs.o precision.o sys.o | 173 | iodm.o: alloc.o files.o parallel.o parallelsubs.o precision.o sys.o |
3117 | 172 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 174 | memory.o: memory_log.o parallel.o |
3118 | 175 | memory_log.o: m_io.o parallel.o precision.o | ||
3119 | 173 | colinear.o: precision.o | 176 | colinear.o: precision.o |
3120 | 174 | neighb.o: precision.o | 177 | neighb.o: precision.o |
3121 | 175 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o | 178 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o |
3122 | 176 | 179 | ||
3123 | === added file 'Util/Denchar/Src/alloc_handlers.f90' | |||
3124 | --- Util/Denchar/Src/alloc_handlers.f90 1970-01-01 00:00:00 +0000 | |||
3125 | +++ Util/Denchar/Src/alloc_handlers.f90 2016-07-19 08:21:24 +0000 | |||
3126 | @@ -0,0 +1,14 @@ | |||
3127 | 1 | ! Error message and integer code | ||
3128 | 2 | ! If 'code' is 0, this is the last call in a series | ||
3129 | 3 | ! (see below for usage) | ||
3130 | 4 | subroutine alloc_error_report(str,code) | ||
3131 | 5 | character(len=*), intent(in) :: str | ||
3132 | 6 | integer, intent(in) :: code | ||
3133 | 7 | end subroutine alloc_error_report | ||
3134 | 8 | ! | ||
3135 | 9 | ! Logger for memory events | ||
3136 | 10 | ! | ||
3137 | 11 | subroutine alloc_memory_event(bytes,name) | ||
3138 | 12 | integer, intent(in) :: bytes | ||
3139 | 13 | character(len=*), intent(in) :: name | ||
3140 | 14 | end subroutine alloc_memory_event | ||
3141 | 0 | 15 | ||
3142 | === modified file 'Util/Gen-basis/Makefile' | |||
3143 | --- Util/Gen-basis/Makefile 2016-07-12 13:38:13 +0000 | |||
3144 | +++ Util/Gen-basis/Makefile 2016-07-19 08:21:24 +0000 | |||
3145 | @@ -39,6 +39,8 @@ | |||
3146 | 39 | FC_SERIAL?=$(FC_DEFAULT) | 39 | FC_SERIAL?=$(FC_DEFAULT) |
3147 | 40 | FC:=$(FC_SERIAL) # Make it non-recursive | 40 | FC:=$(FC_SERIAL) # Make it non-recursive |
3148 | 41 | # | 41 | # |
3149 | 42 | GRIDXC_SERIAL_ROOT ?= $(GRIDXC_ROOT) | ||
3150 | 43 | # | ||
3151 | 42 | DEFS:= $(DEFS) $(DEFS_PREFIX)-UMPI | 44 | DEFS:= $(DEFS) $(DEFS_PREFIX)-UMPI |
3152 | 43 | FPPFLAGS:=$(FPPFLAGS) $(DEFS_PREFIX)-UMPI | 45 | FPPFLAGS:=$(FPPFLAGS) $(DEFS_PREFIX)-UMPI |
3153 | 44 | # | 46 | # |
3154 | @@ -60,20 +62,33 @@ | |||
3155 | 60 | # Note that machine-specific files are now in top Src directory. | 62 | # Note that machine-specific files are now in top Src directory. |
3156 | 61 | # | 63 | # |
3157 | 62 | OBJS_GEN-BASIS=m_io.o io.o alloc.o basis_types.o precision.o parallel.o \ | 64 | OBJS_GEN-BASIS=m_io.o io.o alloc.o basis_types.o precision.o parallel.o \ |
3159 | 63 | parsing.o basis_io.o chemical.o atm_transfer.o atm_types.o\ | 65 | parsing.o basis_io.o chemical.o atm_transfer.o atm_types.o\ |
3160 | 64 | atmparams.o old_atmfuncs.o radial.o interpolation.o \ | 66 | atmparams.o old_atmfuncs.o radial.o interpolation.o \ |
3161 | 65 | paste.o bessph.o radfft.o sorting.o m_filter.o \ | 67 | paste.o bessph.o radfft.o sorting.o m_filter.o \ |
3162 | 68 | <<<<<<< TREE | ||
3163 | 66 | basis_specs.o atom.o memoryinfo.o memory.o periodic_table.o\ | 69 | basis_specs.o atom.o memoryinfo.o memory.o periodic_table.o\ |
3164 | 67 | pxf.o dot.o atom_options.o arw.o \ | 70 | pxf.o dot.o atom_options.o arw.o \ |
3165 | 68 | sys.o timer.o xml.o m_walltime.o read_xc_info.o gen-basis.o $(SYSOBJ) \ | 71 | sys.o timer.o xml.o m_walltime.o read_xc_info.o gen-basis.o $(SYSOBJ) \ |
3166 | 69 | xc.o bsc_xcmod.o local_die.o ldau_specs.o m_cite.o | 72 | xc.o bsc_xcmod.o local_die.o ldau_specs.o m_cite.o |
3167 | 73 | ======= | ||
3168 | 74 | basis_specs.o ldau_specs.o atom.o memory.o memory_log.o periodic_table.o\ | ||
3169 | 75 | pseudopotential.o pxf.o dot.o atom_options.o arw.o \ | ||
3170 | 76 | sys.o xml.o m_walltime.o read_xc_info.o gen-basis.o $(SYSOBJ) \ | ||
3171 | 77 | xc.o bsc_xcmod.o handlers.o m_fft_gpfa.o m_cite.o | ||
3172 | 78 | >>>>>>> MERGE-SOURCE | ||
3173 | 70 | # | 79 | # |
3174 | 71 | IONCAT_OBJS=f2kcli.o m_getopts.o basis_types.o precision.o parallel.o \ | 80 | IONCAT_OBJS=f2kcli.o m_getopts.o basis_types.o precision.o parallel.o \ |
3175 | 72 | parsing.o m_io.o io.o alloc.o atom_options.o basis_io.o atm_types.o\ | 81 | parsing.o m_io.o io.o alloc.o atom_options.o basis_io.o atm_types.o\ |
3176 | 73 | atmparams.o radial.o memory.o chkdim.o\ | 82 | atmparams.o radial.o memory.o chkdim.o\ |
3177 | 83 | <<<<<<< TREE | ||
3178 | 74 | paste.o chemical.o \ | 84 | paste.o chemical.o \ |
3179 | 75 | basis_specs.o memoryinfo.o m_memory.o periodic_table.o pxf.o \ | 85 | basis_specs.o memoryinfo.o m_memory.o periodic_table.o pxf.o \ |
3180 | 86 | ======= | ||
3181 | 87 | paste.o pseudopotential.o chemical.o \ | ||
3182 | 88 | basis_specs.o memory_log.o periodic_table.o pxf.o \ | ||
3183 | 89 | >>>>>>> MERGE-SOURCE | ||
3184 | 76 | atmfuncs.o spher_harm.o interpolation.o\ | 90 | atmfuncs.o spher_harm.o interpolation.o\ |
3185 | 91 | <<<<<<< TREE | ||
3186 | 77 | sys.o xml.o m_walltime.o ioncat.o local_die.o $(SYSOBJ) | 92 | sys.o xml.o m_walltime.o ioncat.o local_die.o $(SYSOBJ) |
3187 | 78 | # | 93 | # |
3188 | 79 | # Compile XC in a private directory, without MPI | 94 | # Compile XC in a private directory, without MPI |
3189 | @@ -90,6 +105,13 @@ | |||
3190 | 90 | "FPPFLAGS=$(FPPFLAGS)" \ | 105 | "FPPFLAGS=$(FPPFLAGS)" \ |
3191 | 91 | "MPI_INTERFACE= " \ | 106 | "MPI_INTERFACE= " \ |
3192 | 92 | "FFLAGS=$(FFLAGS)" module ) | 107 | "FFLAGS=$(FFLAGS)" module ) |
3193 | 108 | ======= | ||
3194 | 109 | sys.o xml.o m_walltime.o ioncat.o handlers.o $(SYSOBJ) | ||
3195 | 110 | # | ||
3196 | 111 | include $(GRIDXC_SERIAL_ROOT)/gridxc.mk | ||
3197 | 112 | XC = $(GRIDXC_LIBS) | ||
3198 | 113 | INCFLAGS:= $(INCFLAGS) $(GRIDXC_INCFLAGS) | ||
3199 | 114 | >>>>>>> MERGE-SOURCE | ||
3200 | 93 | # | 115 | # |
3201 | 94 | NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a | 116 | NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a |
3202 | 95 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a | 117 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a |
3203 | @@ -98,7 +120,7 @@ | |||
3204 | 98 | # | 120 | # |
3205 | 99 | FDF=libfdf.a | 121 | FDF=libfdf.a |
3206 | 100 | FDF_MAKEFILE=$(TOP_LEVEL)/fdf/makefile | 122 | FDF_MAKEFILE=$(TOP_LEVEL)/fdf/makefile |
3208 | 101 | FDF_INCFLAGS:=-I $(TOP_LEVEL)/fdf $(INCFLAGS) | 123 | FDF_INCFLAGS:=#-I $(TOP_LEVEL)/fdf $(INCFLAGS) |
3209 | 102 | $(FDF): | 124 | $(FDF): |
3210 | 103 | (mkdir -p fdf ; cd fdf ; $(MAKE) -f $(FDF_MAKEFILE) "FC=$(FC)" "VPATH=$(TOP_LEVEL)/fdf" \ | 125 | (mkdir -p fdf ; cd fdf ; $(MAKE) -f $(FDF_MAKEFILE) "FC=$(FC)" "VPATH=$(TOP_LEVEL)/fdf" \ |
3211 | 104 | "ARCH_MAKE=$(ARCH_MAKE)" \ | 126 | "ARCH_MAKE=$(ARCH_MAKE)" \ |
3212 | @@ -132,7 +154,6 @@ | |||
3213 | 132 | rm -f gen-basis ioncat *.o *.a | 154 | rm -f gen-basis ioncat *.o *.a |
3214 | 133 | rm -f *.mod | 155 | rm -f *.mod |
3215 | 134 | rm -rf fdf | 156 | rm -rf fdf |
3216 | 135 | rm -rf SiestaXC | ||
3217 | 136 | rm -f _tmp_deps deps.list protomake* | 157 | rm -f _tmp_deps deps.list protomake* |
3218 | 137 | # | 158 | # |
3219 | 138 | ALL_OBJS=$(IONCAT_OBJS) $(OBJS_GEN-BASIS) | 159 | ALL_OBJS=$(IONCAT_OBJS) $(OBJS_GEN-BASIS) |
3220 | @@ -153,28 +174,41 @@ | |||
3221 | 153 | basis_types.o: alloc.o atmparams.o precision.o sys.o | 174 | basis_types.o: alloc.o atmparams.o precision.o sys.o |
3222 | 154 | m_io.o: sys.o | 175 | m_io.o: sys.o |
3223 | 155 | io.o: sys.o | 176 | io.o: sys.o |
3224 | 156 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | ||
3225 | 157 | atom_options.o: sys.o | 177 | atom_options.o: sys.o |
3226 | 158 | basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o | 178 | basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o |
3227 | 159 | basis_io.o: precision.o radial.o sys.o xml.o | 179 | basis_io.o: precision.o radial.o sys.o xml.o |
3228 | 160 | atm_types.o: precision.o radial.o | 180 | atm_types.o: precision.o radial.o |
3229 | 161 | radial.o: alloc.o interpolation.o precision.o xml.o | 181 | radial.o: alloc.o interpolation.o precision.o xml.o |
3231 | 162 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 182 | memory.o: memory_log.o parallel.o |
3232 | 163 | chkdim.o: sys.o | 183 | chkdim.o: sys.o |
3233 | 164 | chemical.o: parallel.o precision.o sys.o | 184 | chemical.o: parallel.o precision.o sys.o |
3234 | 185 | <<<<<<< TREE | ||
3235 | 165 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o | 186 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o |
3236 | 166 | memoryinfo.o: precision.o | 187 | memoryinfo.o: precision.o |
3237 | 167 | m_memory.o: memoryinfo.o parallel.o sys.o | 188 | m_memory.o: memoryinfo.o parallel.o sys.o |
3238 | 189 | ======= | ||
3239 | 190 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o | ||
3240 | 191 | basis_specs.o: pseudopotential.o sys.o | ||
3241 | 192 | memory_log.o: m_io.o parallel.o precision.o | ||
3242 | 193 | >>>>>>> MERGE-SOURCE | ||
3243 | 168 | periodic_table.o: precision.o sys.o | 194 | periodic_table.o: precision.o sys.o |
3244 | 169 | atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o | 195 | atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o |
3245 | 170 | spher_harm.o: alloc.o precision.o sys.o | 196 | spher_harm.o: alloc.o precision.o sys.o |
3246 | 171 | sys.o: parallel.o | 197 | sys.o: parallel.o |
3247 | 172 | xml.o: precision.o | 198 | xml.o: precision.o |
3248 | 173 | ioncat.o: atm_types.o atmfuncs.o basis_io.o m_getopts.o precision.o | 199 | ioncat.o: atm_types.o atmfuncs.o basis_io.o m_getopts.o precision.o |
3249 | 200 | <<<<<<< TREE | ||
3250 | 201 | ======= | ||
3251 | 202 | handlers.o: memory_log.o | ||
3252 | 203 | >>>>>>> MERGE-SOURCE | ||
3253 | 174 | m_io.o: sys.o | 204 | m_io.o: sys.o |
3254 | 175 | io.o: sys.o | 205 | io.o: sys.o |
3255 | 206 | <<<<<<< TREE | ||
3256 | 176 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | 207 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o |
3257 | 177 | basis_types.o: alloc.o atmparams.o precision.o sys.o | 208 | basis_types.o: alloc.o atmparams.o precision.o sys.o |
3258 | 209 | ======= | ||
3259 | 210 | basis_types.o: alloc.o atmparams.o precision.o pseudopotential.o sys.o | ||
3260 | 211 | >>>>>>> MERGE-SOURCE | ||
3261 | 178 | basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o | 212 | basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o |
3262 | 179 | basis_io.o: precision.o radial.o sys.o xml.o | 213 | basis_io.o: precision.o radial.o sys.o xml.o |
3263 | 180 | chemical.o: parallel.o precision.o sys.o | 214 | chemical.o: parallel.o precision.o sys.o |
3264 | @@ -186,23 +220,40 @@ | |||
3265 | 186 | bessph.o: precision.o sys.o | 220 | bessph.o: precision.o sys.o |
3266 | 187 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o | 221 | radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o |
3267 | 188 | m_filter.o: bessph.o precision.o radfft.o sorting.o sys.o | 222 | m_filter.o: bessph.o precision.o radfft.o sorting.o sys.o |
3268 | 223 | <<<<<<< TREE | ||
3269 | 189 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o | 224 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o |
3270 | 225 | ======= | ||
3271 | 226 | basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o | ||
3272 | 227 | basis_specs.o: pseudopotential.o sys.o | ||
3273 | 228 | ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o | ||
3274 | 229 | ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o | ||
3275 | 230 | ldau_specs.o: precision.o pseudopotential.o radial.o sys.o units.o | ||
3276 | 231 | >>>>>>> MERGE-SOURCE | ||
3277 | 190 | atom.o: atmparams.o atom_options.o basis_specs.o basis_types.o bsc_xcmod.o | 232 | atom.o: atmparams.o atom_options.o basis_specs.o basis_types.o bsc_xcmod.o |
3278 | 191 | atom.o: interpolation.o m_filter.o old_atmfuncs.o periodic_table.o precision.o | 233 | atom.o: interpolation.o m_filter.o old_atmfuncs.o periodic_table.o precision.o |
3279 | 234 | <<<<<<< TREE | ||
3280 | 192 | atom.o: sys.o | 235 | atom.o: sys.o |
3281 | 193 | memoryinfo.o: precision.o | 236 | memoryinfo.o: precision.o |
3282 | 194 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 237 | memory.o: alloc.o memoryinfo.o parallel.o precision.o |
3283 | 238 | ======= | ||
3284 | 239 | atom.o: pseudopotential.o sys.o | ||
3285 | 240 | memory.o: memory_log.o parallel.o | ||
3286 | 241 | memory_log.o: m_io.o parallel.o precision.o | ||
3287 | 242 | >>>>>>> MERGE-SOURCE | ||
3288 | 195 | periodic_table.o: precision.o sys.o | 243 | periodic_table.o: precision.o sys.o |
3289 | 196 | atom_options.o: sys.o | 244 | atom_options.o: sys.o |
3290 | 197 | arw.o: alloc.o parallel.o precision.o sys.o | 245 | arw.o: alloc.o parallel.o precision.o sys.o |
3291 | 198 | sys.o: parallel.o | 246 | sys.o: parallel.o |
3292 | 199 | timer.o: m_timer.o parallel.o sys.o timer_tree.o | ||
3293 | 200 | xml.o: precision.o | 247 | xml.o: precision.o |
3294 | 201 | read_xc_info.o: parallel.o precision.o sys.o | 248 | read_xc_info.o: parallel.o precision.o sys.o |
3295 | 202 | gen-basis.o: atom.o atom_options.o basis_io.o basis_specs.o basis_types.o | 249 | gen-basis.o: atom.o atom_options.o basis_io.o basis_specs.o basis_types.o |
3296 | 203 | gen-basis.o: old_atmfuncs.o parallel.o precision.o sys.o | 250 | gen-basis.o: old_atmfuncs.o parallel.o precision.o sys.o |
3297 | 204 | xc.o: alloc.o bsc_xcmod.o precision.o sys.o | 251 | xc.o: alloc.o bsc_xcmod.o precision.o sys.o |
3298 | 205 | bsc_xcmod.o: parallel.o precision.o sys.o | 252 | bsc_xcmod.o: parallel.o precision.o sys.o |
3299 | 253 | <<<<<<< TREE | ||
3300 | 206 | ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o | 254 | ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o |
3301 | 207 | ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o | 255 | ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o |
3302 | 208 | ldau_specs.o: precision.o radial.o sys.o units.o | 256 | ldau_specs.o: precision.o radial.o sys.o units.o |
3303 | 257 | ======= | ||
3304 | 258 | handlers.o: memory_log.o | ||
3305 | 259 | >>>>>>> MERGE-SOURCE | ||
3306 | 209 | 260 | ||
3307 | === added file 'Util/Gen-basis/handlers.f' | |||
3308 | --- Util/Gen-basis/handlers.f 1970-01-01 00:00:00 +0000 | |||
3309 | +++ Util/Gen-basis/handlers.f 2016-07-19 08:21:24 +0000 | |||
3310 | @@ -0,0 +1,114 @@ | |||
3311 | 1 | !-------------------------------------------------- | ||
3312 | 2 | ! Stand-alone 'die' routine for use by libraries and | ||
3313 | 3 | ! low-level modules. | ||
3314 | 4 | ! | ||
3315 | 5 | ! Each program using the module or library needs to | ||
3316 | 6 | ! provide a routine with the proper interface, but | ||
3317 | 7 | ! accomodating the needs and conventions of the program. | ||
3318 | 8 | ! For example, in Siesta: | ||
3319 | 9 | ! | ||
3320 | 10 | ! - The use of a Siesta-specific 'mpi_siesta' module. | ||
3321 | 11 | ! - The need to have the pxf functionality. | ||
3322 | 12 | ! - The use of 'unit 6' as output. | ||
3323 | 13 | ! | ||
3324 | 14 | ! Routines using this functionality should include | ||
3325 | 15 | ! the following | ||
3326 | 16 | ! | ||
3327 | 17 | ! interface | ||
3328 | 18 | ! subroutine die(str) | ||
3329 | 19 | ! character(len=*), intent(in) :: str | ||
3330 | 20 | ! end subroutine die | ||
3331 | 21 | ! end interface | ||
3332 | 22 | ! | ||
3333 | 23 | !------------------------------------------------------ | ||
3334 | 24 | |||
3335 | 25 | subroutine die(str) | ||
3336 | 26 | |||
3337 | 27 | character(len=*), intent(in) :: str | ||
3338 | 28 | |||
3339 | 29 | write(6,'(a)') trim(str) | ||
3340 | 30 | write(0,'(a)') trim(str) | ||
3341 | 31 | write(6,'(a,i4)') 'Stopping Program from Node: ', Node | ||
3342 | 32 | write(0,'(a,i4)') 'Stopping Program from Node: ', Node | ||
3343 | 33 | call pxfflush(6) | ||
3344 | 34 | call pxfflush(0) | ||
3345 | 35 | call pxfabort() | ||
3346 | 36 | |||
3347 | 37 | end subroutine die | ||
3348 | 38 | |||
3349 | 39 | subroutine timer(str,i) | ||
3350 | 40 | |||
3351 | 41 | character(len=*), intent(in) :: str | ||
3352 | 42 | integer, intent(in) :: i | ||
3353 | 43 | end subroutine timer | ||
3354 | 44 | |||
3355 | 45 | !-------------------------------------------------- | ||
3356 | 46 | ! Stand-alone routine to capture error messages from | ||
3357 | 47 | ! the alloc module | ||
3358 | 48 | ! | ||
3359 | 49 | ! This functionality could be made more general, | ||
3360 | 50 | ! and use a uniform interface for all the utility | ||
3361 | 51 | ! modules developed in-house. (Let's say, call it | ||
3362 | 52 | ! 'error_report' with severity arguments, etc). | ||
3363 | 53 | ! | ||
3364 | 54 | ! Each program using the alloc module needs to | ||
3365 | 55 | ! provide a routine with the proper interface, but | ||
3366 | 56 | ! accomodating the needs and conventions of the program. | ||
3367 | 57 | ! For example, in Siesta: | ||
3368 | 58 | ! | ||
3369 | 59 | ! - The tagging of the message by Node. | ||
3370 | 60 | ! - The use of 'unit 6' as output and '0' as error. | ||
3371 | 61 | ! | ||
3372 | 62 | ! Routines using this functionality should include | ||
3373 | 63 | ! the following | ||
3374 | 64 | ! | ||
3375 | 65 | ! subroutine alloc_error_report(str,code) | ||
3376 | 66 | ! character(len=*), intent(in) :: str | ||
3377 | 67 | ! integer, intent(in) :: code | ||
3378 | 68 | ! end subroutine alloc_error_report | ||
3379 | 69 | ! | ||
3380 | 70 | !------------------------------------------------------ | ||
3381 | 71 | |||
3382 | 72 | subroutine alloc_error_report(str,code) | ||
3383 | 73 | |||
3384 | 74 | character(len=*), intent(in) :: str | ||
3385 | 75 | integer, intent(in) :: code | ||
3386 | 76 | |||
3387 | 77 | if (code == 0) then | ||
3388 | 78 | call die(str) | ||
3389 | 79 | else | ||
3390 | 80 | write(0,*) trim(str) | ||
3391 | 81 | write(6,*) trim(str) | ||
3392 | 82 | endif | ||
3393 | 83 | |||
3394 | 84 | end subroutine alloc_error_report | ||
3395 | 85 | !-------------------------------------------------- | ||
3396 | 86 | ! Stand-alone routine to capture memory events from | ||
3397 | 87 | ! the alloc module | ||
3398 | 88 | ! | ||
3399 | 89 | ! Each program using the alloc module needs to | ||
3400 | 90 | ! provide a routine with the proper interface, but | ||
3401 | 91 | ! accomodating the needs and conventions of the program. | ||
3402 | 92 | ! For example, in Siesta | ||
3403 | 93 | ! | ||
3404 | 94 | ! - The use of the memory_log module for reports | ||
3405 | 95 | ! | ||
3406 | 96 | ! Routines using this functionality should include | ||
3407 | 97 | ! the following | ||
3408 | 98 | ! | ||
3409 | 99 | ! subroutine alloc_memory_event(str,code) | ||
3410 | 100 | ! character(len=*), intent(in) :: str | ||
3411 | 101 | ! integer, intent(in) :: code | ||
3412 | 102 | ! end subroutine alloc_memory_event | ||
3413 | 103 | ! | ||
3414 | 104 | !------------------------------------------------------ | ||
3415 | 105 | |||
3416 | 106 | subroutine alloc_memory_event(bytes,name) | ||
3417 | 107 | use memory_log, only: memory_event | ||
3418 | 108 | |||
3419 | 109 | integer, intent(in) :: bytes | ||
3420 | 110 | character(len=*), intent(in) :: name | ||
3421 | 111 | |||
3422 | 112 | call memory_event(bytes,name) | ||
3423 | 113 | |||
3424 | 114 | end subroutine alloc_memory_event | ||
3425 | 0 | 115 | ||
3426 | === renamed file 'Util/Gen-basis/local_die.F' => 'Util/Gen-basis/local_die.F.THIS' | |||
3427 | === modified file 'Util/SiestaSubroutine/ProtoNEB/Src/Makefile' | |||
3428 | --- Util/SiestaSubroutine/ProtoNEB/Src/Makefile 2016-06-29 04:07:55 +0000 | |||
3429 | +++ Util/SiestaSubroutine/ProtoNEB/Src/Makefile 2016-07-19 08:21:24 +0000 | |||
3430 | @@ -39,6 +39,7 @@ | |||
3431 | 39 | SIESTA_LIB=libSiestaForces.a | 39 | SIESTA_LIB=libSiestaForces.a |
3432 | 40 | FDF=libfdf.a | 40 | FDF=libfdf.a |
3433 | 41 | XMLPARSER=libxmlparser.a | 41 | XMLPARSER=libxmlparser.a |
3434 | 42 | <<<<<<< TREE | ||
3435 | 42 | XC=libSiestaXC.a | 43 | XC=libSiestaXC.a |
3436 | 43 | # | 44 | # |
3437 | 44 | include $(MAIN_OBJDIR)/Mk/FoX.mk | 45 | include $(MAIN_OBJDIR)/Mk/FoX.mk |
3438 | @@ -47,6 +48,10 @@ | |||
3439 | 47 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a | 48 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a |
3440 | 48 | PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a | 49 | PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a |
3441 | 49 | # | 50 | # |
3442 | 51 | ======= | ||
3443 | 52 | XC=libGridXC.a | ||
3444 | 53 | FoX_LIBS=`$(OBJ_DIR)/FoX/FoX-config --libs --wcml` | ||
3445 | 54 | >>>>>>> MERGE-SOURCE | ||
3446 | 50 | ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \ | 55 | ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \ |
3447 | 51 | $(NCPS) $(PSML) $(PSOP) \ | 56 | $(NCPS) $(PSML) $(PSOP) \ |
3448 | 52 | $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS) | 57 | $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS) |
3449 | 53 | 58 | ||
3450 | === modified file 'Util/SiestaSubroutine/SimpleTest/Src/Makefile' | |||
3451 | --- Util/SiestaSubroutine/SimpleTest/Src/Makefile 2016-06-29 04:07:55 +0000 | |||
3452 | +++ Util/SiestaSubroutine/SimpleTest/Src/Makefile 2016-07-19 08:21:24 +0000 | |||
3453 | @@ -57,6 +57,7 @@ | |||
3454 | 57 | SIESTA_LIB=libSiestaForces.a | 57 | SIESTA_LIB=libSiestaForces.a |
3455 | 58 | FDF=libfdf.a | 58 | FDF=libfdf.a |
3456 | 59 | XMLPARSER=libxmlparser.a | 59 | XMLPARSER=libxmlparser.a |
3457 | 60 | <<<<<<< TREE | ||
3458 | 60 | XC=libSiestaXC.a | 61 | XC=libSiestaXC.a |
3459 | 61 | include $(MAIN_OBJDIR)/Mk/FoX.mk | 62 | include $(MAIN_OBJDIR)/Mk/FoX.mk |
3460 | 62 | # | 63 | # |
3461 | @@ -64,6 +65,10 @@ | |||
3462 | 64 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a | 65 | PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a |
3463 | 65 | PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a | 66 | PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a |
3464 | 66 | # | 67 | # |
3465 | 68 | ======= | ||
3466 | 69 | XC=libGridXC.a | ||
3467 | 70 | FoX_LIBS=`$(OBJ_DIR)/FoX/FoX-config --libs --wcml` | ||
3468 | 71 | >>>>>>> MERGE-SOURCE | ||
3469 | 67 | ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \ | 72 | ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \ |
3470 | 68 | $(NCPS) $(PSML) $(PSOP) \ | 73 | $(NCPS) $(PSML) $(PSOP) \ |
3471 | 69 | $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS) | 74 | $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS) |
3472 | 70 | 75 | ||
3473 | === modified file 'Util/VCA/Makefile' | |||
3474 | --- Util/VCA/Makefile 2016-07-12 13:38:13 +0000 | |||
3475 | +++ Util/VCA/Makefile 2016-07-19 08:21:24 +0000 | |||
3476 | @@ -85,17 +85,28 @@ | |||
3477 | 85 | # | 85 | # |
3478 | 86 | MIXPS_OBJS= f2kcli.o interpolation.o atom_options.o \ | 86 | MIXPS_OBJS= f2kcli.o interpolation.o atom_options.o \ |
3479 | 87 | sys.o m_io.o io.o alloc.o pxf.o parallel.o periodic_table.o \ | 87 | sys.o m_io.o io.o alloc.o pxf.o parallel.o periodic_table.o \ |
3480 | 88 | <<<<<<< TREE | ||
3481 | 88 | memory.o memoryinfo.o mixps.o psml_die.o die.o | 89 | memory.o memoryinfo.o mixps.o psml_die.o die.o |
3482 | 89 | # | 90 | # |
3483 | 90 | NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a | 91 | NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a |
3484 | 91 | # | 92 | # |
3485 | 92 | mixps: $(FDF) $(MIXPS_OBJS) $(NCPS) | 93 | mixps: $(FDF) $(MIXPS_OBJS) $(NCPS) |
3486 | 94 | ======= | ||
3487 | 95 | memory.o memory_log.o mixps.o handlers.o | ||
3488 | 96 | |||
3489 | 97 | mixps: $(FDF) $(MIXPS_OBJS) | ||
3490 | 98 | >>>>>>> MERGE-SOURCE | ||
3491 | 93 | $(FC) -o mixps \ | 99 | $(FC) -o mixps \ |
3492 | 94 | $(LDFLAGS) $(MIXPS_OBJS) $(NCPS) $(FDF) $(PSML_LIBS) $(XMLF90_LIBS) | 100 | $(LDFLAGS) $(MIXPS_OBJS) $(NCPS) $(FDF) $(PSML_LIBS) $(XMLF90_LIBS) |
3493 | 95 | #---------------------------------------------------------------------------- | 101 | #---------------------------------------------------------------------------- |
3494 | 96 | FRACTIONAL_OBJS= f2kcli.o m_io.o alloc.o interpolation.o fractional.o \ | 102 | FRACTIONAL_OBJS= f2kcli.o m_io.o alloc.o interpolation.o fractional.o \ |
3495 | 103 | <<<<<<< TREE | ||
3496 | 97 | atom_options.o memory.o memoryinfo.o sys.o \ | 104 | atom_options.o memory.o memoryinfo.o sys.o \ |
3497 | 98 | io.o pxf.o parallel.o periodic_table.o psml_die.o die.o | 105 | io.o pxf.o parallel.o periodic_table.o psml_die.o die.o |
3498 | 106 | ======= | ||
3499 | 107 | atom_options.o memory.o memory_log.o pseudopotential.o \ | ||
3500 | 108 | io.o pxf.o parallel.o periodic_table.o handlers.o sys.o | ||
3501 | 109 | >>>>>>> MERGE-SOURCE | ||
3502 | 99 | 110 | ||
3503 | 100 | fractional: $(FDF) $(FRACTIONAL_OBJS) $(NCPS) | 111 | fractional: $(FDF) $(FRACTIONAL_OBJS) $(NCPS) |
3504 | 101 | $(FC) -o fractional \ | 112 | $(FC) -o fractional \ |
3505 | @@ -128,19 +139,38 @@ | |||
3506 | 128 | sys.o: parallel.o | 139 | sys.o: parallel.o |
3507 | 129 | m_io.o: sys.o | 140 | m_io.o: sys.o |
3508 | 130 | io.o: sys.o | 141 | io.o: sys.o |
3509 | 131 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | ||
3510 | 132 | periodic_table.o: precision.o sys.o | 142 | periodic_table.o: precision.o sys.o |
3513 | 133 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 143 | memory.o: memory_log.o parallel.o |
3514 | 134 | memoryinfo.o: precision.o | 144 | memory_log.o: m_io.o parallel.o precision.o |
3515 | 135 | mixps.o: f2kcli.o interpolation.o periodic_table.o precision.o | 145 | mixps.o: f2kcli.o interpolation.o periodic_table.o precision.o |
3516 | 146 | <<<<<<< TREE | ||
3517 | 136 | die.o: parallel.o | 147 | die.o: parallel.o |
3518 | 148 | ======= | ||
3519 | 149 | mixps.o: pseudopotential.o | ||
3520 | 150 | handlers.o: memory_log.o | ||
3521 | 151 | >>>>>>> MERGE-SOURCE | ||
3522 | 137 | m_io.o: sys.o | 152 | m_io.o: sys.o |
3523 | 153 | <<<<<<< TREE | ||
3524 | 138 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o | 154 | alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o |
3525 | 139 | fractional.o: f2kcli.o periodic_table.o precision.o | 155 | fractional.o: f2kcli.o periodic_table.o precision.o |
3526 | 156 | ======= | ||
3527 | 157 | fractional.o: f2kcli.o periodic_table.o precision.o pseudopotential.o | ||
3528 | 158 | >>>>>>> MERGE-SOURCE | ||
3529 | 140 | atom_options.o: sys.o | 159 | atom_options.o: sys.o |
3530 | 160 | <<<<<<< TREE | ||
3531 | 141 | memory.o: alloc.o memoryinfo.o parallel.o precision.o | 161 | memory.o: alloc.o memoryinfo.o parallel.o precision.o |
3532 | 142 | memoryinfo.o: precision.o | 162 | memoryinfo.o: precision.o |
3533 | 143 | sys.o: parallel.o | 163 | sys.o: parallel.o |
3534 | 164 | ======= | ||
3535 | 165 | memory.o: memory_log.o parallel.o | ||
3536 | 166 | memory_log.o: m_io.o parallel.o precision.o | ||
3537 | 167 | pseudopotential.o: alloc.o atom_options.o interpolation.o precision.o sys.o | ||
3538 | 168 | >>>>>>> MERGE-SOURCE | ||
3539 | 144 | io.o: sys.o | 169 | io.o: sys.o |
3540 | 145 | periodic_table.o: precision.o sys.o | 170 | periodic_table.o: precision.o sys.o |
3541 | 171 | <<<<<<< TREE | ||
3542 | 146 | die.o: parallel.o | 172 | die.o: parallel.o |
3543 | 173 | ======= | ||
3544 | 174 | handlers.o: memory_log.o | ||
3545 | 175 | sys.o: parallel.o | ||
3546 | 176 | >>>>>>> MERGE-SOURCE | ||
3547 | 147 | 177 | ||
3548 | === added file 'Util/VCA/handlers.f' | |||
3549 | --- Util/VCA/handlers.f 1970-01-01 00:00:00 +0000 | |||
3550 | +++ Util/VCA/handlers.f 2016-07-19 08:21:24 +0000 | |||
3551 | @@ -0,0 +1,114 @@ | |||
3552 | 1 | !-------------------------------------------------- | ||
3553 | 2 | ! Stand-alone 'die' routine for use by libraries and | ||
3554 | 3 | ! low-level modules. | ||
3555 | 4 | ! | ||
3556 | 5 | ! Each program using the module or library needs to | ||
3557 | 6 | ! provide a routine with the proper interface, but | ||
3558 | 7 | ! accomodating the needs and conventions of the program. | ||
3559 | 8 | ! For example, in Siesta: | ||
3560 | 9 | ! | ||
3561 | 10 | ! - The use of a Siesta-specific 'mpi_siesta' module. | ||
3562 | 11 | ! - The need to have the pxf functionality. | ||
3563 | 12 | ! - The use of 'unit 6' as output. | ||
3564 | 13 | ! | ||
3565 | 14 | ! Routines using this functionality should include | ||
3566 | 15 | ! the following | ||
3567 | 16 | ! | ||
3568 | 17 | ! interface | ||
3569 | 18 | ! subroutine die(str) | ||
3570 | 19 | ! character(len=*), intent(in) :: str | ||
3571 | 20 | ! end subroutine die | ||
3572 | 21 | ! end interface | ||
3573 | 22 | ! | ||
3574 | 23 | !------------------------------------------------------ | ||
3575 | 24 | |||
3576 | 25 | subroutine die(str) | ||
3577 | 26 | |||
3578 | 27 | character(len=*), intent(in) :: str | ||
3579 | 28 | |||
3580 | 29 | write(6,'(a)') trim(str) | ||
3581 | 30 | write(0,'(a)') trim(str) | ||
3582 | 31 | write(6,'(a,i4)') 'Stopping Program from Node: ', Node | ||
3583 | 32 | write(0,'(a,i4)') 'Stopping Program from Node: ', Node | ||
3584 | 33 | call pxfflush(6) | ||
3585 | 34 | call pxfflush(0) | ||
3586 | 35 | call pxfabort() | ||
3587 | 36 | |||
3588 | 37 | end subroutine die | ||
3589 | 38 | |||
3590 | 39 | subroutine timer(str,i) | ||
3591 | 40 | |||
3592 | 41 | character(len=*), intent(in) :: str | ||
3593 | 42 | integer, intent(in) :: i | ||
3594 | 43 | end subroutine timer | ||
3595 | 44 | |||
3596 | 45 | !-------------------------------------------------- | ||
3597 | 46 | ! Stand-alone routine to capture error messages from | ||
3598 | 47 | ! the alloc module | ||
3599 | 48 | ! | ||
3600 | 49 | ! This functionality could be made more general, | ||
3601 | 50 | ! and use a uniform interface for all the utility | ||
3602 | 51 | ! modules developed in-house. (Let's say, call it | ||
3603 | 52 | ! 'error_report' with severity arguments, etc). | ||
3604 | 53 | ! | ||
3605 | 54 | ! Each program using the alloc module needs to | ||
3606 | 55 | ! provide a routine with the proper interface, but | ||
3607 | 56 | ! accomodating the needs and conventions of the program. | ||
3608 | 57 | ! For example, in Siesta: | ||
3609 | 58 | ! | ||
3610 | 59 | ! - The tagging of the message by Node. | ||
3611 | 60 | ! - The use of 'unit 6' as output and '0' as error. | ||
3612 | 61 | ! | ||
3613 | 62 | ! Routines using this functionality should include | ||
3614 | 63 | ! the following | ||
3615 | 64 | ! | ||
3616 | 65 | ! subroutine alloc_error_report(str,code) | ||
3617 | 66 | ! character(len=*), intent(in) :: str | ||
3618 | 67 | ! integer, intent(in) :: code | ||
3619 | 68 | ! end subroutine alloc_error_report | ||
3620 | 69 | ! | ||
3621 | 70 | !------------------------------------------------------ | ||
3622 | 71 | |||
3623 | 72 | subroutine alloc_error_report(str,code) | ||
3624 | 73 | |||
3625 | 74 | character(len=*), intent(in) :: str | ||
3626 | 75 | integer, intent(in) :: code | ||
3627 | 76 | |||
3628 | 77 | if (code == 0) then | ||
3629 | 78 | call die(str) | ||
3630 | 79 | else | ||
3631 | 80 | write(0,*) trim(str) | ||
3632 | 81 | write(6,*) trim(str) | ||
3633 | 82 | endif | ||
3634 | 83 | |||
3635 | 84 | end subroutine alloc_error_report | ||
3636 | 85 | !-------------------------------------------------- | ||
3637 | 86 | ! Stand-alone routine to capture memory events from | ||
3638 | 87 | ! the alloc module | ||
3639 | 88 | ! | ||
3640 | 89 | ! Each program using the alloc module needs to | ||
3641 | 90 | ! provide a routine with the proper interface, but | ||
3642 | 91 | ! accomodating the needs and conventions of the program. | ||
3643 | 92 | ! For example, in Siesta | ||
3644 | 93 | ! | ||
3645 | 94 | ! - The use of the memory_log module for reports | ||
3646 | 95 | ! | ||
3647 | 96 | ! Routines using this functionality should include | ||
3648 | 97 | ! the following | ||
3649 | 98 | ! | ||
3650 | 99 | ! subroutine alloc_memory_event(str,code) | ||
3651 | 100 | ! character(len=*), intent(in) :: str | ||
3652 | 101 | ! integer, intent(in) :: code | ||
3653 | 102 | ! end subroutine alloc_memory_event | ||
3654 | 103 | ! | ||
3655 | 104 | !------------------------------------------------------ | ||
3656 | 105 | |||
3657 | 106 | subroutine alloc_memory_event(bytes,name) | ||
3658 | 107 | use memory_log, only: memory_event | ||
3659 | 108 | |||
3660 | 109 | integer, intent(in) :: bytes | ||
3661 | 110 | character(len=*), intent(in) :: name | ||
3662 | 111 | |||
3663 | 112 | call memory_event(bytes,name) | ||
3664 | 113 | |||
3665 | 114 | end subroutine alloc_memory_event | ||
3666 | 0 | 115 | ||
3667 | === modified file 'version.info' | |||
3668 | --- version.info 2016-07-16 20:21:18 +0000 | |||
3669 | +++ version.info 2016-07-19 08:21:24 +0000 | |||
3670 | @@ -1,6 +1,12 @@ | |||
3671 | 1 | <<<<<<< TREE | ||
3672 | 1 | trunk-506--psml-81 | 2 | trunk-506--psml-81 |
3673 | 2 | 3 | ||
3674 | 3 | 4 | ||
3675 | 4 | 5 | ||
3676 | 5 | 6 | ||
3677 | 6 | 7 | ||
3678 | 8 | ======= | ||
3679 | 9 | siesta-trunk-503--gridxc-12 | ||
3680 | 10 | |||
3681 | 11 | |||
3682 | 12 | >>>>>>> MERGE-SOURCE |
Nick:
I think that this should be merged into the psml work to take advantage of the infrastructure for small libs there. Also, it would streamline the compilation of ATOM, which also uses libGridXC.