Merge lp:~albertog/siesta/gridxc-integration into lp:siesta/psml-support

Proposed by Alberto Garcia
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
Reviewer Review Type Date Requested Status
Nick Papior Approve
Alberto Garcia Approve
Review via email: mp+300428@code.launchpad.net

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.

To post a comment you must log in.
Revision history for this message
Alberto Garcia (albertog) wrote :

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.

Revision history for this message
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://code.launchpad.net/~albertog/siesta/gridxc-integration/+merge/300428
> 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

Revision history for this message
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).

Revision history for this message
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.

review: Approve
Revision history for this message
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?

Revision history for this message
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://code.launchpad.net/~albertog/siesta/gridxc-integration/+merge/300428
> You are the owner of lp:~albertog/siesta/gridxc-integration.

Revision history for this message
Nick Papior (nickpapior) wrote :

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Docs/gridxc-insert.CHANGES'
--- Docs/gridxc-insert.CHANGES 1970-01-01 00:00:00 +0000
+++ Docs/gridxc-insert.CHANGES 2016-07-19 08:21:24 +0000
@@ -0,0 +1,83 @@
1-----------------------------------------------------------------------
22016-07-07 Alberto Garcia siesta-trunk-503--gridxc-12
3Use external gridxc library
4
5The arch.make must now define the GRIDXC_ROOT variable
6(See Src/Sys/GRIDXC.make for the whole story, including
7parallel makes for Siesta and serial for Utils).
8
9See Src/Makefile and Util/Gen-basis/Makefile for new idioms.
10
11Src/SiestaXC is kept to facilitate updates.
12
13-----------------------------------------------------------------------
142016-05-29 Alberto Garcia siesta-trunk-503--gridxc-11
15Sync with trunk-503
16
17Note that the libGridXC code is kept in the Siesta tree for now.
18Also, Src/SiestaXC is kept to facilitate updates.
19
20-----------------------------------------------------------------------
212015-06-12 Alberto Garcia siesta-trunk-470--memory-accounting-10
22Revamped timer interface in gridxc. Build fixes
23
24* Revamped the timer interface in gridxc
25
26 Removed the internal timer framework, as it was not really needed
27 in its full glory. If cellxc timing information is needed in the
28 future to fine-tune the load-balancing mechanism, it should be
29 handled in a more light-weight manner.
30
31 Internal timings are passed over to the calling program through
32 the 'gridxc_timer_*' calls.
33
34 The MPI subsystem is instrumented for timing also. It calls
35 also the gridxc_timer_* routines if 'time_mpi_calls' is set
36 in 'gridxc_init'.
37
38* Use package-specific module names in MPI_instr
39
40 If a program uses several versions of the MPI interfaces,
41 the first appearing in the linking list will be used for
42 everything. This causes problems for package-specific
43 functionality.
44
45 The modules in MPI_instr are now renamed at the time
46 the 'generate.sh' script is run.
47
48* Bring in needed fixes in Util and elsewhere
49
50removed:
51 Src/gridxc/m_timer.F90
52 Util/Gen-basis/local_die.F
53added:
54 Util/Gen-basis/handlers.f
55 Util/VCA/handlers.f
56modified:
57 Src/gridxc/MPI_instr/Makefile
58 Src/gridxc/MPI_instr/generate.sh
59 Src/gridxc/MPI_instr/mpi__type_s.f90
60 Src/gridxc/MPI_instr/mpi__type_sv.f90
61 Src/gridxc/MPI_instr/mpi__type_v.f90
62 Src/gridxc/MPI_instr/mpi__type_vs.f90
63 Src/gridxc/MPI_instr/mpi_instr.f90
64 Src/gridxc/MPI_instr/mpi_interfaces.F
65 Src/gridxc/Testers/handlers.f90
66 Src/gridxc/Testers/test3.F90
67 Src/gridxc/atomxc.F90
68 Src/gridxc/cellxc.F90
69 Src/gridxc/fft3d.F90
70 Src/gridxc/gridxc.F90
71 Src/gridxc/gridxc_config.F90
72 Src/gridxc/makefile
73 Src/gridxc/radfft.f
74 Src/obj_setup.sh
75 Src/siesta_init.F
76 Util/Gen-basis/Makefile
77 Util/VCA/Makefile
78
79
80
81
82
83
084
=== modified file 'Src/MPI/Makefile'
--- Src/MPI/Makefile 2016-06-29 04:07:55 +0000
+++ Src/MPI/Makefile 2016-07-19 08:21:24 +0000
@@ -38,8 +38,8 @@
38 @cp *.mod ..38 @cp *.mod ..
39 @touch module_built39 @touch module_built
40#40#
41libmpi_f90.a: mpi.o mpi__include.o Interfaces.o mpi_siesta.o timer_mpi.o41libmpi_f90.a: mpi.o mpi__include.o Interfaces.o mpi_siesta.o
42 @$(AR) $(ARFLAGS_EXTRA) cru libmpi_f90.a mpi.o mpi_siesta.o mpi__include.o Interfaces.o timer_mpi.o42 @$(AR) $(ARFLAGS_EXTRA) cru libmpi_f90.a mpi.o mpi_siesta.o mpi__include.o Interfaces.o
43 -$(RANLIB) libmpi_f90.a43 -$(RANLIB) libmpi_f90.a
44#44#
45clean:45clean:
@@ -47,7 +47,3 @@
47 @rm -f module_built *.uses kind_explorer47 @rm -f module_built *.uses kind_explorer
48 @rm -f libmpi_f90.a48 @rm -f libmpi_f90.a
4949
50mpi_siesta.o: timer_mpi.o
51Interfaces.o: timer_mpi.o
52
53
5450
=== modified file 'Src/MPI/mpi__type_s.f90'
--- Src/MPI/mpi__type_s.f90 2009-07-09 15:35:11 +0000
+++ Src/MPI/mpi__type_s.f90 2016-07-19 08:21:24 +0000
@@ -17,8 +17,6 @@
17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe
18!18!
19!19!
20 USE TIMER_MPI_M, only: timer_mpi
21
22 IMPLICIT NONE20 IMPLICIT NONE
23 PRIVATE21 PRIVATE
2422
2523
=== modified file 'Src/MPI/mpi__type_sv.f90'
--- Src/MPI/mpi__type_sv.f90 2009-07-09 15:35:11 +0000
+++ Src/MPI/mpi__type_sv.f90 2016-07-19 08:21:24 +0000
@@ -17,8 +17,6 @@
17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe
18!18!
19!19!
20 USE TIMER_MPI_M, only: timer_mpi
21
22 IMPLICIT NONE20 IMPLICIT NONE
23 PRIVATE21 PRIVATE
2422
2523
=== modified file 'Src/MPI/mpi__type_v.f90'
--- Src/MPI/mpi__type_v.f90 2009-07-09 15:35:11 +0000
+++ Src/MPI/mpi__type_v.f90 2016-07-19 08:21:24 +0000
@@ -17,8 +17,6 @@
17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe
18!18!
19!19!
20 USE TIMER_MPI_M, only: timer_mpi
21
22 IMPLICIT NONE20 IMPLICIT NONE
23 PRIVATE21 PRIVATE
2422
2523
=== modified file 'Src/MPI/mpi__type_vs.f90'
--- Src/MPI/mpi__type_vs.f90 2009-07-09 15:35:11 +0000
+++ Src/MPI/mpi__type_vs.f90 2016-07-19 08:21:24 +0000
@@ -17,8 +17,6 @@
17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe17! (C) 1996 Michael Hennecke, RZ Universitaet Karlsruhe
18!18!
19!19!
20 USE TIMER_MPI_M, only: timer_mpi
21
22 IMPLICIT NONE20 IMPLICIT NONE
23 PRIVATE21 PRIVATE
2422
2523
=== modified file 'Src/MPI/mpi_siesta.f90'
--- Src/MPI/mpi_siesta.f90 2016-01-25 16:00:16 +0000
+++ Src/MPI/mpi_siesta.f90 2016-07-19 08:21:24 +0000
@@ -20,8 +20,6 @@
20 trueMPI_WAIT => MPI_WAIT, &20 trueMPI_WAIT => MPI_WAIT, &
21 trueMPI_WAITALL => MPI_WAITALL21 trueMPI_WAITALL => MPI_WAITALL
2222
23 USE TIMER_MPI_M, only: timer_mpi
24
25! The following construction allows to supplant MPI_Comm_World within SIESTA,23! The following construction allows to supplant MPI_Comm_World within SIESTA,
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.
27! JMS. Oct.201025! JMS. Oct.2010
2826
=== removed file 'Src/MPI/timer_mpi.F90'
--- Src/MPI/timer_mpi.F90 2016-01-25 16:00:16 +0000
+++ Src/MPI/timer_mpi.F90 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
1! ---
2! Copyright (C) 1996-2016 The SIESTA group
3! This file is distributed under the terms of the
4! GNU General Public License: see COPYING in the top directory
5! or http://www.gnu.org/copyleft/gpl.txt .
6! See Docs/Contributors.txt for a list of contributors.
7! ---
8MODULE timer_mpi_m
9
10! Disconnectable interface to siesta's timer routine.
11! J.M.Soler. May.2009
12
13CONTAINS
14
15 SUBROUTINE timer_mpi( name, opt )
16 character(len=*), intent(in):: name
17 integer, intent(in):: opt
18
19#ifdef MPI_TIMING
20 external timer
21 call timer( name, opt )
22#endif
23
24 END SUBROUTINE timer_mpi
25
26END MODULE timer_mpi_m
270
=== modified file 'Src/Makefile'
--- Src/Makefile 2016-07-08 00:16:48 +0000
+++ Src/Makefile 2016-07-19 08:21:24 +0000
@@ -44,6 +44,7 @@
44 /^m_ts_io.o:/s/m_tbt_kpoints.o//" Makefile > tmp.Makefile44 /^m_ts_io.o:/s/m_tbt_kpoints.o//" Makefile > tmp.Makefile
45 @mv tmp.Makefile Makefile45 @mv tmp.Makefile Makefile
46#46#
47<<<<<<< TREE
47ARCH_MAKE?=$(MAIN_OBJDIR)/arch.make48ARCH_MAKE?=$(MAIN_OBJDIR)/arch.make
48include $(ARCH_MAKE)49include $(ARCH_MAKE)
49#50#
@@ -57,6 +58,10 @@
57INCFLAGS:= $(NETCDF_INCFLAGS) $(PSML_INCFLAGS) $(NCPS_INCFLAGS) \58INCFLAGS:= $(NETCDF_INCFLAGS) $(PSML_INCFLAGS) $(NCPS_INCFLAGS) \
58 $(PSOP_INCFLAGS) $(XMLF90_INCFLAGS) $(INCFLAGS)59 $(PSOP_INCFLAGS) $(XMLF90_INCFLAGS) $(INCFLAGS)
59#60#
61=======
62include arch.make
63INCFLAGS:= -I. $(NETCDF_INCFLAGS) $(INCFLAGS)
64>>>>>>> MERGE-SOURCE
60# For removing any -ipo compilation in sub directories...65# For removing any -ipo compilation in sub directories...
61# Later compilers are also having this enabled, and it lets you66# Later compilers are also having this enabled, and it lets you
62# specify what to not be used in libraries.67# specify what to not be used in libraries.
@@ -96,7 +101,7 @@
96 chempot.o coceri.o coxmol.o cross.o compute_norm.o\101 chempot.o coceri.o coxmol.o cross.o compute_norm.o\
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 \
98 fft.o dhscf.o constr.o diagk_file.o \103 fft.o dhscf.o constr.o diagk_file.o \
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 \
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 \
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 \
102 fixed.o interpolation.o gradient.o gradientlomem.o grdsam.o \107 fixed.o interpolation.o gradient.o gradientlomem.o grdsam.o \
@@ -130,7 +135,7 @@
130 precision.o sys.o m_cell.o files.o \135 precision.o sys.o m_cell.o files.o \
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 \
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 \
133 atmfuncs.o listsc.o memoryinfo.o m_memory.o sorting.o \138 atmfuncs.o listsc.o memory_log.o sorting.o \
134 atomlist.o atm_types.o old_atmfuncs.o radial.o \139 atomlist.o atm_types.o old_atmfuncs.o radial.o \
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 \
136 basis_types.o xml.o basis_specs.o basis_io.o\141 basis_types.o xml.o basis_specs.o basis_io.o\
@@ -164,7 +169,8 @@
164 write_orb_indx.o \169 write_orb_indx.o \
165 m_hs_matrix.o kpoint_convert.o m_glob_sparse.o\170 m_hs_matrix.o kpoint_convert.o m_glob_sparse.o\
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 \
167 save_density_matrix.o \172 save_density_matrix.o alloc_error_report.o\
173 alloc_memory_event.o\
168 m_rhog.o rhofft.o m_diis.o compute_energies.o \174 m_rhog.o rhofft.o m_diis.o compute_energies.o \
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\
170 m_target_stress.o\176 m_target_stress.o\
@@ -179,8 +185,26 @@
179OBJS += m_cite.o185OBJS += m_cite.o
180186
181#--------------------------------------------------------------187#--------------------------------------------------------------
188<<<<<<< TREE
182189
183INCFLAGS:=$(INCFLAGS) $(NETCDF_INCFLAGS)190INCFLAGS:=$(INCFLAGS) $(NETCDF_INCFLAGS)
191=======
192# FoX whatnot
193#
194# FoX build targets:
195FoX_configured=FoX/.config
196FoX_built=FoX/.FoX
197#
198# This is how we pick up modules and libraries for FoX:
199FoX_FCFLAGS=`FoX/FoX-config --fcflags`
200FoX_LIBS=`FoX/FoX-config --libs --wcml`
201#
202# And add them to global compiler flags:
203INCFLAGS:=$(INCFLAGS) $(FoX_FCFLAGS)
204#
205# First, it needs to be configured. This may have been done
206# by the main SIESTA configure, but in case not:
207>>>>>>> MERGE-SOURCE
184#208#
185FC_DEFAULT:=$(FC)209FC_DEFAULT:=$(FC)
186FC_SERIAL?=$(FC_DEFAULT)210FC_SERIAL?=$(FC_DEFAULT)
@@ -200,6 +224,7 @@
200 FFFLAGS="$(FFLAGS:$(IPO_FLAG)=)" module)224 FFFLAGS="$(FFLAGS:$(IPO_FLAG)=)" module)
201#225#
202#--------------------------------------------------------------226#--------------------------------------------------------------
227<<<<<<< TREE
203XC=libSiestaXC.a228XC=libSiestaXC.a
204$(XC): 229$(XC):
205 (cd SiestaXC ; $(MAKE) \230 (cd SiestaXC ; $(MAKE) \
@@ -207,6 +232,11 @@
207 "VPATH_ROOT=$(VPATH)" \232 "VPATH_ROOT=$(VPATH)" \
208 "INCFLAGS=-I../MPI" \233 "INCFLAGS=-I../MPI" \
209 "FFLAGS=$(FFLAGS:$(IPO_FLAG)=)" module )234 "FFLAGS=$(FFLAGS:$(IPO_FLAG)=)" module )
235=======
236include $(GRIDXC_ROOT)/gridxc.mk
237XC=$(GRIDXC_LIBS)
238INCFLAGS:= $(INCFLAGS) $(GRIDXC_INCFLAGS)
239>>>>>>> MERGE-SOURCE
210#--------------------------------------------------------------240#--------------------------------------------------------------
211FDF=libfdf.a241FDF=libfdf.a
212$(FDF): 242$(FDF):
@@ -355,10 +385,10 @@
355 (cd psoplib/src ; $(MAKE) ARCH_MAKE=$(ARCH_MAKE) clean)385 (cd psoplib/src ; $(MAKE) ARCH_MAKE=$(ARCH_MAKE) clean)
356 @if [ -d MPI ] ; then (cd MPI && $(MAKE) clean ) ; fi386 @if [ -d MPI ] ; then (cd MPI && $(MAKE) clean ) ; fi
357 (cd Libs ; $(MAKE) clean )387 (cd Libs ; $(MAKE) clean )
358 (cd SiestaXC ; $(MAKE) clean )
359388
360# DO NOT DELETE THIS LINE - used by make depend389# DO NOT DELETE THIS LINE - used by make depend
361alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o390alloc_error_report.o: parallel.o
391alloc_memory_event.o: memory_log.o
362amn.o: alloc.o atmfuncs.o atomlist.o m_orderbands.o m_trialorbitalclass.o392amn.o: alloc.o atmfuncs.o atomlist.o m_orderbands.o m_trialorbitalclass.o
363amn.o: matel_registry.o mneighb.o new_matel.o parallel.o parallelsubs.o393amn.o: matel_registry.o mneighb.o new_matel.o parallel.o parallelsubs.o
364amn.o: precision.o siesta2wannier90.o siesta_geom.o sys.o394amn.o: precision.o siesta2wannier90.o siesta_geom.o sys.o
@@ -389,16 +419,16 @@
389born_charge.o: siesta_geom.o siesta_options.o sparse_matrices.o419born_charge.o: siesta_geom.o siesta_options.o sparse_matrices.o
390broadcast_basis.o: atm_types.o ldau_specs.o m_mpi_utils.o parallel.o radial.o420broadcast_basis.o: atm_types.o ldau_specs.o m_mpi_utils.o parallel.o radial.o
391broadcast_projections.o: m_trialorbitalclass.o parallel.o siesta2wannier90.o421broadcast_projections.o: m_trialorbitalclass.o parallel.o siesta2wannier90.o
392broyden_optim.o: m_broyddj_nocomm.o m_memory.o parallel.o precision.o422broyden_optim.o: m_broyddj_nocomm.o memory_log.o parallel.o precision.o
393broyden_optim.o: siesta_options.o sys.o units.o423broyden_optim.o: siesta_options.o sys.o units.o
394bsc_cellxc.o: alloc.o bsc_xcmod.o cellxc_mod.o mesh.o moremeshsubs.o parallel.o424bsc_cellxc.o: alloc.o bsc_xcmod.o cellxc_mod.o mesh.o moremeshsubs.o parallel.o
395bsc_cellxc.o: parallelsubs.o precision.o sys.o425bsc_cellxc.o: parallelsubs.o precision.o sys.o
396bsc_xcmod.o: parallel.o precision.o sys.o426bsc_xcmod.o: parallel.o precision.o sys.o
397cart2frac.o: sys.o427cart2frac.o: sys.o
398cdiag.o: alloc.o m_spin.o memoryinfo.o parallel.o precision.o sys.o428cdiag.o: alloc.o diagmemory.o m_spin.o parallel.o precision.o sys.o
399cell_broyden_optim.o: m_broyddj_nocomm.o parallel.o precision.o sys.o units.o429cell_broyden_optim.o: m_broyddj_nocomm.o parallel.o precision.o sys.o units.o
400cell_broyden_optim.o: zmatrix.o430cell_broyden_optim.o: zmatrix.o
401cell_fire_optim.o: alloc.o m_fdf_global.o m_fire.o m_memory.o parallel.o431cell_fire_optim.o: alloc.o m_fdf_global.o m_fire.o memory_log.o parallel.o
402cell_fire_optim.o: precision.o siesta_options.o sys.o zmatrix.o432cell_fire_optim.o: precision.o siesta_options.o sys.o zmatrix.o
403cellsubs.o: precision.o433cellsubs.o: precision.o
404cellxc_mod.o: bsc_xcmod.o sys.o434cellxc_mod.o: bsc_xcmod.o sys.o
@@ -463,8 +493,9 @@
463diagk_file.o: fermid.o iowfs_netcdf.o parallel.o parallelsubs.o precision.o493diagk_file.o: fermid.o iowfs_netcdf.o parallel.o parallelsubs.o precision.o
464diagk_file.o: sys.o writewave.o494diagk_file.o: sys.o writewave.o
465diagkp.o: alloc.o fermid.o parallel.o parallelsubs.o precision.o sys.o495diagkp.o: alloc.o fermid.o parallel.o parallelsubs.o precision.o sys.o
466diagon.o: alloc.o densematrix.o m_diagon.o m_memory.o parallel.o parallelsubs.o496diagmemory.o: precision.o
467diagon.o: precision.o siesta_options.o sys.o497diagon.o: alloc.o densematrix.o m_diagon.o memory_log.o parallel.o
498diagon.o: parallelsubs.o precision.o siesta_options.o sys.o
468diagonalizeHk.o: alloc.o atomlist.o densematrix.o m_orderbands.o m_spin.o499diagonalizeHk.o: alloc.o atomlist.o densematrix.o m_orderbands.o m_spin.o
469diagonalizeHk.o: parallel.o parallelsubs.o precision.o siesta2wannier90.o500diagonalizeHk.o: parallel.o parallelsubs.o precision.o siesta2wannier90.o
470diagonalizeHk.o: sparse_matrices.o units.o501diagonalizeHk.o: sparse_matrices.o units.o
@@ -488,8 +519,8 @@
488ener3lomem.o: alloc.o globalise.o m_mpi_utils.o onmod.o precision.o519ener3lomem.o: alloc.o globalise.o m_mpi_utils.o onmod.o precision.o
489extrapolon.o: parallel.o precision.o sys.o520extrapolon.o: parallel.o precision.o sys.o
490fermid.o: errorf.o parallel.o precision.o sys.o521fermid.o: errorf.o parallel.o precision.o sys.o
491fft.o: alloc.o fft1d.o m_timer.o mesh.o parallel.o parallelsubs.o precision.o522fft.o: alloc.o m_fft_gpfa.o m_timer.o mesh.o parallel.o parallelsubs.o
492fft.o: sys.o523fft.o: precision.o sys.o
493fft1d.o: parallel.o precision.o sys.o524fft1d.o: parallel.o precision.o sys.o
494final_H_f_stress.o: alloc.o atomlist.o dnaefs.o files.o grdsam.o kinefsm.o525final_H_f_stress.o: alloc.o atomlist.o dnaefs.o files.o grdsam.o kinefsm.o
495final_H_f_stress.o: ldau.o ldau_specs.o m_dipol.o m_energies.o m_forces.o526final_H_f_stress.o: ldau.o ldau_specs.o m_dipol.o m_energies.o m_forces.o
@@ -600,7 +631,6 @@
600m_iostruct.o: alloc.o files.o m_mpi_utils.o parallel.o precision.o631m_iostruct.o: alloc.o files.o m_mpi_utils.o parallel.o precision.o
601m_iostruct.o: siesta_geom.o sys.o units.o632m_iostruct.o: siesta_geom.o sys.o units.o
602m_kinetic.o: precision.o633m_kinetic.o: precision.o
603m_memory.o: memoryinfo.o parallel.o sys.o
604m_mpi_utils.o: precision.o sys.o634m_mpi_utils.o: precision.o sys.o
605m_noccbands.o: alloc.o atmfuncs.o m_spin.o parallel.o precision.o siesta_geom.o635m_noccbands.o: alloc.o atmfuncs.o m_spin.o parallel.o precision.o siesta_geom.o
606m_noccbands.o: sys.o636m_noccbands.o: sys.o
@@ -656,16 +686,21 @@
656matel_registry.o: m_trialorbitalclass.o precision.o radial.o spher_harm.o sys.o686matel_registry.o: m_trialorbitalclass.o precision.o radial.o spher_harm.o sys.o
657md_out.o: files.o m_energies.o precision.o sys.o units.o687md_out.o: files.o m_energies.o precision.o sys.o units.o
658md_utils.o: precision.o688md_utils.o: precision.o
659memory.o: alloc.o memoryinfo.o parallel.o precision.o689memory.o: memory_log.o parallel.o
660memoryinfo.o: precision.o690memory_log.o: m_io.o parallel.o precision.o
661mesh.o: precision.o691mesh.o: precision.o
662meshcomm.o: mesh.o precision.o692meshcomm.o: mesh.o precision.o
663meshdscf.o: alloc.o atomlist.o m_dscfcomm.o meshphi.o parallel.o parallelsubs.o693meshdscf.o: alloc.o atomlist.o m_dscfcomm.o meshphi.o parallel.o parallelsubs.o
664meshdscf.o: precision.o694meshdscf.o: precision.o
665meshphi.o: alloc.o precision.o695meshphi.o: alloc.o precision.o
666meshsubs.o: alloc.o atm_types.o atmfuncs.o cellsubs.o cellxc_mod.o chkgmx.o696meshsubs.o: alloc.o atm_types.o atmfuncs.o cellsubs.o cellxc_mod.o chkgmx.o
697<<<<<<< TREE
667meshsubs.o: fft1d.o mesh.o meshphi.o moremeshsubs.o parallel.o parallelsubs.o698meshsubs.o: fft1d.o mesh.o meshphi.o moremeshsubs.o parallel.o parallelsubs.o
668meshsubs.o: precision.o siesta_cml.o sys.o699meshsubs.o: precision.o siesta_cml.o sys.o
700=======
701meshsubs.o: m_fft_gpfa.o mesh.o meshphi.o moremeshsubs.o parallel.o
702meshsubs.o: parallelsubs.o precision.o radial.o siesta_cml.o sys.o
703>>>>>>> MERGE-SOURCE
669metaforce.o: alloc.o parallel.o precision.o sys.o704metaforce.o: alloc.o parallel.o precision.o sys.o
670minvec.o: cellsubs.o precision.o sorting.o sys.o705minvec.o: cellsubs.o precision.o sorting.o sys.o
671mixer.o: atomlist.o m_broyden_mixing.o m_fire_mixing.o m_pulay.o m_spin.o706mixer.o: atomlist.o m_broyden_mixing.o m_fire_mixing.o m_pulay.o m_spin.o
@@ -734,8 +769,8 @@
734proximity_check.o: siesta_geom.o siesta_options.o units.o769proximity_check.o: siesta_geom.o siesta_options.o units.o
735radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o770radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o
736radial.o: alloc.o interpolation.o precision.o xml.o771radial.o: alloc.o interpolation.o precision.o xml.o
737rdiag.o: alloc.o m_diagon.o memoryinfo.o parallel.o precision.o sys.o772rdiag.o: alloc.o diagmemory.o m_diagon.o parallel.o precision.o sys.o
738read_options.o: files.o m_target_stress.o memoryinfo.o parallel.o precision.o773read_options.o: diagmemory.o files.o m_target_stress.o parallel.o precision.o
739read_options.o: siesta_cml.o siesta_options.o sys.o units.o774read_options.o: siesta_cml.o siesta_options.o sys.o units.o
740read_xc_info.o: parallel.o precision.o sys.o775read_xc_info.o: parallel.o precision.o sys.o
741readsp.o: parallel.o precision.o sys.o776readsp.o: parallel.o precision.o sys.o
@@ -789,8 +824,8 @@
789siesta_analysis.o: siesta_geom.o siesta_options.o sparse_matrices.o units.o824siesta_analysis.o: siesta_geom.o siesta_options.o sparse_matrices.o units.o
790siesta_analysis.o: write_subs.o writewave.o zmatrix.o825siesta_analysis.o: write_subs.o writewave.o zmatrix.o
791siesta_cmlsubs.o: files.o parallel.o siesta_cml.o timestamp.o 826siesta_cmlsubs.o: files.o parallel.o siesta_cml.o timestamp.o
792siesta_end.o: alloc.o bands.o densematrix.o fixed.o m_dscfcomm.o m_pulay.o827siesta_end.o: bands.o densematrix.o fixed.o m_dscfcomm.o m_pulay.o m_rhog.o
793siesta_end.o: m_rhog.o m_wallclock.o meshdscf.o meshphi.o moremeshsubs.o828siesta_end.o: m_wallclock.o memory_log.o meshdscf.o meshphi.o moremeshsubs.o
794siesta_end.o: parallel.o siesta_cml.o siesta_cmlsubs.o siesta_master.o829siesta_end.o: parallel.o siesta_cml.o siesta_cmlsubs.o siesta_master.o
795siesta_end.o: sparse_matrices.o timestamp.o830siesta_end.o: sparse_matrices.o timestamp.o
796siesta_forces.o: compute_dm.o compute_energies.o compute_max_diff.o831siesta_forces.o: compute_dm.o compute_energies.o compute_max_diff.o
@@ -806,10 +841,10 @@
806siesta_init.o: ioxv.o kpoint_grid.o kpoint_pdos.o ksvinit.o m_check_supercell.o841siesta_init.o: ioxv.o kpoint_grid.o kpoint_pdos.o ksvinit.o m_check_supercell.o
807siesta_init.o: m_cite.o m_energies.o m_eo.o m_forces.o m_gamma.o m_iostruct.o842siesta_init.o: m_cite.o m_energies.o m_eo.o m_forces.o m_gamma.o m_iostruct.o
808siesta_init.o: m_mpi_utils.o m_rmaxh.o m_spin.o m_steps.o m_timer.o843siesta_init.o: m_mpi_utils.o m_rmaxh.o m_spin.o m_steps.o m_timer.o
809siesta_init.o: m_wallclock.o metaforce.o molecularmechanics.o parallel.o844siesta_init.o: m_wallclock.o memory_log.o metaforce.o molecularmechanics.o
810siesta_init.o: parallelsubs.o projected_DOS.o siesta_cmlsubs.o siesta_geom.o845siesta_init.o: parallel.o parallelsubs.o projected_DOS.o siesta_cmlsubs.o
811siesta_init.o: siesta_options.o sparse_matrices.o struct_init.o sys.o timer.o846siesta_init.o: siesta_geom.o siesta_options.o sparse_matrices.o struct_init.o
812siesta_init.o: timestamp.o ts_init.o writewave.o zmatrix.o847siesta_init.o: sys.o timer.o timestamp.o ts_init.o writewave.o zmatrix.o
813siesta_master.o: iopipes.o iosockets.o m_fdf_global.o precision.o sys.o848siesta_master.o: iopipes.o iosockets.o m_fdf_global.o precision.o sys.o
814siesta_move.o: atomlist.o broyden_optim.o cell_broyden_optim.o849siesta_move.o: atomlist.o broyden_optim.o cell_broyden_optim.o
815siesta_move.o: cell_fire_optim.o dynamics.o fire_optim.o ioxv.o m_energies.o850siesta_move.o: cell_fire_optim.o dynamics.o fire_optim.o ioxv.o m_energies.o
@@ -873,7 +908,6 @@
873zmatrix.o: alloc.o m_cell.o parallel.o precision.o siesta_geom.o sys.o units.o908zmatrix.o: alloc.o m_cell.o parallel.o precision.o siesta_geom.o sys.o units.o
874aux_proj.o: atom.o909aux_proj.o: atom.o
875band.o: bands.o910band.o: bands.o
876diagmemory.o: memoryinfo.o
877f90sockets.o: fsockets.o911f90sockets.o: fsockets.o
878fsiesta.o: fsiesta_sockets.o912fsiesta.o: fsiesta_sockets.o
879listsc_module.o: listsc.o913listsc_module.o: listsc.o
880914
=== modified file 'Src/SiestaXC/makefile'
--- Src/SiestaXC/makefile 2015-07-19 05:13:23 +0000
+++ Src/SiestaXC/makefile 2016-07-19 08:21:24 +0000
@@ -17,7 +17,7 @@
17module: libSiestaXC.a17module: libSiestaXC.a
18 cp *.mod *.a ..18 cp *.mod *.a ..
19#19#
20SIESTA_SRCS= alloc.F90 bessph.f cellsubs.f debugmpi.F \20SIESTA_SRCS= alloc.F90 memory_log.F90 bessph.f cellsubs.f debugmpi.F \
21 chkgmx.f fft1d.F interpolation.f90 \21 chkgmx.f fft1d.F interpolation.f90 \
22 minvec.f m_io.f moreParallelSubs.F90 \22 minvec.f m_io.f moreParallelSubs.F90 \
23 m_timer.F90 timer_tree.F90 m_walltime.f90 parallel.F \23 m_timer.F90 timer_tree.F90 m_walltime.f90 parallel.F \
@@ -71,7 +71,7 @@
71 rm -fr *.o *.*d *.a siestaXC.tgz71 rm -fr *.o *.*d *.a siestaXC.tgz
72#72#
73# DO NOT DELETE THIS LINE - used by make depend73# DO NOT DELETE THIS LINE - used by make depend
74alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o74alloc.o: memory_log.o
75am05.o: precision.o sys.o75am05.o: precision.o sys.o
76atomxc.o: alloc.o ggaxc.o ldaxc.o mesh1d.o precision.o radfft.o76atomxc.o: alloc.o ggaxc.o ldaxc.o mesh1d.o precision.o radfft.o
77atomxc.o: sys.o vdwxc.o xcmod.o77atomxc.o: sys.o vdwxc.o xcmod.o
@@ -91,6 +91,7 @@
91ldaxc.o: precision.o sys.o91ldaxc.o: precision.o sys.o
92m_io.o: sys.o92m_io.o: sys.o
93m_timer.o: m_io.o m_walltime.o moreParallelSubs.o parallel.o precision.o sys.o93m_timer.o: m_io.o m_walltime.o moreParallelSubs.o parallel.o precision.o sys.o
94memory_log.o: precision.o parallel.o m_io.o
94mesh1d.o: precision.o95mesh1d.o: precision.o
95mesh3d.o: alloc.o debugxc.o parallel.o precision.o sorting.o sys.o96mesh3d.o: alloc.o debugxc.o parallel.o precision.o sorting.o sys.o
96minvec.o: cellsubs.o precision.o sorting.o sys.o97minvec.o: cellsubs.o precision.o sorting.o sys.o
9798
=== modified file 'Src/SiestaXC/siestaxc.F90'
--- Src/SiestaXC/siestaxc.F90 2015-06-09 13:34:25 +0000
+++ Src/SiestaXC/siestaxc.F90 2016-07-19 08:21:24 +0000
@@ -20,7 +20,7 @@
20! Extra utilities placed here for non-siesta users20! Extra utilities placed here for non-siesta users
21! See correspondig modules for usage documentation21! See correspondig modules for usage documentation
22! nfft ! Get allowed sizes for FFTs22! nfft ! Get allowed sizes for FFTs
23! alloc_report ! Set and print allocation report23! memory_report ! Set and print allocation report
24! setDebugOutputUnit ! Initialize debug report24! setDebugOutputUnit ! Initialize debug report
25! closeDebugOutputFile ! Print debug report25! closeDebugOutputFile ! Print debug report
26! timer_report ! Print report of CPU times26! timer_report ! Print report of CPU times
@@ -429,7 +429,7 @@
429!429!
430!******************************************************************************430!******************************************************************************
431!431!
432! SUBROUTINE alloc_report( level, unit, file, printNow, threshold )432! SUBROUTINE memory_report( level, unit, file, printNow, threshold )
433! Sets the output file for the allocation report433! Sets the output file for the allocation report
434! INPUT (optional):434! INPUT (optional):
435! integer :: level : Level (detail) of report435! integer :: level : Level (detail) of report
@@ -445,14 +445,14 @@
445! level=2 : detailed report created but printed only upon request445! level=2 : detailed report created but printed only upon request
446! level=3 : detailed report printed at every new memory peak446! level=3 : detailed report printed at every new memory peak
447! level=4 : print every individual reallocation or deallocation447! level=4 : print every individual reallocation or deallocation
448! If unit is present, alloc_report merely takes note of it for448! If unit is present, memory_report merely takes note of it for
449! future use, assuming that it has been already open outside.449! future use, assuming that it has been already open outside.
450! In this case, file is not used.450! In this case, file is not used.
451! If unit is absent, and file is present, a file with that451! If unit is absent, and file is present, a file with that
452! name is open for future use.452! name is open for future use.
453! If both arguments are absent, a file named 'alloc_report'453! If both arguments are absent, a file named 'alloc_report'
454! is open for future use.454! is open for future use.
455! If alloc_report is called with printNow=.true. several times in455! If memory_report is called with printNow=.true. several times in
456! a program, with the same unit or file argument, the subsequent 456! a program, with the same unit or file argument, the subsequent
457! reports are written consecutively in the same file, each with a 457! reports are written consecutively in the same file, each with a
458! time stamp header.458! time stamp header.
@@ -712,7 +712,7 @@
712! Extra utilities placed here for non-siesta users712! Extra utilities placed here for non-siesta users
713! See correspondig modules for usage documentation713! See correspondig modules for usage documentation
714 USE fft1d, only: nfft ! Get allowed sizes for FFTs714 USE fft1d, only: nfft ! Get allowed sizes for FFTs
715 USE alloc, only: alloc_report ! Set and print allocation report715 USE memory_log, only: memory_report ! Set and print allocation report
716#ifdef DEBUG_XC716#ifdef DEBUG_XC
717 USE debugXC, only: setDebugOutputUnit ! Set debug report717 USE debugXC, only: setDebugOutputUnit ! Set debug report
718 USE debugXC, only: closeDebugOutputFile ! Print debug report718 USE debugXC, only: closeDebugOutputFile ! Print debug report
719719
=== added file 'Src/Sys/GRIDXC.make'
--- Src/Sys/GRIDXC.make 1970-01-01 00:00:00 +0000
+++ Src/Sys/GRIDXC.make 2016-07-19 08:21:24 +0000
@@ -0,0 +1,55 @@
1#
2# This file is part of the SIESTA package.
3#
4# Copyright (c) Fundacion General Universidad Autonoma de Madrid:
5# E.Artacho, J.Gale, A.Garcia, J.Junquera, P.Ordejon, D.Sanchez-Portal
6# and J.M.Soler, 1996- .
7#
8# Use of this software constitutes agreement with the full conditions
9# given in the SIESTA license, as signed by all legitimate users.
10#
11SIESTA_ARCH=gfortran-macosx64-openmpi
12# The only thing you should change is the location of the libraries
13# on your computer
14#
15FC=mpif90
16FC_SERIAL=gfortran
17#
18GRIDXC_ROOT=$(HOME)/lib/gfortran/gridxc-mpi
19GRIDXC_SERIAL_ROOT=$(HOME)/lib/gfortran/gridxc
20#
21FC_ASIS=$(FC)
22#
23###FFLAGS= -g -O2 # -Wall
24FFLAGS_CHECKS= -O0 -g -fcheck=all
25FFLAGS= -O0 -g -fcheck=all
26FFLAGS_DEBUG= -g -O0
27RANLIB=echo
28COMP_LIBS=
29#
30NETCDF_ROOT=/usr/local
31NETCDF_INCFLAGS=-I$(NETCDF_ROOT)/include
32FPPFLAGS_CDF=-DCDF
33NETCDF_LIBS= -L$(NETCDF_ROOT)/lib -lnetcdff
34#
35MPI_INTERFACE=libmpi_f90.a
36MPI_INCLUDE=. # Note . for no-op
37FPPFLAGS_MPI=-DMPI
38
39LIBS=-L/opt/scalapack/openmpi-1.6.1-gfortran/lib \
40 -lscalapack -ltmg -lreflapack -lrefblas \
41 $(NETCDF_LIBS)
42
43SYS=nag
44FPPFLAGS= $(FPPFLAGS_CDF) $(FPPFLAGS_MPI) -DF2003
45#
46#
47.F.o:
48 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $<
49.f.o:
50 $(FC) -c $(FFLAGS) $(INCFLAGS) $<
51.F90.o:
52 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $<
53.f90.o:
54 $(FC) -c $(FFLAGS) $(INCFLAGS) $<
55#
056
=== modified file 'Src/alloc.F90'
--- Src/alloc.F90 2016-01-28 13:41:07 +0000
+++ Src/alloc.F90 2016-07-19 08:21:24 +0000
@@ -9,7 +9,10 @@
9!9!
10! ==================================================================10! ==================================================================
11! Allocation, reallocation, and deallocation utility routines11! Allocation, reallocation, and deallocation utility routines
12! for pointers
13!
12! Written by J.M.Soler. May 2000.14! Written by J.M.Soler. May 2000.
15! Re-organized by A. Garcia, June 2015.
13! ==================================================================16! ==================================================================
14! SUBROUTINE alloc_default( old, new, restore, &17! SUBROUTINE alloc_default( old, new, restore, &
15! copy, shrink, imin, routine )18! copy, shrink, imin, routine )
@@ -45,44 +48,6 @@
45! Notice that, if the restore call is skipped, the new defaults will48! Notice that, if the restore call is skipped, the new defaults will
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.
47! ==================================================================50! ==================================================================
48! SUBROUTINE alloc_report( level, unit, file, printNow, threshold )
49! Sets the output file for the allocation report
50! INPUT (optional):
51! integer :: level : Level (detail) of report
52! integer :: unit : Output file unit
53! character*(*):: file : Output file name
54! logical :: printNow : If present & true => print report now
55! real(dp) :: threshold : Memory threshold (in bytes) to print
56! the memory use of any given array
57! BEHAVIOR:
58! The detail/extent of the report increses with the value of level:
59! level=0 : no report at all (the default)
60! level=1 : only total memory peak and where it occurred
61! level=2 : detailed report created but printed only upon request
62! level=3 : detailed report printed at every new memory peak
63! level=4 : print every individual reallocation or deallocation
64! If unit is present, alloc_report merely takes note of it for
65! future use, assuming that it has been already open outside.
66! In this case, file is not used.
67! If unit is absent, and file is present, a file with that
68! name is open for future use.
69! If both arguments are absent, a file named 'alloc_report'
70! is open for future use.
71! If alloc_report is called with printNow=.true. several times in
72! a program, with the same unit or file argument, the subsequent
73! reports are written consecutively in the same file, each with a
74! time stamp header.
75! If threshold is not present, threshold=0 is assumed.
76! In parallel execution, the report sections that involve every
77! reallocation (levels 1, 3, and 4) are written only by node 0.
78! The section that is written upon request (level 2) is written
79! only by the node with the highest peak of memory up to that time,
80! but it contains a summary of the memory used by all other nodes.
81! In parallel execution, the nodes that share the same file
82! system (e.g. different chip cores or NFS-connected nodes) write
83! on the same file. Otherwise they write on files with the same name
84! in their local disks.
85! ==================================================================
86! SUBROUTINE re_alloc( array, [i1min,] i1max,51! SUBROUTINE re_alloc( array, [i1min,] i1max,
87! [[i2min,] i2max, [[i3min,] i3max]],52! [[i2min,] i2max, [[i3min,] i3max]],
88! name, routine, copy, shrink )53! name, routine, copy, shrink )
@@ -138,22 +103,21 @@
138! zero (integer and real), .false. (logical), or blank (character).103! zero (integer and real), .false. (logical), or blank (character).
139! If imin>imax for any dimension, the array pointer returns104! If imin>imax for any dimension, the array pointer returns
140! associated to a zero-size array.105! associated to a zero-size array.
141! Besides allocating or reallocating the array, re_alloc keeps a count106!
142! of memory usage (and prints a report in a file previously fixed by a107! Besides allocating or reallocating the array, re_alloc calls
143! call to alloc_report). Thus, it is not recommended to call re_alloc108! the external routine 'alloc_memory_event' with the number
144! to reallocate an array not allocated by it the first time.109! of bytes involved in the allocation and a string identifier
145! If name is not present, the memory count associated to the110! built from the 'routine' and 'name' arguments: 'routine@name'.
146! allocation/deallocation is still made, but the allocation report111! Clients of this module can process this information at will.
147! will account the array under the generic name 'unknown'.112!
148! The routine argument is NOT used to classify the counting of113! Error conditions are reported via a callback to the external
149! memory usage. The classification uses only the name argument.114! routine 'alloc_error_report', with a string message and an
150! This is because a pointer may be allocated in one routine and115! integer code.
151! deallocated in a different one (i.e. when it is used to return an116! Clients of this module can process this information at will.
152! array whose size is not known in advance). However, the routine117!
153! argument is reported when alloc_report=4, and it is also used to118! In future, an extra 'stat' argument might be included in the calls
154! report in which routine the memory peack occurs. If you want the119! to re_alloc and de_alloc for finer control.
155! routine name to be used for classification, you should include it120!
156! as part of the name argument, like in name='matInvert '//'aux'.
157! ==================================================================---121! ==================================================================---
158! SUBROUTINE de_alloc( array, name, routine )122! SUBROUTINE de_alloc( array, name, routine )
159! INPUT (optional):123! INPUT (optional):
@@ -170,69 +134,47 @@
170! Equally, arrays allocated or reallocated by re_alloc should be 134! Equally, arrays allocated or reallocated by re_alloc should be
171! deallocated by dealloc.135! deallocated by dealloc.
172! ==================================================================---136! ==================================================================---
173! SUBROUTINE alloc_count( delta_size, type, name, routine )
174! INPUT:
175! integer :: delta_size : +/-size(array)
176! + => allocation
177! - => deallocation
178! character :: type : 'I' => integer
179! 'E' => integer*8
180! 'R' => real*4
181! 'D' => real*8
182! 'L' => logical
183! 'S' => character (string)
184! INPUT (optional):
185! character(len=*) :: name : Actual array name or a label for it
186! character(len=*) :: routine : Name of the calling routine
187! or routine section
188! USAGE:
189! integer, allocatable:: intArray(:)
190! double precision,allocatable:: doubleArray(:)
191! complex, allocatable:: complexArray(:)
192! allocate( intArray(n), doubleArray(n), complexArray(n) )
193! call alloc_count( +n, 'I', 'intArray', programName )
194! call alloc_count( +n, 'D', 'doubleArray', programName )
195! call alloc_count( +2*n, 'R', 'complexArray', programName )
196! deallocate( intArray, doubleArray, complexArray )
197! call alloc_count( -n, 'I', 'intArray', programName )
198! call alloc_count( -n, 'D', 'doubleArray', programName )
199! call alloc_count( -2*n, 'R', 'complexArray', programName )
200!
201! ==================================================================---
202
203MODULE alloc137MODULE alloc
204138!
205 use precision, only: sp ! Single precision real type139! This module has no external build dependencies
206 use precision, only: dp ! Double precision real type140! Final executables must resolve the symbols for the two handlers
207 use parallel, only: Node ! My processor node index141! alloc_memory_event
208 use parallel, only: Nodes ! Number of parallel processors142! alloc_error_report
209 use parallel, only: ionode ! Am I the I/O processor?143! with interfaces specified below
210 use parallel, only: parallel_init ! Initialize parallel variables144!
211 use sys, only: die ! Termination routine
212 use m_io, only: io_assign ! Get and reserve an available IO unit
213#ifdef MPI
214! use mpi_siesta
215 use mpi_siesta, only: MPI_AllGather
216 use mpi_siesta, only: MPI_Barrier
217 use mpi_siesta, only: MPI_Bcast
218 use mpi_siesta, only: MPI_Comm_World
219 use mpi_siesta, only: MPI_double_precision
220 use mpi_siesta, only: MPI_integer
221 use mpi_siesta, only: MPI_character
222#endif
223
224 implicit none145 implicit none
225146
226PUBLIC :: &147PUBLIC :: &
227 alloc_default, &! Sets allocation defaults148 alloc_default, &! Sets allocation defaults
228 alloc_report, &! Sets log report defaults
229 re_alloc, &! Allocation/reallocation149 re_alloc, &! Allocation/reallocation
230 de_alloc, &! Deallocation150 de_alloc, &! Deallocation
231 alloc_count, &! Memory counting for external allocs
232 allocDefaults ! Derived type to hold allocation defaults151 allocDefaults ! Derived type to hold allocation defaults
233152
234PRIVATE ! Nothing is declared public beyond this point153PRIVATE ! Nothing is declared public beyond this point
235154
155integer, parameter :: sp = selected_real_kind(5,10)
156integer, parameter :: dp = selected_real_kind(10,100)
157
158! Interfaces to external routines that must be provided
159! by the calling program
160!
161interface
162 ! Error message and integer code
163 ! If 'code' is 0, this is the last call in a series
164 ! (see below for usage)
165 subroutine alloc_error_report(str,code)
166 character(len=*), intent(in) :: str
167 integer, intent(in) :: code
168 end subroutine alloc_error_report
169 !
170 ! Logger for memory events
171 !
172 subroutine alloc_memory_event(bytes,name)
173 integer, intent(in) :: bytes
174 character(len=*), intent(in) :: name
175 end subroutine alloc_memory_event
176end interface
177
236 interface de_alloc178 interface de_alloc
237 module procedure &179 module procedure &
238 dealloc_i1, dealloc_i2, dealloc_i3, &180 dealloc_i1, dealloc_i2, dealloc_i3, &
@@ -265,14 +207,6 @@
265 DEFAULT_NAME = 'unknown_name' ! Array name default207 DEFAULT_NAME = 'unknown_name' ! Array name default
266 character(len=*), parameter :: &208 character(len=*), parameter :: &
267 DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default209 DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default
268 integer, save :: &
269 REPORT_LEVEL = 0, &! Level (detail) of allocation report
270 REPORT_UNIT = 0 ! Output file unit for report
271 character(len=50), save :: &
272 REPORT_FILE = 'alloc_report' ! Output file name for report
273 real(dp), save :: &
274 REPORT_THRESHOLD = 0 ! Memory threshold (in bytes) to print
275 ! the memory use of any given array
276210
277 ! Derived type to hold allocation default options211 ! Derived type to hold allocation default options
278 type allocDefaults212 type allocDefaults
@@ -286,28 +220,6 @@
286 ! Object to hold present allocation default options220 ! Object to hold present allocation default options
287 type(allocDefaults), save :: DEFAULT221 type(allocDefaults), save :: DEFAULT
288222
289 ! Internal auxiliary type for a binary tree
290 type TREE
291 character(len=80) :: name ! Name of an allocated array
292 real(DP) :: mem ! Present memory use of the array
293 real(DP) :: max ! Maximum memory use of the array
294 real(DP) :: peak ! Memory use of the array during
295 ! peak of total memory
296 type(TREE), pointer :: left ! Pointer to data of allocated arrays
297 ! preceeding in alphabetical order
298 type(TREE), pointer :: right ! Pointer to data of allocated arrays
299 ! trailing in alphabetical order
300 end type TREE
301
302 ! Global variables used to store allocation data
303 real(DP), parameter :: MBYTE = 1.e6_dp
304 type(TREE), pointer, save :: REPORT_TREE
305 real(DP), save :: TOT_MEM = 0._dp
306 real(DP), save :: PEAK_MEM = 0._dp
307 character(len=80), save :: PEAK_ARRAY = ' '
308 character(len=32), save :: PEAK_ROUTINE = ' '
309 integer, save :: MAX_LEN = 0
310
311 ! Other common variables223 ! Other common variables
312 integer :: IERR224 integer :: IERR
313 logical :: ASSOCIATED_ARRAY, NEEDS_ALLOC, NEEDS_COPY, NEEDS_DEALLOC225 logical :: ASSOCIATED_ARRAY, NEEDS_ALLOC, NEEDS_COPY, NEEDS_DEALLOC
@@ -336,74 +248,6 @@
336END SUBROUTINE alloc_default248END SUBROUTINE alloc_default
337249
338! ==================================================================250! ==================================================================
339
340SUBROUTINE alloc_report( level, unit, file, printNow, threshold )
341
342implicit none
343
344integer, optional, intent(in) :: level, unit
345character(len=*), optional, intent(in) :: file
346logical, optional, intent(in) :: printNow
347real(dp), optional, intent(in) :: threshold
348
349logical open
350
351#ifdef MPI
352integer MPIerror
353#endif
354
355if (present(level)) then
356 REPORT_LEVEL = level
357end if
358
359if (node == 0) then
360 if (present(unit)) then ! Assume that unit has been open outside
361 if (unit > 0) then
362 REPORT_UNIT = unit
363 if (present(file)) then
364 REPORT_FILE = file
365 else
366 REPORT_FILE = 'unknown'
367 end if
368 end if
369 else if (present(file)) then ! If file is the same, do nothing
370 if (file /= REPORT_FILE) then ! Check if file was open outside
371 REPORT_FILE = file
372 inquire( file=REPORT_FILE, opened=open, number=REPORT_UNIT )
373 if (.not.open) then ! Open new file
374 call io_assign(REPORT_UNIT)
375 open( REPORT_UNIT, file=REPORT_FILE, status='unknown')
376 write(REPORT_UNIT,*) ' ' ! Overwrite previous reports
377 end if
378 end if
379 else if (REPORT_UNIT==0) then ! No unit has been open yet
380 REPORT_FILE = 'alloc_report'
381 call io_assign(REPORT_UNIT)
382 open( REPORT_UNIT, file=REPORT_FILE, status='unknown')
383 write(REPORT_UNIT,*) ' ' ! Overwrite previous reports
384 end if
385end if
386
387#ifdef MPI
388! Distribute information to other nodes and open REPORT_UNIT
389call MPI_Bcast(REPORT_LEVEL,1,MPI_integer,0,MPI_Comm_World,MPIerror)
390call MPI_Bcast(REPORT_UNIT,1,MPI_integer,0,MPI_Comm_World,MPIerror)
391call MPI_Bcast(REPORT_FILE,50,MPI_character,0,MPI_Comm_World,MPIerror)
392! JMS: open file only in node 0
393!if (node > 0) then
394! open( REPORT_UNIT, file=REPORT_FILE )
395!end if
396#endif
397
398if (present(threshold)) REPORT_THRESHOLD = threshold
399
400if (present(printNow)) then
401 if (printNow) call print_report( )
402end if
403
404END SUBROUTINE alloc_report
405
406! ==================================================================
407! Integer array reallocs251! Integer array reallocs
408! ==================================================================252! ==================================================================
409253
@@ -447,7 +291,6 @@
447if (NEEDS_DEALLOC .and. .not.NEEDS_COPY) then291if (NEEDS_DEALLOC .and. .not.NEEDS_COPY) then
448 call alloc_count( -size(old_array), type, name, routine )292 call alloc_count( -size(old_array), type, name, routine )
449 deallocate(old_array,stat=IERR)293 deallocate(old_array,stat=IERR)
450 call alloc_err( IERR, name, routine, old_bounds )
451end if294end if
452295
453! Allocate new space296! Allocate new space
@@ -1816,8 +1659,53 @@
18161659
1817! ==================================================================1660! ==================================================================
18181661
1662SUBROUTINE alloc_err( ierr, name, routine, bounds )
1663implicit none
1664
1665integer, intent(in) :: ierr
1666character(len=*), optional, intent(in) :: name
1667character(len=*), optional, intent(in) :: routine
1668integer, dimension(:,:), optional, intent(in) :: bounds
1669
1670integer i
1671character(len=128) :: msg
1672
1673if (ierr/=0) then
1674 write(msg,*) 'alloc_err: allocate status error', ierr
1675 call alloc_error_report(trim(msg),1)
1676 if (present(name).and.present(routine)) then
1677 write(msg,*) 'alloc_err: array ', name, &
1678 ' requested by ', routine
1679 call alloc_error_report(trim(msg),2)
1680 elseif (present(name)) then
1681 write(msg,*) 'alloc_err: array ', name, &
1682 ' requested by unknown'
1683 call alloc_error_report(trim(msg),3)
1684 elseif (present(routine)) then
1685 write(msg,*) 'alloc_err: array unknown', &
1686 ' requested by ', routine
1687 call alloc_error_report(trim(msg),4)
1688 endif
1689 if (present(bounds)) then
1690 write(msg,'(a,i3,2i10)') ('alloc_err: dim, lbound, ubound:', &
1691 i,bounds(1,i),bounds(2,i), &
1692 i=1,size(bounds,dim=2))
1693 call alloc_error_report(trim(msg),5)
1694 endif
1695 call alloc_error_report("alloc_err: end of error report",0)
1696end if
1697
1698END SUBROUTINE alloc_err
1699
1700! ==================================================================
1701
1819SUBROUTINE alloc_count( delta_size, type, name, routine )1702SUBROUTINE alloc_count( delta_size, type, name, routine )
18201703
1704!
1705! This version simply computes the total size and calls
1706! the external routine alloc_memory_event with the size
1707! in bytes and a string identifier of the form 'routine@name'.
1708!
1821implicit none1709implicit none
18221710
1823integer, intent(in) :: delta_size ! +/-size(array)1711integer, intent(in) :: delta_size ! +/-size(array)
@@ -1830,114 +1718,32 @@
1830character(len=*), optional, intent(in) :: name1718character(len=*), optional, intent(in) :: name
1831character(len=*), optional, intent(in) :: routine1719character(len=*), optional, intent(in) :: routine
18321720
1833character(len=32) :: aname, rname1721character(len=32) :: aname
1834character(len=1) :: memType, task1722integer :: bytes
1835real(DP) :: delta_mem
1836logical :: newPeak
1837logical, save :: header_written = .false.
1838logical, save :: tree_nullified = .false.
1839integer :: memSize
1840
1841! Set routine name
1842if (present(routine)) then
1843 rname = routine
1844else
1845 rname = DEFAULT%routine
1846end if
1847
1848! Call siesta counting routine 'memory'
1849! Switched off in Aug.2009, and made 'memory' call alloc_count instead
1850! if (delta_size > 0) then
1851! task = 'A'
1852! else
1853! task = 'D'
1854! end if
1855! select case( type )
1856! case ('R') ! Real --> single
1857! memType = 'S'
1858! memSize = abs(delta_size)
1859! case ('S') ! Character (string) --> integer/4
1860! memType = 'I'
1861! memSize = abs(delta_size) / type_mem('I')
1862! case default
1863! memType = type
1864! memSize = abs(delta_size)
1865! end select
1866! call memory( task, memType, memSize, trim(rname) )
1867
1868
1869if (REPORT_LEVEL <= 0) return
18701723
1871! Compound routine+array name1724! Compound routine+array name
1872if (present(name) .and. present(routine)) then1725if (present(name) .and. present(routine)) then
1873 aname = trim(routine)//' '//name1726 aname = trim(routine)//'@'//name
1874else if (present(name) .and. DEFAULT%routine/=DEFAULT_ROUTINE) then1727else if (present(name) .and. DEFAULT%routine/=DEFAULT_ROUTINE) then
1875 aname = trim(DEFAULT%routine)//' '//name1728 aname = trim(DEFAULT%routine)//'@'//name
1876else if (present(name)) then1729else if (present(name)) then
1877 aname = name1730 aname = trim(DEFAULT_ROUTINE)//'@'//name
1878else if (present(routine)) then1731else if (present(routine)) then
1879 aname = trim(routine)//' '//DEFAULT_NAME1732 aname = trim(routine)//'@'//DEFAULT_NAME
1880else if (DEFAULT%routine/=DEFAULT_ROUTINE) then1733else if (DEFAULT%routine/=DEFAULT_ROUTINE) then
1881 aname = trim(DEFAULT%routine)//' '//DEFAULT_NAME1734 aname = trim(DEFAULT%routine)//'@'//DEFAULT_NAME
1882else1735else
1883 aname = DEFAULT_ROUTINE//' '//DEFAULT_NAME1736 aname = DEFAULT_ROUTINE//'@'//DEFAULT_NAME
1884end if1737end if
18851738
1886MAX_LEN = max( MAX_LEN, len(trim(aname)) )
1887
1888! Find memory increment and total allocated memory1739! Find memory increment and total allocated memory
1889delta_mem = delta_size * type_mem(type)1740bytes = delta_size * type_mem(type)
1890TOT_MEM = TOT_MEM + delta_mem1741
1891if (TOT_MEM > PEAK_MEM+0.5_dp) then1742call alloc_memory_event(bytes,trim(aname))
1892 newPeak = .true.1743
1893 PEAK_MEM = TOT_MEM1744CONTAINS
1894 PEAK_ARRAY = aname1745
1895 PEAK_ROUTINE = rname1746 INTEGER FUNCTION type_mem( var_type )
1896! print'(/,a,f18.6),a,/)',
1897! 'alloc_count: Memory peak =', PEAK_MEM/MBYTE, ' Mbytes'
1898else
1899 newPeak = .false.
1900end if
1901
1902! Add/subtract/classify array memory
1903if (REPORT_LEVEL > 1) then
1904 if (.not.tree_nullified) then
1905 nullify(report_tree)
1906 tree_nullified = .true.
1907 end if
1908 call tree_add( report_tree, aname, delta_mem )
1909 if (newPeak) call tree_peak( report_tree )
1910end if
1911
1912! Print report, but only in node 0, as not all
1913! processors may follow the same route here
1914! The detail/extent of the report increses with the value of level:
1915! level=0 : no report at all (the default)
1916! level=1 : only total memory peak and where it occurred
1917! level=2 : detailed report created but printed only upon request
1918! level=3 : detailed report printed at every new memory peak
1919! level=4 : print every individual reallocation or deallocation
1920
1921
1922if (newPeak .and. (REPORT_LEVEL==1 .or. REPORT_LEVEL==3) .and. &
1923 node == 0) then
1924 call print_report(.false.)
1925end if
1926
1927if (REPORT_LEVEL == 4 .and. node == 0) then
1928 if (.not.header_written) then
1929 write(REPORT_UNIT,'(/,a7,9x,1x,a4,28x,1x,2a15)') &
1930 'Routine', 'Name', 'Incr. (MB)', 'Total (MB)'
1931 header_written = .true.
1932 end if
1933 write(REPORT_UNIT,'(a16,1x,a32,1x,2f15.6)') &
1934 rname, aname, delta_mem/MBYTE, TOT_MEM/MBYTE
1935end if
1936END SUBROUTINE alloc_count
1937
1938! ==================================================================
1939
1940INTEGER FUNCTION type_mem( var_type )
1941!1747!
1942! It is not clear that the sizes assumed are universal for1748! It is not clear that the sizes assumed are universal for
1943! non-Cray machines...1749! non-Cray machines...
@@ -1971,274 +1777,48 @@
1971case default1777case default
1972 write(message,"(2a)") &1778 write(message,"(2a)") &
1973 'alloc_count: ERROR: unknown type = ', var_type1779 'alloc_count: ERROR: unknown type = ', var_type
1974 call die(trim(message))1780 call alloc_error_report(trim(message),0)
1975end select1781end select
19761782
1977END FUNCTION type_mem1783END FUNCTION type_mem
19781784
1979! ==================================================================1785END SUBROUTINE alloc_count
1980
1981RECURSIVE SUBROUTINE tree_add( t, name, delta_mem )
1982
1983implicit none
1984type(TREE), pointer :: t
1985character(len=*), intent(in) :: name
1986real(DP), intent(in) :: delta_mem
1987
1988logical, save :: warn_negative = .true.
1989
1990if (.not.associated(t)) then
1991 allocate( t )
1992 t%name = name
1993 t%mem = delta_mem
1994 t%max = delta_mem
1995 t%peak = 0._dp
1996 nullify( t%left, t%right )
1997else if (name == t%name) then
1998 t%mem = t%mem + delta_mem
1999 ! The abs is to handle the case of apparent de_allocs without re_allocs,
2000 ! caused by routine/name argument mismatches
2001 if (abs(t%mem) > abs(t%max)) t%max = t%mem
2002else if ( llt(name,t%name) ) then
2003 call tree_add( t%left, name, delta_mem )
2004else
2005 call tree_add( t%right, name, delta_mem )
2006end if
2007
2008if (warn_negative .and. t%mem<0._dp) then
2009 call parallel_init() ! Make sure that node and Nodes are initialized
2010 if (Node==0) then
2011 write(6,'(/,a,/,2a,/,a,f18.0,a)') &
2012 'WARNING: alloc-realloc-dealloc name mismatch', &
2013 ' Name: ', trim(name), &
2014 ' Size: ', t%mem, ' Bytes'
2015 if (Nodes>1) write(6,'(9x,a,i6)') 'Node:', Node
2016 write(6,'(9x,a)') 'Subsequent mismatches will not be reported'
2017 warn_negative = .false. ! Print this warning only once
2018 end if
2019end if
2020
2021END SUBROUTINE tree_add
2022
2023! ==================================================================
2024
2025RECURSIVE SUBROUTINE tree_peak( t )
2026
2027implicit none
2028type(TREE), pointer :: t
2029
2030if (.not.associated(t)) return
2031
2032t%peak = t%mem
2033call tree_peak( t%left )
2034call tree_peak( t%right )
2035
2036END SUBROUTINE tree_peak
2037
2038! ==================================================================
2039
2040RECURSIVE SUBROUTINE tree_print( t )
2041
2042implicit none
2043type(TREE), pointer :: t
2044
2045if (.not.associated(t)) return
2046
2047call tree_print( t%left )
2048
2049if (abs(t%max) >= REPORT_THRESHOLD) then
2050 write(REPORT_UNIT,'(a,1x,3f15.6,f9.2)') &
2051 t%name(1:MAX_LEN), t%mem/MBYTE, t%max/MBYTE, t%peak/MBYTE, &
2052 100._dp * t%peak / (PEAK_MEM + tiny(PEAK_MEM) )
2053end if
2054
2055call tree_print( t%right )
2056
2057END SUBROUTINE tree_print
2058
2059! ==================================================================
2060
2061SUBROUTINE print_report(all)
2062
2063implicit none
2064
2065! Whether MPI reductions should be performed
2066! If, not then ensure that no MPI calls are performed
2067logical, intent(in), optional :: all
2068
2069character(len=80) :: string = 'Name'
2070character :: date*8, time*10, zone*5
2071integer :: iNode, peakNode
2072real(dp) :: maxPeak
2073real(dp),allocatable:: nodeMem(:), nodePeak(:)
2074logical :: lall
2075
2076#ifdef MPI
2077integer :: MPIerror
2078#endif
2079
2080! Enables parallel call of print-report
2081lall = .true.
2082if ( present(all) ) lall = all
2083
2084! Only if MPI should all be used
2085if ( lall ) then
2086! Make sure that variables node and Nodes are initialized
2087call parallel_init()
2088end if
2089
2090! Allocate and initialize two small arrays
2091allocate( nodeMem(0:Nodes-1), nodePeak(0:Nodes-1) )
2092! initialize (in case all == .false.)
2093nodeMem = 0._dp
2094nodePeak = 0._dp
2095
2096! Initializations for Nodes=1 (serial case)
2097nodeMem(node) = TOT_MEM
2098nodePeak(node) = PEAK_MEM
2099peakNode = node
2100
2101! In parallel, find the memory values of all nodes
2102#ifdef MPI
2103if (Nodes > 1 .and. lall ) then
2104 ! Gather the present and peak memories of all nodes
2105 call MPI_AllGather( TOT_MEM, 1, MPI_double_precision, &
2106 nodeMem, 1, MPI_double_precision, &
2107 MPI_COMM_WORLD, MPIerror )
2108 call MPI_AllGather( PEAK_MEM, 1, MPI_double_precision, &
2109 nodePeak, 1, MPI_double_precision, &
2110 MPI_COMM_WORLD, MPIerror )
2111 ! Find the node with the highest peak of memory
2112 maxPeak = 0
2113 do iNode = 0,Nodes-1
2114 if (nodePeak(iNode) > maxPeak) then
2115 peakNode = iNode
2116 maxPeak = nodePeak(iNode)
2117 end if
2118 end do ! iNode
2119 ! Change the writing node for the peak-node information
2120 if (node==0 .and. peakNode/=0) close( unit=REPORT_UNIT )
2121 call MPI_Barrier( MPI_COMM_WORLD, MPIerror )
2122 if (node==peakNode .and. peakNode/=0) &
2123 open( unit=REPORT_UNIT, file=REPORT_FILE, &
2124 status='unknown', position='append' )
2125end if ! (Nodes>1)
2126#endif
2127
2128! The report is printed by the highest-peak node
2129if (node == peakNode) then
2130
2131 ! AG: Commented out to allow multiple batches of information
2132 ! if (REPORT_LEVEL < 4) rewind(REPORT_UNIT)
2133
2134 call date_and_time( date, time, zone )
2135
2136 write(REPORT_UNIT,'(/,a,16a)') &
2137 'Allocation summary at ', &
2138 date(1:4),'/',date(5:6),'/',date(7:8),' ', &
2139 time(1:2),':',time(3:4),':',time(5:10),' ', &
2140 zone(1:3),':',zone(4:5)
2141
2142 if (Nodes > 1) then
2143 write(REPORT_UNIT,'(/,(a,f18.6,a))') &
2144 'Present memory all nodes : ', sum(nodeMem)/MBYTE, ' MB', &
2145 'Added peak mem all nodes : ', sum(nodePeak)/MBYTE, ' MB', &
2146 'Min peak memory in a node: ', minval(nodePeak)/MBYTE, ' MB', &
2147 'Max peak memory in a node: ', maxval(nodePeak)/MBYTE, ' MB'
2148! Impractical for many nodes:
2149! write(REPORT_UNIT,'(/,a,/,(i6,f12.6))') &
2150! 'Memory peaks of individual nodes (Mb):', &
2151! (iNode,nodePeak(iNode)/MBYTE,iNode=0,Nodes-1)
2152 write(REPORT_UNIT,'(/,a,i6)') &
2153 'Maximum peak of memory occurred in node:', peakNode
2154 end if
2155
2156 write(REPORT_UNIT,'(2(/,a,f18.6,a),/,2a,/,2a)') &
2157 'Present memory allocation: ', TOT_MEM/MBYTE, ' MB', &
2158 'Maximum memory allocation: ', PEAK_MEM/MBYTE, ' MB', &
2159 'Occurred after allocating: ', trim(PEAK_ARRAY), &
2160 'In routine: ', trim(PEAK_ROUTINE)
2161
2162 if (REPORT_LEVEL > 1) then
2163 if (REPORT_THRESHOLD > 0._dp) then
2164 write(REPORT_UNIT,'(/,a,f12.6,a,/,a,1x,3a15,a9)') &
2165 'Allocated sizes (in MByte) of arrays larger than ', &
2166 REPORT_THRESHOLD/MBYTE, ' MB:', &
2167 string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%'
2168 else
2169 write(REPORT_UNIT,'(/,a,/,a,1x,3a15,a9)') &
2170 'Allocated array sizes (in MByte):', &
2171 string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%'
2172 end if
2173 call tree_print( report_tree )
2174 end if
2175
2176end if ! (node == peakNode)
2177
2178! Change again the writing node for the rest of the report
2179#ifdef MPI
2180if (node==peakNode .and. peakNode/=0) close( unit=REPORT_UNIT )
2181if (lall) call MPI_Barrier( MPI_COMM_WORLD, MPIerror )
2182if (node==0 .and. peakNode/=0) &
2183 open( unit=REPORT_UNIT, file=REPORT_FILE, &
2184 status='unknown', position='append' )
2185#endif
2186
2187deallocate( nodeMem, nodePeak )
2188
2189END SUBROUTINE print_report
2190
2191! ==================================================================
2192
2193SUBROUTINE alloc_err( ierr, name, routine, bounds )
2194#ifdef DEBUG
2195 use debugMpi, only : mpiUnit
2196#endif
2197implicit none
2198
2199integer, intent(in) :: ierr
2200character(len=*), optional, intent(in) :: name
2201character(len=*), optional, intent(in) :: routine
2202integer, dimension(:,:), optional, intent(in) :: bounds
2203
2204integer i
2205
2206if (ierr/=0) then
2207 if (ionode) print*, 'alloc_err: allocate status error', ierr
2208 if (present(name).and.present(routine)) then
2209 if (ionode) print*, 'alloc_err: array ', name, &
2210 ' requested by ', routine
2211 elseif (present(name)) then
2212 if (ionode) print*, 'alloc_err: array ', name, &
2213 ' requested by unknown'
2214 elseif (present(routine)) then
2215 if (ionode) print* , 'alloc_err: array unknown', &
2216 ' requested by ', routine
2217 endif
2218 if (ionode.and.present(bounds)) &
2219 print '(a,i3,2i10)', ('alloc_err: dim, lbound, ubound:', &
2220 i,bounds(1,i),bounds(2,i), &
2221 i=1,size(bounds,dim=2))
2222#ifdef DEBUG
2223 write(mpiUnit,*) 'alloc_err: allocate status error', ierr
2224 if (present(name).and.present(routine)) then
2225 write(mpiUnit,*) 'alloc_err: array ', name, ' requested by ', routine
2226 elseif (present(name)) then
2227 write(mpiUnit,*) 'alloc_err: array ', name, ' requested by unknown'
2228 elseif (present(routine)) then
2229 write(mpiUnit,*) 'alloc_err: array unknown requested by ', routine
2230 endif
2231 write(mpiUnit,'(a,i3,2i10)') ('alloc_err: dim, lbound, ubound:', &
2232 i,bounds(1,i),bounds(2,i), &
2233 i=1,size(bounds,dim=2))
2234 call pxfflush(mpiUnit)
2235#endif
2236
2237 call die('alloc_err: allocate error')
2238end if
2239
2240END SUBROUTINE alloc_err
2241
2242! ==================================================================
22431786
2244END MODULE alloc1787END MODULE alloc
1788
1789#ifdef __TEST__MODULE__ALLOC__
1790! Optional test code
1791!
1792program testalloc
1793use alloc, only: re_alloc, de_alloc
1794
1795real, pointer :: x(:) => null()
1796real(kind=kind(1.d0)), pointer :: y(:,:) => null()
1797
1798call re_alloc(x,1,10,"x","testalloc")
1799call re_alloc(y,-3,4,1,3,"y","testalloc")
1800print *, "Shape of x: ", shape(x)
1801print *, "Shape of y: ", shape(y)
1802call de_alloc(x,"x","testalloc")
1803call de_alloc(y,"y","testalloc")
1804
1805end program testalloc
1806!
1807! Handlers
1808! Note: In systems with weak symbols, these handlers
1809! could be compiled marked as such. (Future extension)
1810!
1811subroutine alloc_memory_event(bytes,name)
1812integer, intent(in) :: bytes
1813character(len=*), intent(in) :: name
1814write(*,*) "alloc: allocated ", bytes, "bytes for "//trim(name)
1815end subroutine alloc_memory_event
1816
1817subroutine alloc_error_report(name,code)
1818character(len=*), intent(in) :: name
1819integer, intent(in) :: code
1820write(*,*) "alloc error: "//trim(name)
1821end subroutine alloc_error_report
1822
1823#endif
1824
22451825
=== added file 'Src/alloc_error_report.F'
--- Src/alloc_error_report.F 1970-01-01 00:00:00 +0000
+++ Src/alloc_error_report.F 2016-07-19 08:21:24 +0000
@@ -0,0 +1,55 @@
1!--------------------------------------------------
2! Stand-alone routine to capture error messages from
3! the alloc module
4!
5! This functionality could be made more general,
6! and use a uniform interface for all the utility
7! modules developed in-house. (Let's say, call it
8! 'error_report' with severity arguments, etc).
9!
10! Each program using the alloc module needs to
11! provide a routine with the proper interface, but
12! accomodating the needs and conventions of the program.
13! For example, in Siesta:
14!
15! - The tagging of the message by Node.
16! - The use of 'unit 6' as output and '0' as error.
17!
18! Routines using this functionality should include
19! the following
20!
21! subroutine alloc_error_report(str,code)
22! character(len=*), intent(in) :: str
23! integer, intent(in) :: code
24! end subroutine alloc_error_report
25!
26!------------------------------------------------------
27
28 subroutine alloc_error_report(str,code)
29
30 use parallel, only : Node
31
32 character(len=*), intent(in) :: str
33 integer, intent(in) :: code
34
35! Even though formally (in MPI 1.X), only the master node
36! can do I/O, in those systems that allow it having each
37! node state its complaint can be useful.
38
39 write(6,'(a,i0,1x,a)') 'Node: ', Node, trim(str)
40 write(0,'(a,i0,1x,a)') 'Node: ', Node, trim(str)
41
42 ! The convention for this reporter, which can
43 ! send multi-call messages, is that code=0
44 ! signals the end of the series
45 ! We choose to kill the program
46 !
47 ! This is actually too stringent, as a given failed
48 ! allocation could be handled more gracefully at
49 ! the point at which it is made. But in absence of
50 ! a 'stat' argument for the re_alloc and de_alloc
51 ! routines, this is the only thing we can do....
52 !
53 if (code == 0) call die(str)
54
55 end subroutine alloc_error_report
056
=== added file 'Src/alloc_memory_event.F'
--- Src/alloc_memory_event.F 1970-01-01 00:00:00 +0000
+++ Src/alloc_memory_event.F 2016-07-19 08:21:24 +0000
@@ -0,0 +1,30 @@
1!--------------------------------------------------
2! Stand-alone routine to capture memory events from
3! the alloc module
4!
5! Each program using the alloc module needs to
6! provide a routine with the proper interface, but
7! accomodating the needs and conventions of the program.
8! For example, in Siesta
9!
10! - The use of the memory_log module for reports
11!
12! Routines using this functionality should include
13! the following
14!
15! subroutine alloc_memory_event(str,code)
16! character(len=*), intent(in) :: str
17! integer, intent(in) :: code
18! end subroutine alloc_memory_event
19!
20!------------------------------------------------------
21
22 subroutine alloc_memory_event(bytes,name)
23 use memory_log, only: memory_event
24
25 integer, intent(in) :: bytes
26 character(len=*), intent(in) :: name
27
28 call memory_event(bytes,name)
29
30 end subroutine alloc_memory_event
031
=== modified file 'Src/atom.F'
--- Src/atom.F 2016-07-12 13:38:13 +0000
+++ Src/atom.F 2016-07-19 08:21:24 +0000
@@ -48,8 +48,8 @@
48 use fdf48 use fdf
49 use m_ncps, only: pseudopotential_t => froyen_ps_t49 use m_ncps, only: pseudopotential_t => froyen_ps_t
50#ifndef BSC_CELLXC50#ifndef BSC_CELLXC
51 use siestaXC, only: atomXC ! XC for a spherical charge51 use gridXC, only: atomXC=>gridxc_atomXC ! XC for a spherical charge
52 use siestaXC, only: getXC ! Returns the XC functional to be used52 use gridXC, only: getXC=>gridxc_getXC ! Returns the XC functional to be used
53#endif /* ! BSC_CELLXC */53#endif /* ! BSC_CELLXC */
5454
55 implicit none 55 implicit none
5656
=== modified file 'Src/broyden_optim.F'
--- Src/broyden_optim.F 2016-01-25 16:00:16 +0000
+++ Src/broyden_optim.F 2016-07-19 08:21:24 +0000
@@ -68,7 +68,7 @@
68 $ broyden_destroy, broyden_init,68 $ broyden_destroy, broyden_init,
69 $ broyden_is_setup69 $ broyden_is_setup
7070
71 use m_memory, only: memory, mem_stat71 use memory_log, only: memory, mem_stat
72 use parallel, only : ionode72 use parallel, only : ionode
7373
74! Subroutine arguments:74! Subroutine arguments:
7575
=== modified file 'Src/cell_fire_optim.F'
--- Src/cell_fire_optim.F 2016-01-25 16:00:16 +0000
+++ Src/cell_fire_optim.F 2016-07-19 08:21:24 +0000
@@ -18,7 +18,7 @@
18 use m_fire18 use m_fire
19 use siesta_options, only: dt19 use siesta_options, only: dt
2020
21 use m_memory, only: memory, mem_stat21 use memory_log, only: memory, mem_stat
22 use parallel, only : ionode22 use parallel, only : ionode
2323
24 implicit none24 implicit none
2525
=== modified file 'Src/cellxc_mod.F'
--- Src/cellxc_mod.F 2016-01-25 16:00:16 +0000
+++ Src/cellxc_mod.F 2016-07-19 08:21:24 +0000
@@ -12,7 +12,7 @@
12 CONTAINS12 CONTAINS
13 subroutine setGGA( )13 subroutine setGGA( )
14#ifndef BSC_CELLXC14#ifndef BSC_CELLXC
15 use siestaXC, only : getXC ! Returns the XC functional used15 use gridXC, only : gridxc_getXC ! Returns the XC functional used
16#else /* BSC_CELLXC */16#else /* BSC_CELLXC */
17 use bsc_xcmod, only : nXCfunc, XCfunc17 use bsc_xcmod, only : nXCfunc, XCfunc
18#endif /* BSC_CELLXC */18#endif /* BSC_CELLXC */
@@ -28,7 +28,7 @@
2828
29!---------------------------------------------------------------------- BEGIN29!---------------------------------------------------------------------- BEGIN
30#ifndef BSC_CELLXC30#ifndef BSC_CELLXC
31 call getXC( nXCfunc, XCfunc, XCauth )31 call gridxc_getXC( nXCfunc, XCfunc, XCauth )
32#endif /* ! BSC_CELLXC */32#endif /* ! BSC_CELLXC */
33 do nf = 1,nXCfunc33 do nf = 1,nXCfunc
34 if ( XCfunc(nf).eq.'GGA' .or. XCfunc(nf).eq.'gga') then34 if ( XCfunc(nf).eq.'GGA' .or. XCfunc(nf).eq.'gga') then
3535
=== modified file 'Src/dhscf.F'
--- Src/dhscf.F 2016-01-25 16:00:16 +0000
+++ Src/dhscf.F 2016-07-19 08:21:24 +0000
@@ -64,7 +64,7 @@
64 use mesh, only : xdsp, nsm, nsp64 use mesh, only : xdsp, nsm, nsp
65 use parsing65 use parsing
66#ifndef BSC_CELLXC66#ifndef BSC_CELLXC
67 use siestaXC, only : getXC ! Returns the XC functional used67 use gridXC, only : getXC=>gridxc_getXC ! Returns the XC functional used
68#else /* BSC_CELLXC */68#else /* BSC_CELLXC */
69 use bsc_xcmod, only : nXCfunc, XCauth69 use bsc_xcmod, only : nXCfunc, XCauth
70#endif /* BSC_CELLXC */70#endif /* BSC_CELLXC */
@@ -546,9 +546,9 @@
546 use m_partial_charges, only: want_partial_charges546 use m_partial_charges, only: want_partial_charges
547#ifndef BSC_CELLXC547#ifndef BSC_CELLXC
548548
549 use siestaXC, only : cellXC ! Finds xc energy and potential549 use gridXC, only : cellXC=>gridxc_cellXC ! Finds xc energy and potential
550 use siestaXC, only : myMeshBox ! Returns my processor mesh box550 use gridXC, only : myMeshBox ! Returns my processor mesh box
551 use siestaXC, only : jms_setMeshDistr => setMeshDistr551 use gridXC, only : jms_setMeshDistr => setMeshDistr
552 ! Sets a distribution of mesh552 ! Sets a distribution of mesh
553 ! points over parallel processors553 ! points over parallel processors
554#endif /* BSC_CELLXC */554#endif /* BSC_CELLXC */
555555
=== renamed file 'Src/memoryinfo.F' => 'Src/diagmemory.F'
--- Src/memoryinfo.F 2016-01-25 16:00:16 +0000
+++ Src/diagmemory.F 2016-07-19 08:21:24 +0000
@@ -5,51 +5,6 @@
5! or http://www.gnu.org/copyleft/gpl.txt.5! or http://www.gnu.org/copyleft/gpl.txt.
6! See Docs/Contributors.txt for a list of contributors.6! See Docs/Contributors.txt for a list of contributors.
7!7!
8 module memoryinfo
9
10C
11C WordsInteger = number of words of memory for integer variables
12C WordsSP = number of words of memory for single precision variables
13C WordsDP = number of words of memory for double precision variables
14C WordsLogical = number of words of memory for logical variables
15C WordsSC = number of words of memory for single complex variables
16C WordsDC = number of words of memory for double complex variables
17C PeakMemory = maximum amount of dynamic memory used
18C PeakRoutine = routine name where memory peak was reached
19C ByteSize = array of values specifying the size of a word for
20C each data type
21C
22 implicit none
23
24 integer*8, save ::
25 . WordsInteger, WordsSP, WordsDP, WordsLogical, WordsSC, WordsDC,
26 . WordsString, WordsLongInt,
27 . PeakMemory, CurrentMemory
28
29 character(len=30), save ::
30 . PeakRoutine
31
32 data
33 . WordsInteger / 0 /,
34 . WordsSP / 0 /,
35 . WordsDP / 0 /,
36 . WordsLogical / 0 /,
37 . WordsSC / 0 /,
38 . WordsDC / 0 /,
39 . WordsString / 0 /,
40 . WordsLongInt / 0 /,
41 . PeakMemory / 0 /,
42 . CurrentMemory / 0 /
43
44 integer, parameter, dimension(8) :: ByteSize =
45#ifdef OLD_CRAY
46 . (/8,8,8,8,8,16,8,8/)
47#else
48 . (/4,4,8,4,8,16,4,8/)
49#endif
50
51 end module memoryinfo
52
53 module diagmemory8 module diagmemory
54C9C
55C Stores the factor used to scale the default memory in rdiag/cdiag10C Stores the factor used to scale the default memory in rdiag/cdiag
5611
=== modified file 'Src/diagon.F'
--- Src/diagon.F 2016-01-25 16:00:16 +0000
+++ Src/diagon.F 2016-07-19 08:21:24 +0000
@@ -98,7 +98,7 @@
98 use m_diagon, only : qspiral, spiral, frstme98 use m_diagon, only : qspiral, spiral, frstme
99 use fdf99 use fdf
100 use alloc100 use alloc
101 use m_memory101 use memory_log
102#ifdef MPI102#ifdef MPI
103 use m_diagon, only : paralleloverk103 use m_diagon, only : paralleloverk
104 use mpi_siesta, only : mpi_bcast, mpi_comm_world,104 use mpi_siesta, only : mpi_bcast, mpi_comm_world,
105105
=== modified file 'Src/fft.F'
--- Src/fft.F 2016-01-25 16:00:16 +0000
+++ Src/fft.F 2016-07-19 08:21:24 +0000
@@ -53,8 +53,8 @@
53 use sys, only : die53 use sys, only : die
54 use alloc, only : re_alloc, de_alloc54 use alloc, only : re_alloc, de_alloc
55 use mesh, only : nsm55 use mesh, only : nsm
56 use fft1d, only : gpfa ! 1-D FFT routine56 use m_fft_gpfa, only : gpfa ! 1-D FFT routine
57 use fft1d, only : setgpfa ! Sets gpfa routine57 use m_fft_gpfa, only : setgpfa=>setgpfa_check ! Sets gpfa routine
58 use m_timer, only : timer_start ! Start counting CPU time58 use m_timer, only : timer_start ! Start counting CPU time
59 use m_timer, only : timer_stop ! Stop counting CPU time59 use m_timer, only : timer_stop ! Stop counting CPU time
60#ifdef MPI60#ifdef MPI
6161
=== modified file 'Src/forhar.F'
--- Src/forhar.F 2016-01-25 16:00:16 +0000
+++ Src/forhar.F 2016-07-19 08:21:24 +0000
@@ -11,9 +11,9 @@
11#ifndef BSC_CELLXC11#ifndef BSC_CELLXC
12 use parallel, only : ProcessorY12 use parallel, only : ProcessorY
13 use mesh, only : NSM13 use mesh, only : NSM
14 use siestaXC, only : cellXC ! Finds xc energy and potential14 use gridXC, only : cellXC=>gridxc_cellXC ! Finds xc energy and potential
15 use siestaXC, only : myMeshBox ! Returns my processor mesh box15 use gridXC, only : myMeshBox ! Returns my processor mesh box
16 use siestaXC, only : jms_setMeshDistr => setMeshDistr16 use gridXC , only : jms_setMeshDistr => setMeshDistr
17 ! Sets a distribution of mesh17 ! Sets a distribution of mesh
18 ! points over parallel processors18 ! points over parallel processors
1919
2020
=== modified file 'Src/ldau_specs.f'
--- Src/ldau_specs.f 2016-06-29 04:22:46 +0000
+++ Src/ldau_specs.f 2016-07-19 08:21:24 +0000
@@ -658,8 +658,8 @@
658 use basis_specs, only : restricted_grid658 use basis_specs, only : restricted_grid
659 use basis_specs, only : rmax_radial_grid659 use basis_specs, only : rmax_radial_grid
660660
661 use siestaXC, only : setXC661 use gridXC, only : setXC=>gridxc_setXC
662 use siestaXC, only : atomXC662 use gridXC, only : atomXC=>gridxc_atomXC
663663
664 integer, intent(in) :: isp ! Species index664 integer, intent(in) :: isp ! Species index
665665
666666
=== removed file 'Src/m_memory.F'
--- Src/m_memory.F 2016-01-25 16:00:16 +0000
+++ Src/m_memory.F 1970-01-01 00:00:00 +0000
@@ -1,134 +0,0 @@
1!
2! Copyright (C) 1996-2016 The SIESTA group
3! This file is distributed under the terms of the
4! GNU General Public License: see COPYING in the top directory
5! or http://www.gnu.org/copyleft/gpl.txt.
6! See Docs/Contributors.txt for a list of contributors.
7!
8 module m_memory
9
10 integer, public :: mem_stat ! For use in calls to allocate
11 ! and deallocate
12
13 public :: memory
14 private
15
16 CONTAINS
17
18 subroutine memory( Task, Type, NElements, CallingRoutine,
19 $ stat,id)
20C
21C This subroutine keeps track of information relating to the use
22C of dynamic memory
23C
24C Input :
25C
26C character*1 Task : job type = 'A' -> allocate
27C : 'D' -> deallocate
28C character*1 Type : type of variable = 'I' = integer
29C : 'S' = single precision real
30C : 'D' = double precision real
31C : 'X' = grid precision real
32C : 'L' = logical
33C : 'C' = single precision complex
34C : 'Z' = double precision complex
35C : 'S' = character data (we assume takes one word)
36C : 'E' = double precision integer
37C integer NElements : number of array elements being
38C : allocated/deallocated
39C character :
40C CallingRoutine : string containing the name of the calling routine
41C
42C Created by J.D. Gale, October 1999
43C
44C Stat and ID keyword arguments added by Alberto Garcia, 2005
45
46 use memoryinfo
47 use sys, only: die
48 use parallel, only: Node
49
50 implicit none
51
52 integer, intent(in) :: NElements
53 character(len=1), intent(in) :: Task, Type
54 character(len=*), intent(in) :: CallingRoutine
55 integer, intent(in), optional :: stat
56 character(len=*), intent(in), optional :: id
57
58C Local variables
59 integer Sign
60C
61C CAG
62C if (Node.eq.0) then
63C write(66,'(a,a,a,a,i10)') "---memory: ", CallingRoutine // " ",
64C $ task // " ",
65C $ type // " ", nelements
66C call flush(66)
67C endif
68 if (present(stat)) then
69 if (stat .ne. 0) then
70 if (present(id)) then
71 call die(Task // "-llocation failed in " //
72 $ CallingRoutine // id)
73 else
74 call die(Task // "-llocation failed in " //
75 $ CallingRoutine)
76 endif
77 endif
78 endif
79
80C Assign sign of operation based on task
81 if (Task .eq. 'A' .or. Task .eq. 'a') then
82 Sign = +1
83 else
84 Sign = -1
85 endif
86
87C Add number of elements to appropriate pointer
88 if (Type .eq. 'I' .or. Type .eq. 'i') then
89 WordsInteger = WordsInteger + Sign*NElements
90 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(1)
91 elseif (Type .eq. 'S' .or. Type .eq. 's') then
92 WordsSP = WordsSP + Sign*NElements
93 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2)
94 elseif (Type .eq. 'D' .or. Type .eq. 'd') then
95 WordsDP = WordsDP + Sign*NElements
96 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3)
97!
98! Support for flexible precision in grid-related arrays
99!
100 elseif (Type .eq. 'X' .or. Type .eq. 'x') then
101#ifdef GRID_DP
102 WordsDP = WordsDP + Sign*NElements
103 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3)
104#else
105 WordsSP = WordsSP + Sign*NElements
106 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2)
107#endif
108
109 elseif (Type .eq. 'L' .or. Type .eq. 'l') then
110 WordsLogical = WordsLogical + Sign*NElements
111 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(4)
112 elseif (Type .eq. 'C' .or. Type .eq. 'c') then
113 WordsSC = WordsSC + Sign*NElements
114 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(5)
115 elseif (Type .eq. 'Z' .or. Type .eq. 'z') then
116 WordsDC = WordsDC + Sign*NElements
117 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(6)
118 elseif (Type .eq. 'S' .or. Type .eq. 's') then
119 WordsString = WordsString + Sign*NElements
120 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(7)
121 elseif (Type .eq. 'E' .or. Type .eq. 'e') then
122 WordsLongInt = WordsLongInt + Sign*NElements
123 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(8)
124 endif
125
126C Check whether memory is greater than peak memory so far
127 if (CurrentMemory .gt. PeakMemory) then
128 PeakMemory = CurrentMemory
129 PeakRoutine = CallingRoutine
130 endif
131
132 end subroutine memory
133
134 end module m_memory
1350
=== modified file 'Src/m_timer.F90'
--- Src/m_timer.F90 2016-01-25 16:00:16 +0000
+++ Src/m_timer.F90 2016-07-19 08:21:24 +0000
@@ -12,6 +12,10 @@
12! Provides utility routines for CPU timing12! Provides utility routines for CPU timing
13! Written by J.M.Soler. July 200913! Written by J.M.Soler. July 2009
14!===============================================================================14!===============================================================================
15
16 ! The user must provide an external function 'use_walltime_in_timer'
17 ! with the interface specified below to set the value of 'use_walltime'
18!
15! Used MPI routines and parameters19! Used MPI routines and parameters
16! use mpi_siesta, only: MPI_AllGather20! use mpi_siesta, only: MPI_AllGather
17! use mpi_siesta, only: MPI_Bcast21! use mpi_siesta, only: MPI_Bcast
@@ -97,6 +101,7 @@
97! ALGORITHMS:101! ALGORITHMS:
98! Calls intrinsic routine cpu_time and stores the present time, associated102! Calls intrinsic routine cpu_time and stores the present time, associated
99! to the prog name, for future use by timer_stop103! to the prog name, for future use by timer_stop
104! If use_walltime is .true., it uses wall_time instead
100!===============================================================================105!===============================================================================
101! SUBROUTINE timer_stop( prog ) 106! SUBROUTINE timer_stop( prog )
102! Stops counting time for a program or code section107! Stops counting time for a program or code section
@@ -226,6 +231,12 @@
226231
227PRIVATE ! Nothing is declared public beyond this point232PRIVATE ! Nothing is declared public beyond this point
228233
234 interface
235 function use_walltime_in_timer() result(use_walltime)
236 logical :: use_walltime
237 end function use_walltime_in_timer
238 end interface
239
229! Parameters240! Parameters
230 character(len=*),parameter:: myName = 'timer '241 character(len=*),parameter:: myName = 'timer '
231 character(len=*),parameter:: errHead = myName//'ERROR: '242 character(len=*),parameter:: errHead = myName//'ERROR: '
@@ -246,6 +257,7 @@
246 end type times_t257 end type times_t
247258
248! Module variables and arrays259! Module variables and arrays
260 logical, save :: use_walltime ! wall-time or cpu-time?
249 real(dp),save :: minRepTime = 0.0_dp ! Min reported CPU time fraction261 real(dp),save :: minRepTime = 0.0_dp ! Min reported CPU time fraction
250 integer, save :: nProgs=0 ! Number of timed programs262 integer, save :: nProgs=0 ! Number of timed programs
251 type(times_t), target, save:: progData(maxProgs) ! Holds data of timed progs263 type(times_t), target, save:: progData(maxProgs) ! Holds data of timed progs
@@ -287,8 +299,7 @@
287 writingTimes = .true.299 writingTimes = .true.
288300
289! Find present CPU time and convert it to double precision301! Find present CPU time and convert it to double precision
290 call cpu_time( treal )302 call current_time(timeNow)
291 timeNow = treal
292 totalTime = timeNow - time0303 totalTime = timeNow - time0
293 call wall_time( wallTime )304 call wall_time( wallTime )
294 wallTime = wallTime - wallTime0305 wallTime = wallTime - wallTime0
@@ -404,15 +415,17 @@
404 'Calc: Sum, Avge, myNode, Avg/Max =', &415 'Calc: Sum, Avge, myNode, Avg/Max =', &
405 sum(nodeCalTime), sum(nodeCalTime)/nNodes, totalCalTime, &416 sum(nodeCalTime), sum(nodeCalTime)/nNodes, totalCalTime, &
406 sum(nodeCalTime)/nNodes / maxval(nodeCalTime)417 sum(nodeCalTime)/nNodes / maxval(nodeCalTime)
407#ifdef MPI_TIMING418
408 write(iu,'(a,3f12.3,f8.3)') &419 write(iu,'(a,3f12.3,f8.3)') &
409 'Comm: Sum, Avge, myNode, Avg/Max =', &420 'Comm: Sum, Avge, myNode, Avg/Max =', &
410 sum(nodeComTime), sum(nodeComTime)/nNodes, totalComTime, &421 sum(nodeComTime), sum(nodeComTime)/nNodes, totalComTime, &
411 sum(nodeComTime)/nNodes / maxval(nodeComTime)422 sum(nodeComTime)/nNodes / maxval(nodeComTime)
412#else423
413 totalComTime = huge(1.0_dp) ! Avoid division by zero in prog table output424 if (totalComTime < 1.0e-4) then
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
415#endif426 totalComTime = huge(1.0_dp)
427 endif
428
416 write(iu,'(a,3f12.3,f8.3)') &429 write(iu,'(a,3f12.3,f8.3)') &
417 'Tot: Sum, Avge, myNode, Avg/Max =', &430 'Tot: Sum, Avge, myNode, Avg/Max =', &
418 sum(nodeTotTime), sum(nodeTotTime)/nNodes, totalTime, &431 sum(nodeTotTime), sum(nodeTotTime)/nNodes, totalTime, &
@@ -471,13 +484,14 @@
471484
472 ! Write total communications time485 ! Write total communications time
473 if (myNode==writerNode) then486 if (myNode==writerNode) then
474#ifdef MPI_TIMING487
488 if (totalComTime > huge(1.0_dp)/2.0_dp) then
489 ! Set back to 0
490 totalComTime = 0.0_dp
491 endif
475 write(iu,'(a15,i9,2(f12.3,f9.4))') &492 write(iu,'(a15,i9,2(f12.3,f9.4))') &
476 'MPI total ', totalComCalls, &493 'MPI total ', totalComCalls, &
477 totalComTime, 1., totalComTime, totalComTime/totalTime494 totalComTime, 1., totalComTime, totalComTime/totalTime
478#else
479 write(iu,'(a)') 'No communications time available. Compile with -DMPI_TIMING'
480#endif
481 endif ! (myNode==writerNode)495 endif ! (myNode==writerNode)
482496
483497
@@ -650,12 +664,11 @@
650664
651subroutine timer_init() ! Initialize timing665subroutine timer_init() ! Initialize timing
652666
653! Internal variables667 use_walltime = use_walltime_in_timer()
654 real :: treal
655668
656 call wall_time( wallTime0 )669 call wall_time( wallTime0 )
657 call cpu_time( treal ) ! Notice single precision670 call current_time(time0)
658 time0 = treal671
659 nProgs = 0672 nProgs = 0
660673
661! (Re)initialize data array674! (Re)initialize data array
@@ -717,9 +730,7 @@
717! Do not change data if writing a report730! Do not change data if writing a report
718 if (writingTimes) return731 if (writingTimes) return
719732
720! Find present CPU time and convert it to double precision733 call current_time(timeNow)
721 call cpu_time( treal ) ! Standard Fortran95
722 timeNow = treal
723734
724! Find program index735! Find program index
725 iProg = prog_index( prog )736 iProg = prog_index( prog )
@@ -757,9 +768,7 @@
757! Do not change data if writing a report768! Do not change data if writing a report
758 if (writingTimes) return769 if (writingTimes) return
759770
760! Find present CPU time and convert it to double precision771 call current_time(timeNow)
761 call cpu_time( treal ) ! Standard Fortran95
762 timeNow = treal
763772
764! Find program index773! Find program index
765 iProg = prog_index( prog, found )774 iProg = prog_index( prog, found )
@@ -818,6 +827,23 @@
818enddo827enddo
819end subroutine timer_all_stop828end subroutine timer_all_stop
820 829
830 !------------------------------------------------
831 subroutine current_time(t)
832 !
833 ! CPU or walltime, depending on the setting of 'use_walltime'
834 !
835 use m_walltime, only: wall_time
836 real(dp), intent(out) :: t
837
838 real :: treal ! for call to cpu_time
839
840 if (use_walltime) then
841 call wall_time(t)
842 else
843 call cpu_time(treal)
844 t = treal
845 endif
846 end subroutine current_time
821847
822END MODULE m_timer848END MODULE m_timer
823849
824850
=== modified file 'Src/memory.F'
--- Src/memory.F 2016-01-25 16:00:16 +0000
+++ Src/memory.F 2016-07-19 08:21:24 +0000
@@ -30,9 +30,8 @@
30C30C
31C Created by J.D. Gale, October 199931C Created by J.D. Gale, October 1999
32C32C
33 use memoryinfo
34 use parallel, only: Node33 use parallel, only: Node
35 use alloc, only: alloc_count34 use memory_log, only: memory_event, type_mem
3635
37 implicit none36 implicit none
3837
@@ -41,71 +40,9 @@
41 character(len=*), intent(in) :: CallingRoutine40 character(len=*), intent(in) :: CallingRoutine
4241
43C Local variables42C Local variables
44 integer :: Sign43 integer :: allocSize, bytes
45 integer*8 :: prevMem
46 integer :: allocSize
47 character(len=1):: allocType44 character(len=1):: allocType
48CAG45
49! if (Node.eq.0) then
50! write(66,'(a,a,a,a,i10)') "---memory: ", CallingRoutine // " ",
51! $ task // " ",
52! $ type // " ", nelements
53! call flush(66)
54! endif
55 prevMem = CurrentMemory
56C Assign sign of operation based on task
57 if (Task .eq. 'A' .or. Task .eq. 'a') then
58 Sign = +1
59 else
60 Sign = -1
61 endif
62
63C Add number of elements to appropriate pointer
64 if (Type .eq. 'I' .or. Type .eq. 'i') then
65 WordsInteger = WordsInteger + Sign*NElements
66 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(1)
67 elseif (Type .eq. 'S' .or. Type .eq. 's') then
68 WordsSP = WordsSP + Sign*NElements
69 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2)
70 elseif (Type .eq. 'D' .or. Type .eq. 'd') then
71 WordsDP = WordsDP + Sign*NElements
72 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3)
73!
74! Support for flexible precision in grid-related arrays
75!
76 elseif (Type .eq. 'X' .or. Type .eq. 'x') then
77#ifdef GRID_DP
78 WordsDP = WordsDP + Sign*NElements
79 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(3)
80#else
81 WordsSP = WordsSP + Sign*NElements
82 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(2)
83#endif
84
85 elseif (Type .eq. 'L' .or. Type .eq. 'l') then
86 WordsLogical = WordsLogical + Sign*NElements
87 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(4)
88 elseif (Type .eq. 'C' .or. Type .eq. 'c') then
89 WordsSC = WordsSC + Sign*NElements
90 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(5)
91 elseif (Type .eq. 'Z' .or. Type .eq. 'z') then
92 WordsDC = WordsDC + Sign*NElements
93 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(6)
94 elseif (Type .eq. 'S' .or. Type .eq. 's') then
95 WordsString = WordsString + Sign*NElements
96 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(7)
97 elseif (Type .eq. 'E' .or. Type .eq. 'e') then
98 WordsLongInt = WordsLongInt + Sign*NElements
99 CurrentMemory = CurrentMemory + Sign*NElements*ByteSize(8)
100 endif
101
102C Check whether memory is greater than peak memory so far
103 if (CurrentMemory .gt. PeakMemory) then
104 PeakMemory = CurrentMemory
105 PeakRoutine = CallingRoutine
106 endif
107
108C Call alloc_count routine
109 select case(Type)46 select case(Type)
110 case('S')47 case('S')
111 allocType = 'R'48 allocType = 'R'
@@ -128,82 +65,8 @@
128 allocSize = NElements65 allocSize = NElements
129 end select66 end select
130 if (Task=='D') allocSize = -allocSize67 if (Task=='D') allocSize = -allocSize
131 call alloc_count( allocSize, allocType, 68 bytes = allocSize*type_mem(allocType)
132 . name=trim(CallingRoutine)//' unknown' )69 call memory_event(bytes,
70 $ aname=trim(CallingRoutine)//'@'//'unknown' )
13371
134 end subroutine memory72 end subroutine memory
135
136 subroutine printmemory( Unit, Level )
137C
138C Outputs the information about the dynamic memory useage
139C
140C Created by J.D. Gale, October 1999
141C
142C Input :
143C
144C integer Unit : channel number for output
145C integer Level : number controlling the level of output
146C : 0 = peak memory details only
147C : 1 = peak memory on all Nodes
148C
149 use memoryinfo
150 use precision
151 use parallel, only : Node, Nodes
152#ifdef MPI
153 use mpi_siesta
154#endif
155 implicit none
156C Passed arguments
157 integer :: Unit, Level
158C Local arguments
159 integer :: n
160 integer*8 :: MaxMemory
161 integer*8, pointer :: maxmemlist(:)
162#ifdef MPI
163 integer :: MPIerror
164#endif
165
166C Find peak memory use over all Nodes
167#ifdef MPI
168 call MPI_AllReduce( PeakMemory, MaxMemory, 1, MPI_INTEGER8,
169 & MPI_MAX, MPI_COMM_WORLD, MPIerror )
170#else
171 MaxMemory = PeakMemory
172#endif
173
174C Output memory use information
175 if (Node.eq.0) then
176 write(Unit,'(a)') ' '
177 endif
178 if (Level.eq.0) then
179 if (Node.eq.0) then
180 write(Unit,'(''* Maximum dynamic memory allocated = '',i5,
181 & '' MB'')') (MaxMemory/1000000)+1
182 endif
183 else
184 nullify(maxmemlist)
185 if (node==0) then
186 allocate(maxmemlist(nodes))
187 else
188 allocate(maxmemlist(1))
189 endif
190#ifdef MPI
191 call mpi_gather( peakmemory, 1, MPI_INTEGER8,
192 & maxmemlist, 1, MPI_INTEGER8,
193 & 0, MPI_COMM_WORLD, MPIerror )
194#else
195 maxmemlist=peakmemory
196#endif
197 if (node==0) then
198 do n=0,Nodes-1
199 write(Unit,'(''* Maximum dynamic memory allocated : Node ''
200 & ,i4,'' = '',i5,'' MB'')') n,(maxmemlist(n+1)/1000000)+1
201 enddo
202 write(Unit,'(a)') ' '
203 write(Unit,'(''* Maximum memory occured during '',a30)')
204 & PeakRoutine
205 endif
206 deallocate(maxmemlist)
207 endif
208
209 end subroutine printmemory
21073
=== added file 'Src/memory_log.F90'
--- Src/memory_log.F90 1970-01-01 00:00:00 +0000
+++ Src/memory_log.F90 2016-07-19 08:21:24 +0000
@@ -0,0 +1,587 @@
1! ---
2! Copyright (C) 1996-2016 The SIESTA group
3! This file is distributed under the terms of the
4! GNU General Public License: see COPYING in the top directory
5! or http://www.gnu.org/copyleft/gpl.txt .
6! See Docs/Contributors.txt for a list of contributors.
7! ---
8! ==================================================================
9
10! Written by J.M.Soler. May 2000.
11! Re-organized by A. Garcia, June 2015
12!
13! ==================================================================
14! SUBROUTINE memory_report( level, unit, file, printNow, threshold )
15! Sets the output file for the allocation report
16! INPUT (optional):
17! integer :: level : Level (detail) of report
18! integer :: unit : Output file unit
19! character*(*):: file : Output file name
20! logical :: printNow : If present & true => print report now
21! real(dp) :: threshold : Memory threshold (in bytes) to print
22! the memory use of any given array
23! BEHAVIOR:
24! The detail/extent of the report increses with the value of level:
25! level=0 : no report at all (the default)
26! level=1 : only total memory peak and where it occurred
27! level=2 : detailed report created but printed only upon request
28! level=3 : detailed report printed at every new memory peak
29! level=4 : print every individual reallocation or deallocation
30! If unit is present, memory_report merely takes note of it for
31! future use, assuming that it has been already open outside.
32! In this case, file is not used.
33! If unit is absent, and file is present, a file with that
34! name is open for future use.
35! If both arguments are absent, a file named 'memory_report'
36! is open for future use.
37! If memory_report is called with printNow=.true. several times in
38! a program, with the same unit or file argument, the subsequent
39! reports are written consecutively in the same file, each with a
40! time stamp header.
41! If threshold is not present, threshold=0 is assumed.
42! In parallel execution, the report sections that involve every
43! reallocation (levels 1, 3, and 4) are written only by node 0.
44! The section that is written upon request (level 2) is written
45! only by the node with the highest peak of memory up to that time,
46! but it contains a summary of the memory used by all other nodes.
47! In parallel execution, the nodes that share the same file
48! system (e.g. different chip cores or NFS-connected nodes) write
49! on the same file. Otherwise they write on files with the same name
50! in their local disks.
51! ==================================================================---
52
53MODULE memory_log
54
55 use precision, only: dp ! Double precision real type
56 use parallel, only: Node ! My processor node index
57 use parallel, only: Nodes ! Number of parallel processors
58 use parallel, only: ionode ! Am I the I/O processor?
59 use parallel, only: parallel_init ! Initialize parallel variables
60 use m_io, only: io_assign ! Get and reserve an available IO unit
61#ifdef MPI
62! use mpi_siesta
63 use mpi_siesta, only: MPI_AllGather
64 use mpi_siesta, only: MPI_Barrier
65 use mpi_siesta, only: MPI_Bcast
66 use mpi_siesta, only: MPI_Comm_World
67 use mpi_siesta, only: MPI_double_precision
68 use mpi_siesta, only: MPI_integer
69 use mpi_siesta, only: MPI_character
70#endif
71
72 implicit none
73
74PUBLIC :: &
75 memory_report, &! Sets log report defaults
76 memory_event, &! Memory counting for allocs
77 type_mem ! Converter
78
79public :: memory ! The old (re-furbished) routine
80
81integer, public :: mem_stat ! (legacy) For use in calls to allocate
82 ! and deallocate
83
84PRIVATE ! Nothing is declared public beyond this point
85
86 ! Initial default values
87 character(len=*), parameter :: &
88 DEFAULT_NAME = 'unknown_name' ! Array name default
89 character(len=*), parameter :: &
90 DEFAULT_ROUTINE = 'unknown_routine' ! Routine name default
91
92 integer, save :: &
93 REPORT_LEVEL = 0, &! Level (detail) of allocation report
94 REPORT_UNIT = 0 ! Output file unit for report
95
96 character(len=50), save :: &
97 REPORT_FILE = 'memory_report' ! Output file name for report
98 real(dp), save :: &
99 REPORT_THRESHOLD = 0 ! Memory threshold (in bytes) to print
100 ! the memory use of any given array
101
102 ! Internal auxiliary type for a binary tree
103 type TREE
104 character(len=80) :: name ! Name of an allocated array
105 real(DP) :: mem ! Present memory use of the array
106 real(DP) :: max ! Maximum memory use of the array
107 real(DP) :: peak ! Memory use of the array during
108 ! peak of total memory
109 type(TREE), pointer :: left ! Pointer to data of allocated arrays
110 ! preceeding in alphabetical order
111 type(TREE), pointer :: right ! Pointer to data of allocated arrays
112 ! trailing in alphabetical order
113 end type TREE
114
115 ! Global variables used to store allocation data
116 real(DP), parameter :: MBYTE = 1.e6_dp
117 type(TREE), pointer, save :: REPORT_TREE
118 real(DP), save :: TOT_MEM = 0._dp
119 real(DP), save :: PEAK_MEM = 0._dp
120 character(len=80), save :: PEAK_ARRAY = ' '
121 character(len=32), save :: PEAK_ROUTINE = ' '
122 integer, save :: MAX_LEN = 0
123
124CONTAINS
125
126! ==================================================================
127
128SUBROUTINE memory_report( level, unit, file, printNow, threshold )
129
130implicit none
131
132integer, optional, intent(in) :: level, unit
133character(len=*), optional, intent(in) :: file
134logical, optional, intent(in) :: printNow
135real(dp), optional, intent(in) :: threshold
136
137logical open
138
139#ifdef MPI
140integer MPIerror
141#endif
142
143if (present(level)) then
144 REPORT_LEVEL = level
145end if
146
147if (node == 0) then
148 if (present(unit)) then ! Assume that unit has been open outside
149 if (unit > 0) then
150 REPORT_UNIT = unit
151 if (present(file)) then
152 REPORT_FILE = file
153 else
154 REPORT_FILE = 'unknown'
155 end if
156 end if
157 else if (present(file)) then ! If file is the same, do nothing
158 if (file /= REPORT_FILE) then ! Check if file was open outside
159 REPORT_FILE = file
160 inquire( file=REPORT_FILE, opened=open, number=REPORT_UNIT )
161 if (.not.open) then ! Open new file
162 call io_assign(REPORT_UNIT)
163 open( REPORT_UNIT, file=REPORT_FILE, status='unknown')
164 write(REPORT_UNIT,*) ' ' ! Overwrite previous reports
165 end if
166 end if
167 else if (REPORT_UNIT==0) then ! No unit has been open yet
168 REPORT_FILE = 'memory_report'
169 call io_assign(REPORT_UNIT)
170 open( REPORT_UNIT, file=REPORT_FILE, status='unknown')
171 write(REPORT_UNIT,*) ' ' ! Overwrite previous reports
172 end if
173end if
174
175#ifdef MPI
176! Distribute information to other nodes and open REPORT_UNIT
177call MPI_Bcast(REPORT_LEVEL,1,MPI_integer,0,MPI_Comm_World,MPIerror)
178call MPI_Bcast(REPORT_UNIT,1,MPI_integer,0,MPI_Comm_World,MPIerror)
179call MPI_Bcast(REPORT_FILE,50,MPI_character,0,MPI_Comm_World,MPIerror)
180! JMS: open file only in node 0
181!if (node > 0) then
182! open( REPORT_UNIT, file=REPORT_FILE )
183!end if
184#endif
185
186if (present(threshold)) REPORT_THRESHOLD = threshold
187
188if (present(printNow)) then
189 if (printNow) call print_report( )
190end if
191
192END SUBROUTINE memory_report
193
194! ==================================================================
195! Internal subroutines
196! ==================================================================
197
198SUBROUTINE memory_event( bytes, aname )
199
200implicit none
201
202integer, intent(in) :: bytes
203character(len=*), intent(in) :: aname
204
205character(len=1) :: memType, task
206real(DP) :: delta_mem
207logical :: newPeak
208logical, save :: header_written = .false.
209logical, save :: tree_nullified = .false.
210integer :: memSize
211
212if (REPORT_LEVEL <= 0) return
213
214MAX_LEN = max( MAX_LEN, len(trim(aname)) )
215
216! Find memory increment and total allocated memory
217delta_mem = real(bytes,kind=dp)
218TOT_MEM = TOT_MEM + delta_mem
219if (TOT_MEM > PEAK_MEM+0.5_dp) then
220 newPeak = .true.
221 PEAK_MEM = TOT_MEM
222 PEAK_ARRAY = aname
223 PEAK_ROUTINE = '-'
224! print'(/,a,f18.6),a,/)',
225! 'memory: Memory peak =', PEAK_MEM/MBYTE, ' Mbytes'
226else
227 newPeak = .false.
228end if
229
230! Add/subtract/classify array memory
231if (REPORT_LEVEL > 1) then
232 if (.not.tree_nullified) then
233 nullify(report_tree)
234 tree_nullified = .true.
235 end if
236 call tree_add( report_tree, aname, delta_mem )
237 if (newPeak) call tree_peak( report_tree )
238end if
239
240! Print report, but only in node 0, as not all
241! processors may follow the same route here
242! The detail/extent of the report increses with the value of level:
243! level=0 : no report at all (the default)
244! level=1 : only total memory peak and where it occurred
245! level=2 : detailed report created but printed only upon request
246! level=3 : detailed report printed at every new memory peak
247! level=4 : print every individual reallocation or deallocation
248
249
250if (newPeak .and. (REPORT_LEVEL==1 .or. REPORT_LEVEL==3) .and. &
251 node == 0) then
252 call print_report
253end if
254
255if (REPORT_LEVEL == 4 .and. node == 0) then
256 if (.not.header_written) then
257 write(REPORT_UNIT,'(/,a7,9x,1x,a4,28x,1x,2a15)') &
258 'Routine', 'Name', 'Incr. (MB)', 'Total (MB)'
259 header_written = .true.
260 end if
261 write(REPORT_UNIT,'(a32,1x,2f15.6)') &
262 aname, delta_mem/MBYTE, TOT_MEM/MBYTE
263end if
264END SUBROUTINE memory_event
265
266! ==================================================================
267
268INTEGER FUNCTION type_mem( var_type )
269!
270! It is not clear that the sizes assumed are universal for
271! non-Cray machines...
272!
273implicit none
274character, intent(in) :: var_type
275character(len=40) :: message
276
277select case( var_type )
278#ifdef OLD_CRAY
279 case('I')
280 type_mem = 8
281 case('R')
282 type_mem = 8
283 case('L')
284 type_mem = 8
285#else
286 case('I')
287 type_mem = 4
288 case('R')
289 type_mem = 4
290 case('L')
291 type_mem = 4
292#endif
293case('E')
294 type_mem = 8
295case('D')
296 type_mem = 8
297case('S')
298 type_mem = 1
299case default
300 write(message,"(2a)") &
301 'memory_log: ERROR: unknown type = ', var_type
302 call die(trim(message))
303end select
304
305END FUNCTION type_mem
306
307! ==================================================================
308
309RECURSIVE SUBROUTINE tree_add( t, name, delta_mem )
310
311implicit none
312type(TREE), pointer :: t
313character(len=*), intent(in) :: name
314real(DP), intent(in) :: delta_mem
315
316logical, save :: warn_negative = .true.
317
318if (.not.associated(t)) then
319 allocate( t )
320 t%name = name
321 t%mem = delta_mem
322 t%max = delta_mem
323 t%peak = 0._dp
324 nullify( t%left, t%right )
325else if (name == t%name) then
326 t%mem = t%mem + delta_mem
327 ! The abs is to handle the case of apparent de_allocs without re_allocs,
328 ! caused by routine/name argument mismatches
329 if (abs(t%mem) > abs(t%max)) t%max = t%mem
330else if ( llt(name,t%name) ) then
331 call tree_add( t%left, name, delta_mem )
332else
333 call tree_add( t%right, name, delta_mem )
334end if
335
336if (warn_negative .and. t%mem<0._dp) then
337 call parallel_init() ! Make sure that node and Nodes are initialized
338 if (Node==0) then
339 write(6,'(/,a,/,2a,/,a,f18.0,a)') &
340 'WARNING: alloc-realloc-dealloc name mismatch', &
341 ' Name: ', trim(name), &
342 ' Size: ', t%mem, ' Bytes'
343 if (Nodes>1) write(6,'(9x,a,i6)') 'Node:', Node
344 write(6,'(9x,a)') 'Subsequent mismatches will not be reported'
345 warn_negative = .false. ! Print this warning only once
346 end if
347end if
348
349END SUBROUTINE tree_add
350
351! ==================================================================
352
353RECURSIVE SUBROUTINE tree_peak( t )
354
355implicit none
356type(TREE), pointer :: t
357
358if (.not.associated(t)) return
359
360t%peak = t%mem
361call tree_peak( t%left )
362call tree_peak( t%right )
363
364END SUBROUTINE tree_peak
365
366! ==================================================================
367
368RECURSIVE SUBROUTINE tree_print( t )
369
370implicit none
371type(TREE), pointer :: t
372
373if (.not.associated(t)) return
374
375call tree_print( t%left )
376
377if (abs(t%max) >= REPORT_THRESHOLD) then
378 write(REPORT_UNIT,'(a,1x,3f15.6,f9.2)') &
379 t%name(1:MAX_LEN), t%mem/MBYTE, t%max/MBYTE, t%peak/MBYTE, &
380 100._dp * t%peak / (PEAK_MEM + tiny(PEAK_MEM) )
381end if
382
383call tree_print( t%right )
384
385END SUBROUTINE tree_print
386
387! ==================================================================
388
389SUBROUTINE print_report
390
391implicit none
392
393character(len=80) :: string = 'Name'
394character :: date*8, time*10, zone*5
395integer :: iNode, peakNode
396real(dp) :: maxPeak
397real(dp),allocatable:: nodeMem(:), nodePeak(:)
398
399#ifdef MPI
400integer :: MPIerror
401#endif
402
403! Make sure that variables node and Nodes are initialized
404call parallel_init()
405
406! Allocate and initialize two small arrays
407allocate( nodeMem(0:Nodes-1), nodePeak(0:Nodes-1) )
408
409! Initializations for Nodes=1 (serial case)
410nodeMem(node) = TOT_MEM
411nodePeak(node) = PEAK_MEM
412peakNode = node
413
414! In parallel, find the memory values of all nodes
415#ifdef MPI
416if (Nodes > 1) then
417 ! Gather the present and peak memories of all nodes
418 call MPI_AllGather( TOT_MEM, 1, MPI_double_precision, &
419 nodeMem, 1, MPI_double_precision, &
420 MPI_COMM_WORLD, MPIerror )
421 call MPI_AllGather( PEAK_MEM, 1, MPI_double_precision, &
422 nodePeak, 1, MPI_double_precision, &
423 MPI_COMM_WORLD, MPIerror )
424 ! Find the node with the highest peak of memory
425 maxPeak = 0
426 do iNode = 0,Nodes-1
427 if (nodePeak(iNode) > maxPeak) then
428 peakNode = iNode
429 maxPeak = nodePeak(iNode)
430 end if
431 end do ! iNode
432 ! Change the writing node for the peak-node information
433 if (node==0 .and. peakNode/=0) close( unit=REPORT_UNIT )
434 call MPI_Barrier( MPI_COMM_WORLD, MPIerror )
435 if (node==peakNode .and. peakNode/=0) &
436 open( unit=REPORT_UNIT, file=REPORT_FILE, &
437 status='unknown', position='append' )
438end if ! (Nodes>1)
439#endif
440
441! The report is printed by the highest-peak node
442if (node == peakNode) then
443
444 ! AG: Commented out to allow multiple batches of information
445 ! if (REPORT_LEVEL < 4) rewind(REPORT_UNIT)
446
447 call date_and_time( date, time, zone )
448
449 write(REPORT_UNIT,'(/,a,16a)') &
450 'Allocation summary at ', &
451 date(1:4),'/',date(5:6),'/',date(7:8),' ', &
452 time(1:2),':',time(3:4),':',time(5:10),' ', &
453 zone(1:3),':',zone(4:5)
454
455 if (Nodes > 1) then
456 write(REPORT_UNIT,'(/,(a,f18.6,a))') &
457 'Present memory all nodes : ', sum(nodeMem)/MBYTE, ' MB', &
458 'Added peak mem all nodes : ', sum(nodePeak)/MBYTE, ' MB', &
459 'Min peak memory in a node: ', minval(nodePeak)/MBYTE, ' MB', &
460 'Max peak memory in a node: ', maxval(nodePeak)/MBYTE, ' MB'
461! Impractical for many nodes:
462! write(REPORT_UNIT,'(/,a,/,(i6,f12.6))') &
463! 'Memory peaks of individual nodes (Mb):', &
464! (iNode,nodePeak(iNode)/MBYTE,iNode=0,Nodes-1)
465 write(REPORT_UNIT,'(/,a,i6)') &
466 'Maximum peak of memory occurred in node:', peakNode
467 end if
468
469 write(REPORT_UNIT,'(2(/,a,f18.6,a),/,2a,/,2a)') &
470 'Present memory allocation: ', TOT_MEM/MBYTE, ' MB', &
471 'Maximum memory allocation: ', PEAK_MEM/MBYTE, ' MB', &
472 'Occurred after allocating: ', trim(PEAK_ARRAY), &
473 'In routine: ', trim(PEAK_ROUTINE)
474
475 if (REPORT_LEVEL > 1) then
476 if (REPORT_THRESHOLD > 0._dp) then
477 write(REPORT_UNIT,'(/,a,f12.6,a,/,a,1x,3a15,a9)') &
478 'Allocated sizes (in MByte) of arrays larger than ', &
479 REPORT_THRESHOLD/MBYTE, ' MB:', &
480 string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%'
481 else
482 write(REPORT_UNIT,'(/,a,/,a,1x,3a15,a9)') &
483 'Allocated array sizes (in MByte):', &
484 string(1:MAX_LEN), 'Present', 'Maximum', 'At peak', '%'
485 end if
486 call tree_print( report_tree )
487 end if
488
489end if ! (node == peakNode)
490
491! Change again the writing node for the rest of the report
492#ifdef MPI
493if (node==peakNode .and. peakNode/=0) close( unit=REPORT_UNIT )
494call MPI_Barrier( MPI_COMM_WORLD, MPIerror )
495if (node==0 .and. peakNode/=0) &
496 open( unit=REPORT_UNIT, file=REPORT_FILE, &
497 status='unknown', position='append' )
498#endif
499
500deallocate( nodeMem, nodePeak )
501
502END SUBROUTINE print_report
503!
504! This routine is called "by hand" when allocations are not
505! handled by the 'alloc' mechanism, which is only suitable
506! for pointers.
507!
508subroutine memory( Task, Type, NElements, CallingRoutine, &
509 stat,id)
510!
511! This subroutine keeps track of information relating to the use
512! of dynamic memory
513
514! Input :
515! character*1 Task : job type = 'A' -> allocate
516! : 'D' -> deallocate
517! character*1 Type : type of variable = 'I' = integer
518! : 'S' = single precision real
519! : 'D' = double precision real
520! : 'X' = grid precision real
521! : 'L' = logical
522! : 'C' = single precision complex
523! : 'Z' = double precision complex
524! : 'S' = character data (we assume takes one word)
525! : 'E' = double precision integer
526! integer NElements : number of array elements being
527! : allocated/deallocated
528! character :
529! CallingRoutine : string containing the name of the calling routine
530
531! Created by J.D. Gale, October 1999
532
533! Stat and ID keyword arguments added by Alberto Garcia, 2005
534
535 implicit none
536
537 integer, intent(in) :: NElements
538 character(len=1), intent(in) :: Task, Type
539 character(len=*), intent(in) :: CallingRoutine
540 integer, intent(in), optional :: stat
541 character(len=*), intent(in), optional :: id
542
543! Local variables
544 integer :: allocSize, bytes
545 character(len=1):: allocType
546
547 if (present(stat)) then
548 if (stat .ne. 0) then
549 if (present(id)) then
550 call die(Task // "-llocation failed in " // &
551 CallingRoutine // id)
552 else
553 call die(Task // "-llocation failed in " // &
554 CallingRoutine)
555 endif
556 endif
557 endif
558
559 select case(Type)
560 case('S')
561 allocType = 'R'
562 allocSize = NElements
563 case('C')
564 allocType = 'R'
565 allocSize = NElements*2
566 case('Z')
567 allocType = 'D'
568 allocSize = NElements*2
569 case('X')
570#ifdef GRID_DP
571 allocType = 'D'
572#else
573 allocType = 'R'
574#endif
575 allocSize = NElements
576 case default
577 allocType = Type
578 allocSize = NElements
579 end select
580 if (Task=='D') allocSize = -allocSize
581 bytes = allocSize*type_mem(allocType)
582 call memory_event(bytes, &
583 aname=trim(CallingRoutine)//'@'//'unknown' )
584
585 end subroutine memory
586
587END MODULE memory_log
0588
=== modified file 'Src/meshsubs.F'
--- Src/meshsubs.F 2016-06-29 04:07:55 +0000
+++ Src/meshsubs.F 2016-07-19 08:21:24 +0000
@@ -261,7 +261,7 @@
261 use precision, only : dp261 use precision, only : dp
262 use cellsubs, only : reclat ! Finds reciprocal unit cell262 use cellsubs, only : reclat ! Finds reciprocal unit cell
263 use m_chkgmx, only : chkgmx ! Checks planewave cutoff of a mesh263 use m_chkgmx, only : chkgmx ! Checks planewave cutoff of a mesh
264 use fft1d, only : nfft ! Finds allowed value for 1-D FFT264 use m_fft_gpfa, only : nfft ! Finds allowed value for 1-D FFT
265 use fdf265 use fdf
266 use sys, only : die, message266 use sys, only : die, message
267267
@@ -490,7 +490,7 @@
490! (Re)allocate atom-mesh arrays490! (Re)allocate atom-mesh arrays
491 call allocIpaDistr( distr, na )491 call allocIpaDistr( distr, na )
492 if (na.ne.lastna) then492 if (na.ne.lastna) then
493 call re_alloc( dxa, 1,3, 1,na, myName//'dxa' )493 call re_alloc( dxa, 1,3, 1,na, 'dxa', myName )
494 call re_alloc( iatfold, 1,3, 1,na, myName//'iatfold' )494 call re_alloc( iatfold, 1,3, 1,na, myName//'iatfold' )
495 endif495 endif
496 lastna = na496 lastna = na
497497
=== modified file 'Src/moreParallelSubs.F90'
--- Src/moreParallelSubs.F90 2016-01-25 16:00:16 +0000
+++ Src/moreParallelSubs.F90 2016-07-19 08:21:24 +0000
@@ -559,7 +559,7 @@
559 call MPI_AllReduce( sendBuff, recvBuff, n, MPI_Integer, &559 call MPI_AllReduce( sendBuff, recvBuff, n, MPI_Integer, &
560 MPI_Min, MPI_Comm_World, MPIerror )560 MPI_Min, MPI_Comm_World, MPIerror )
561 else561 else
562 call die(errHead//'unknown operator')562 call die(errHead//'unknown operator:'//op)
563 end if563 end if
564564
565! Unpack recvBuff565! Unpack recvBuff
@@ -738,7 +738,7 @@
738 call MPI_AllReduce( sendBuff, recvBuff, n, MPI_double_precision, &738 call MPI_AllReduce( sendBuff, recvBuff, n, MPI_double_precision, &
739 MPI_Min, MPI_Comm_World, MPIerror )739 MPI_Min, MPI_Comm_World, MPIerror )
740 else740 else
741 call die(errHead//'unknown operator')741 call die(errHead//'unknown operator:'//op)
742 end if742 end if
743743
744! Unpack recvBuff744! Unpack recvBuff
745745
=== modified file 'Src/obj_setup.sh'
--- Src/obj_setup.sh 2015-11-25 17:03:59 +0000
+++ Src/obj_setup.sh 2016-07-19 08:21:24 +0000
@@ -55,6 +55,15 @@
55 cp -f $relpath/*.h ${destdir}/$relpath55 cp -f $relpath/*.h ${destdir}/$relpath
56 done56 done
57)57)
58# Replicate any .inc files
59#
60(cd $srcdir;
61 for i in $(find . -name '*.inc' ); do
62 relpath=${i%/*}
63 mkdir -p ${destdir}/$relpath
64 cp -f $relpath/*.inc ${destdir}/$relpath
65 done
66)
58#67#
59sed "s#VPATH=\.#VPATH=${srcdir}#g" ${srcdir}/Makefile | \68sed "s#VPATH=\.#VPATH=${srcdir}#g" ${srcdir}/Makefile | \
60sed "s#MAIN_OBJDIR=\.#MAIN_OBJDIR=${objdir}#g" > ${destdir}/Makefile69sed "s#MAIN_OBJDIR=\.#MAIN_OBJDIR=${objdir}#g" > ${destdir}/Makefile
6170
=== modified file 'Src/read_xc_info.F'
--- Src/read_xc_info.F 2016-01-25 16:00:16 +0000
+++ Src/read_xc_info.F 2016-07-19 08:21:24 +0000
@@ -11,7 +11,7 @@
11C and calls setXC to store it11C and calls setXC to store it
12C12C
13 use precision, only : dp13 use precision, only : dp
14 use SiestaXC, only : setXC14 use gridXC, only : setXC=>gridxc_setXC
15 use fdf15 use fdf
16 use parallel, only : Node16 use parallel, only : Node
17 use sys, only : die17 use sys, only : die
1818
=== modified file 'Src/siesta_end.F'
--- Src/siesta_end.F 2016-01-25 16:00:16 +0000
+++ Src/siesta_end.F 2016-07-19 08:21:24 +0000
@@ -12,7 +12,7 @@
12 CONTAINS12 CONTAINS
1313
14 subroutine siesta_end( )14 subroutine siesta_end( )
15 use alloc, only : alloc_report15 use memory_log, only : memory_report
16 use siesta_cml, only : cml_p, mainXML, cmlEndModule16 use siesta_cml, only : cml_p, mainXML, cmlEndModule
17 use siesta_cmlsubs, only : siesta_cml_exit17 use siesta_cmlsubs, only : siesta_cml_exit
18 use siesta_master, only : siesta_subroutine ! Is siesta a subroutine?18 use siesta_master, only : siesta_subroutine ! Is siesta a subroutine?
@@ -61,7 +61,7 @@
61!! call printmemory( 6, 1 )61!! call printmemory( 6, 1 )
6262
63! Print allocation report63! Print allocation report
64 call alloc_report( printNow=.true. )64 call memory_report( printNow=.true. )
6565
66#ifdef DEBUG_XC66#ifdef DEBUG_XC
67! Close debug outup file67! Close debug outup file
6868
=== modified file 'Src/siesta_init.F'
--- Src/siesta_init.F 2016-05-02 15:51:23 +0000
+++ Src/siesta_init.F 2016-07-19 08:21:24 +0000
@@ -20,6 +20,8 @@
20 use m_struct_init, only: struct_init20 use m_struct_init, only: struct_init
21 use siesta_options21 use siesta_options
22 use timer_options, only: use_tree_timer22 use timer_options, only: use_tree_timer
23 use timer_options, only: time_mpi_calls
24 use timer_options, only: use_walltime
23 use sparse_matrices25 use sparse_matrices
24 use siesta_geom26 use siesta_geom
25 use atomlist, only: no_u, rmaxkb, amass, lasto, qtot,27 use atomlist, only: no_u, rmaxkb, amass, lasto, qtot,
@@ -29,11 +31,14 @@
29 use sys, only: die, bye31 use sys, only: die, bye
30#ifdef BSC_CELLXC32#ifdef BSC_CELLXC
31 use bsc_xcmod, only: setXC33 use bsc_xcmod, only: setXC
34#else
35 use gridxc, only: gridxc_init
32#endif /* BSC_CELLXC */36#endif /* BSC_CELLXC */
33 use molecularmechanics, only: inittwobody37 use molecularmechanics, only: inittwobody
34 use metaforce, only: initmeta38 use metaforce, only: initmeta
35 use m_mpi_utils, only: broadcast39 use m_mpi_utils, only: broadcast
36 use alloc, only: re_alloc, alloc_report40 use alloc, only: re_alloc
41 use memory_log, only: memory_report
37 use parallelsubs, only: getnodeorbs42 use parallelsubs, only: getnodeorbs
38 use m_iostruct, only: write_struct, read_struct43 use m_iostruct, only: write_struct, read_struct
39 use zmatrix, only: lUseZmatrix44 use zmatrix, only: lUseZmatrix
@@ -165,11 +170,12 @@
165 call siesta_cml_init( )170 call siesta_cml_init( )
166171
167! Set timer report file and threshold .................................172! Set timer report file and threshold .................................
168 threshold = fdf_get('timer_report_threshold', 0._dp)
169 call timer_report( file=trim(slabel)//'.times', 173 call timer_report( file=trim(slabel)//'.times',
170 . threshold=threshold )174 . threshold=fdf_get('timer_report_threshold', 0._dp))
171 ! This variable lives in siesta_options175
172 use_tree_timer = fdf_get('UseTreeTimer', .false.)176 use_tree_timer = fdf_get('UseTreeTimer', .false.)
177 time_mpi_calls = fdf_get('time-mpi-calls', .false.)
178 use_walltime = fdf_get('use-walltime', use_tree_timer)
173179
174! Start time counter180! Start time counter
175! Note new placement of this first use, so that181! Note new placement of this first use, so that
@@ -180,12 +186,10 @@
180 call timer( 'Setup', 1 )186 call timer( 'Setup', 1 )
181187
182! Set allocation report level .........................................188! Set allocation report level .........................................
183! variables level and threshold imported from module siesta_options189 call memory_report( level=fdf_get('alloc_report_level',0),
184 level = fdf_get('alloc_report_level', 0)190 $ file=trim(slabel)//'.alloc',
185 threshold = fdf_get('alloc_report_threshold', 0._dp)191 . threshold=fdf_get('alloc_report_threshold', 0._dp),
186 call alloc_report( level=level, file=trim(slabel)//'.alloc',192 & printNow=.false. )
187 . threshold=threshold,
188 & printNow=.false. )
189193
190 if ( IONode ) then194 if ( IONode ) then
191 ! Add citations195 ! Add citations
@@ -196,6 +200,12 @@
196! Initialise exchange-correlation functional information200! Initialise exchange-correlation functional information
197#ifndef BSC_CELLXC201#ifndef BSC_CELLXC
198 call read_xc_info()202 call read_xc_info()
203#ifdef MPI
204 call gridxc_init(comm=MPI_Comm_World,
205 $ time_mpi_calls=fdf_get('gridxc-time-mpi-calls',.false.))
206#else
207 call gridxc_init()
208#endif
199#else /* BSC_CELLXC */209#else /* BSC_CELLXC */
200 call setXC( )210 call setXC( )
201#endif /* BSC_CELLXC */211#endif /* BSC_CELLXC */
202212
=== modified file 'Src/siesta_options.F90'
--- Src/siesta_options.F90 2016-01-25 16:00:16 +0000
+++ Src/siesta_options.F90 2016-07-19 08:21:24 +0000
@@ -132,7 +132,6 @@
132 integer :: min_nscf ! Minimum number of SCF iteration steps132 integer :: min_nscf ! Minimum number of SCF iteration steps
133 integer :: pmax 133 integer :: pmax
134 integer :: neigwanted ! Wanted number of eigenstates (per k point)134 integer :: neigwanted ! Wanted number of eigenstates (per k point)
135 integer :: level ! Option for allocation report level of detail
136 integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM135 integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM
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)
138 logical :: hasnobup ! Is the number of bands with spin up for 137 logical :: hasnobup ! Is the number of bands with spin up for
@@ -172,7 +171,6 @@
172 real(dp) :: taurelax ! Relaxation time to reach desired T and P in anneal171 real(dp) :: taurelax ! Relaxation time to reach desired T and P in anneal
173 real(dp) :: temp 172 real(dp) :: temp
174 real(dp) :: tempinit ! Initial ionic temperature read in redata173 real(dp) :: tempinit ! Initial ionic temperature read in redata
175 real(dp) :: threshold ! Min. size of arrays printed by alloc_report
176 real(dp) :: tp ! Target pressure. Read in redata. Used in dynamics routines174 real(dp) :: tp ! Target pressure. Read in redata. Used in dynamics routines
177 real(dp) :: ts ! Total spin read from redata but not used175 real(dp) :: ts ! Total spin read from redata but not used
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.
179177
=== modified file 'Src/state_init.F'
--- Src/state_init.F 2016-05-02 15:51:23 +0000
+++ Src/state_init.F 2016-07-19 08:21:24 +0000
@@ -27,7 +27,7 @@
27 & lastkb, lasto, superc, rmaxv, indxuo,27 & lastkb, lasto, superc, rmaxv, indxuo,
28 & no_u, no_s28 & no_u, no_s
29 use atomlist, only: no_l, iza29 use atomlist, only: no_l, iza
30 use alloc, only: re_alloc, de_alloc, alloc_report30 use alloc, only: re_alloc, de_alloc
31 use m_hsparse, only: hsparse31 use m_hsparse, only: hsparse
32 use m_overlap, only: overlap32 use m_overlap, only: overlap
33 use m_check_supercell, only: check_sc_factors33 use m_check_supercell, only: check_sc_factors
3434
=== modified file 'Src/timer.F90'
--- Src/timer.F90 2016-01-25 16:00:16 +0000
+++ Src/timer.F90 2016-07-19 08:21:24 +0000
@@ -24,7 +24,9 @@
24! WRITTEN BY J.SOLER. JUL.200924! WRITTEN BY J.SOLER. JUL.2009
25!=============================================================================25!=============================================================================
26module timer_options26module timer_options
27 logical, public :: use_tree_timer27 logical, public :: use_walltime
28 logical, public :: use_tree_timer
29 logical, public :: time_mpi_calls
28end module timer_options30end module timer_options
2931
30subroutine timer( prog, iOpt )32subroutine timer( prog, iOpt )
@@ -85,3 +87,32 @@
8587
86end subroutine timer88end subroutine timer
8789
90subroutine timer_mpi( prog, iOpt )
91 use timer_options, only : time_mpi_calls
92
93 implicit none
94 character(len=*),intent(in):: prog ! Name of program to time
95 integer, intent(in):: iOpt ! Action option
96
97 if (time_mpi_calls) then
98 call timer(prog,iOpt)
99 endif
100
101end subroutine timer_mpi
102
103function use_walltime_in_timer()
104 use timer_options, only: use_walltime
105
106 logical :: use_walltime_in_timer
107 use_walltime_in_timer = use_walltime
108end function use_walltime_in_timer
109
110subroutine gridxc_timer_start(str)
111 character(len=*), intent(in) :: str
112 call timer("gridxc@"//trim(str),1)
113end subroutine gridxc_timer_start
114!
115subroutine gridxc_timer_stop(str)
116 character(len=*), intent(in) :: str
117 call timer("gridxc@"//trim(str),2)
118end subroutine gridxc_timer_stop
88119
=== modified file 'Src/timer_tree.f90'
--- Src/timer_tree.f90 2016-01-25 16:00:16 +0000
+++ Src/timer_tree.f90 2016-07-19 08:21:24 +0000
@@ -52,6 +52,9 @@
52 ! specified below to properly abort the calling program in the event52 ! specified below to properly abort the calling program in the event
53 ! of an error (the routine could simply ignore timing errors...)53 ! of an error (the routine could simply ignore timing errors...)
54 !54 !
55 ! The user must provide an external function 'use_walltime_in_timer'
56 ! with the interface specified below to set the value of 'use_walltime'
57 !
55 ! Alberto Garcia, January 2013-, re-using some pieces of code by Jose Soler58 ! Alberto Garcia, January 2013-, re-using some pieces of code by Jose Soler
56 ! 59 !
57 implicit none60 implicit none
@@ -85,7 +88,6 @@
85 type(section_t), pointer :: last_active => null()88 type(section_t), pointer :: last_active => null()
8689
87 real(dp) :: globaltime90 real(dp) :: globaltime
88 logical,public :: use_walltime = .true.
8991
90 type(section_t), pointer :: p92 type(section_t), pointer :: p
91 type(times_t), pointer :: pd93 type(times_t), pointer :: pd
@@ -94,6 +96,8 @@
94 real(dp) :: deltaTime96 real(dp) :: deltaTime
95 character(len=256) :: msg97 character(len=256) :: msg
9698
99 logical, save :: use_walltime
100
97101
98 public :: timer_on, timer_off, timer_report102 public :: timer_on, timer_off, timer_report
99 private103 private
@@ -102,6 +106,9 @@
102 subroutine die(str)106 subroutine die(str)
103 character(len=*), intent(in), optional :: str107 character(len=*), intent(in), optional :: str
104 end subroutine die108 end subroutine die
109 function use_walltime_in_timer() result(use_walltime)
110 logical :: use_walltime
111 end function use_walltime_in_timer
105 end interface112 end interface
106113
107CONTAINS114CONTAINS
@@ -116,6 +123,11 @@
116 ! so that multiple user "trees" can be supported123 ! so that multiple user "trees" can be supported
117124
118 if (.not. associated(global_section)) then125 if (.not. associated(global_section)) then
126 ! Initialization
127 ! Get the value of this variable before
128 ! calling current_time...
129 use_walltime = use_walltime_in_timer()
130 !
119 allocate(global_section)131 allocate(global_section)
120 p => global_section132 p => global_section
121 p%active = .true.133 p%active = .true.
122134
=== modified file 'Util/Denchar/Src/Makefile'
--- Util/Denchar/Src/Makefile 2016-07-12 13:38:13 +0000
+++ Util/Denchar/Src/Makefile 2016-07-19 08:21:24 +0000
@@ -73,7 +73,7 @@
73 bessph.o chkdim.o dismin.o \73 bessph.o chkdim.o dismin.o \
74 dot.o readpla.o readsts.o \74 dot.o readpla.o readsts.o \
75 io.o iodm.o itochar.o length.o \75 io.o iodm.o itochar.o length.o \
76 matvect.o memory.o colinear.o\76 matvect.o memory.o memory_log.o colinear.o\
77 neighb.o paste.o pxf.o \77 neighb.o paste.o pxf.o \
78 radfft.o m_fft_gpfa.o ranger.o \78 radfft.o m_fft_gpfa.o ranger.o \
79 readwavesx.o rhoofr.o wavofr.o \79 readwavesx.o rhoofr.o wavofr.o \
@@ -97,13 +97,17 @@
97# This is crude but will have to do for now.97# This is crude but will have to do for now.
98# Note : precision must be the first module98# Note : precision must be the first module
99#99#
100MOD_OBJS=precision.o parallel.o debugmpi.o sys.o m_io.o alloc.o memoryinfo.o listsc.o \100MOD_OBJS=precision.o parallel.o debugmpi.o sys.o m_io.o alloc.o listsc.o \
101 atmparams.o atom_options.o atmfuncs.o atm_types.o \101 atmparams.o atom_options.o atmfuncs.o atm_types.o \
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 \
103 schecomm.o sparse_matrices.o\103 schecomm.o sparse_matrices.o\
104 files.o interpolation.o chemical.o xml.o \104 files.o interpolation.o chemical.o xml.o \
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 \
106<<<<<<< TREE
106 spatial.o timer_local.o 107 spatial.o timer_local.o
108=======
109 spatial.o timer_local.o die.o alloc_handlers.o
110>>>>>>> MERGE-SOURCE
107#111#
108COM_OBJS_DENCHAR=$(OBJS_DENCHAR) $(SYSOBJ)112COM_OBJS_DENCHAR=$(OBJS_DENCHAR) $(SYSOBJ)
109ALL_OBJS_DENCHAR=$(MOD_OBJS) $(COM_OBJS_DENCHAR)113ALL_OBJS_DENCHAR=$(MOD_OBJS) $(COM_OBJS_DENCHAR)
@@ -141,8 +145,6 @@
141debugmpi.o: parallel.o145debugmpi.o: parallel.o
142sys.o: parallel.o146sys.o: parallel.o
143m_io.o: sys.o147m_io.o: sys.o
144alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o
145memoryinfo.o: precision.o
146listsc.o: alloc.o148listsc.o: alloc.o
147atom_options.o: sys.o149atom_options.o: sys.o
148atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o150atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o
@@ -169,7 +171,8 @@
169readsts.o: precision.o171readsts.o: precision.o
170io.o: sys.o172io.o: sys.o
171iodm.o: alloc.o files.o parallel.o parallelsubs.o precision.o sys.o173iodm.o: alloc.o files.o parallel.o parallelsubs.o precision.o sys.o
172memory.o: alloc.o memoryinfo.o parallel.o precision.o174memory.o: memory_log.o parallel.o
175memory_log.o: m_io.o parallel.o precision.o
173colinear.o: precision.o176colinear.o: precision.o
174neighb.o: precision.o177neighb.o: precision.o
175radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o178radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o
176179
=== added file 'Util/Denchar/Src/alloc_handlers.f90'
--- Util/Denchar/Src/alloc_handlers.f90 1970-01-01 00:00:00 +0000
+++ Util/Denchar/Src/alloc_handlers.f90 2016-07-19 08:21:24 +0000
@@ -0,0 +1,14 @@
1 ! Error message and integer code
2 ! If 'code' is 0, this is the last call in a series
3 ! (see below for usage)
4 subroutine alloc_error_report(str,code)
5 character(len=*), intent(in) :: str
6 integer, intent(in) :: code
7 end subroutine alloc_error_report
8 !
9 ! Logger for memory events
10 !
11 subroutine alloc_memory_event(bytes,name)
12 integer, intent(in) :: bytes
13 character(len=*), intent(in) :: name
14 end subroutine alloc_memory_event
015
=== modified file 'Util/Gen-basis/Makefile'
--- Util/Gen-basis/Makefile 2016-07-12 13:38:13 +0000
+++ Util/Gen-basis/Makefile 2016-07-19 08:21:24 +0000
@@ -39,6 +39,8 @@
39FC_SERIAL?=$(FC_DEFAULT)39FC_SERIAL?=$(FC_DEFAULT)
40FC:=$(FC_SERIAL) # Make it non-recursive40FC:=$(FC_SERIAL) # Make it non-recursive
41#41#
42GRIDXC_SERIAL_ROOT ?= $(GRIDXC_ROOT)
43#
42DEFS:= $(DEFS) $(DEFS_PREFIX)-UMPI44DEFS:= $(DEFS) $(DEFS_PREFIX)-UMPI
43FPPFLAGS:=$(FPPFLAGS) $(DEFS_PREFIX)-UMPI45FPPFLAGS:=$(FPPFLAGS) $(DEFS_PREFIX)-UMPI
44#46#
@@ -60,20 +62,33 @@
60# Note that machine-specific files are now in top Src directory.62# Note that machine-specific files are now in top Src directory.
61#63#
62OBJS_GEN-BASIS=m_io.o io.o alloc.o basis_types.o precision.o parallel.o \64OBJS_GEN-BASIS=m_io.o io.o alloc.o basis_types.o precision.o parallel.o \
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\
64 atmparams.o old_atmfuncs.o radial.o interpolation.o \66 atmparams.o old_atmfuncs.o radial.o interpolation.o \
65 paste.o bessph.o radfft.o sorting.o m_filter.o \67 paste.o bessph.o radfft.o sorting.o m_filter.o \
68<<<<<<< TREE
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\
67 pxf.o dot.o atom_options.o arw.o \70 pxf.o dot.o atom_options.o arw.o \
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) \
69 xc.o bsc_xcmod.o local_die.o ldau_specs.o m_cite.o72 xc.o bsc_xcmod.o local_die.o ldau_specs.o m_cite.o
73=======
74 basis_specs.o ldau_specs.o atom.o memory.o memory_log.o periodic_table.o\
75 pseudopotential.o pxf.o dot.o atom_options.o arw.o \
76 sys.o xml.o m_walltime.o read_xc_info.o gen-basis.o $(SYSOBJ) \
77 xc.o bsc_xcmod.o handlers.o m_fft_gpfa.o m_cite.o
78>>>>>>> MERGE-SOURCE
70#79#
71IONCAT_OBJS=f2kcli.o m_getopts.o basis_types.o precision.o parallel.o \80IONCAT_OBJS=f2kcli.o m_getopts.o basis_types.o precision.o parallel.o \
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\
73 atmparams.o radial.o memory.o chkdim.o\82 atmparams.o radial.o memory.o chkdim.o\
83<<<<<<< TREE
74 paste.o chemical.o \84 paste.o chemical.o \
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 \
86=======
87 paste.o pseudopotential.o chemical.o \
88 basis_specs.o memory_log.o periodic_table.o pxf.o \
89>>>>>>> MERGE-SOURCE
76 atmfuncs.o spher_harm.o interpolation.o\90 atmfuncs.o spher_harm.o interpolation.o\
91<<<<<<< TREE
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)
78#93#
79# Compile XC in a private directory, without MPI94# Compile XC in a private directory, without MPI
@@ -90,6 +105,13 @@
90 "FPPFLAGS=$(FPPFLAGS)" \105 "FPPFLAGS=$(FPPFLAGS)" \
91 "MPI_INTERFACE= " \106 "MPI_INTERFACE= " \
92 "FFLAGS=$(FFLAGS)" module )107 "FFLAGS=$(FFLAGS)" module )
108=======
109 sys.o xml.o m_walltime.o ioncat.o handlers.o $(SYSOBJ)
110#
111include $(GRIDXC_SERIAL_ROOT)/gridxc.mk
112XC = $(GRIDXC_LIBS)
113INCFLAGS:= $(INCFLAGS) $(GRIDXC_INCFLAGS)
114>>>>>>> MERGE-SOURCE
93#115#
94NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a116NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a
95PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a117PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a
@@ -98,7 +120,7 @@
98#120#
99FDF=libfdf.a121FDF=libfdf.a
100FDF_MAKEFILE=$(TOP_LEVEL)/fdf/makefile122FDF_MAKEFILE=$(TOP_LEVEL)/fdf/makefile
101FDF_INCFLAGS:=-I $(TOP_LEVEL)/fdf $(INCFLAGS)123FDF_INCFLAGS:=#-I $(TOP_LEVEL)/fdf $(INCFLAGS)
102$(FDF): 124$(FDF):
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" \
104 "ARCH_MAKE=$(ARCH_MAKE)" \126 "ARCH_MAKE=$(ARCH_MAKE)" \
@@ -132,7 +154,6 @@
132 rm -f gen-basis ioncat *.o *.a154 rm -f gen-basis ioncat *.o *.a
133 rm -f *.mod155 rm -f *.mod
134 rm -rf fdf156 rm -rf fdf
135 rm -rf SiestaXC
136 rm -f _tmp_deps deps.list protomake*157 rm -f _tmp_deps deps.list protomake*
137#158#
138ALL_OBJS=$(IONCAT_OBJS) $(OBJS_GEN-BASIS)159ALL_OBJS=$(IONCAT_OBJS) $(OBJS_GEN-BASIS)
@@ -153,28 +174,41 @@
153basis_types.o: alloc.o atmparams.o precision.o sys.o174basis_types.o: alloc.o atmparams.o precision.o sys.o
154m_io.o: sys.o175m_io.o: sys.o
155io.o: sys.o176io.o: sys.o
156alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o
157atom_options.o: sys.o177atom_options.o: sys.o
158basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o178basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o
159basis_io.o: precision.o radial.o sys.o xml.o179basis_io.o: precision.o radial.o sys.o xml.o
160atm_types.o: precision.o radial.o180atm_types.o: precision.o radial.o
161radial.o: alloc.o interpolation.o precision.o xml.o181radial.o: alloc.o interpolation.o precision.o xml.o
162memory.o: alloc.o memoryinfo.o parallel.o precision.o182memory.o: memory_log.o parallel.o
163chkdim.o: sys.o183chkdim.o: sys.o
164chemical.o: parallel.o precision.o sys.o184chemical.o: parallel.o precision.o sys.o
185<<<<<<< TREE
165basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o186basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o
166memoryinfo.o: precision.o187memoryinfo.o: precision.o
167m_memory.o: memoryinfo.o parallel.o sys.o188m_memory.o: memoryinfo.o parallel.o sys.o
189=======
190basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o
191basis_specs.o: pseudopotential.o sys.o
192memory_log.o: m_io.o parallel.o precision.o
193>>>>>>> MERGE-SOURCE
168periodic_table.o: precision.o sys.o194periodic_table.o: precision.o sys.o
169atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o195atmfuncs.o: atm_types.o precision.o radial.o spher_harm.o sys.o
170spher_harm.o: alloc.o precision.o sys.o196spher_harm.o: alloc.o precision.o sys.o
171sys.o: parallel.o197sys.o: parallel.o
172xml.o: precision.o198xml.o: precision.o
173ioncat.o: atm_types.o atmfuncs.o basis_io.o m_getopts.o precision.o199ioncat.o: atm_types.o atmfuncs.o basis_io.o m_getopts.o precision.o
200<<<<<<< TREE
201=======
202handlers.o: memory_log.o
203>>>>>>> MERGE-SOURCE
174m_io.o: sys.o204m_io.o: sys.o
175io.o: sys.o205io.o: sys.o
206<<<<<<< TREE
176alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o207alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o
177basis_types.o: alloc.o atmparams.o precision.o sys.o208basis_types.o: alloc.o atmparams.o precision.o sys.o
209=======
210basis_types.o: alloc.o atmparams.o precision.o pseudopotential.o sys.o
211>>>>>>> MERGE-SOURCE
178basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o212basis_io.o: atm_types.o atmparams.o atom_options.o basis_types.o chemical.o
179basis_io.o: precision.o radial.o sys.o xml.o213basis_io.o: precision.o radial.o sys.o xml.o
180chemical.o: parallel.o precision.o sys.o214chemical.o: parallel.o precision.o sys.o
@@ -186,23 +220,40 @@
186bessph.o: precision.o sys.o220bessph.o: precision.o sys.o
187radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o221radfft.o: alloc.o bessph.o m_fft_gpfa.o precision.o
188m_filter.o: bessph.o precision.o radfft.o sorting.o sys.o222m_filter.o: bessph.o precision.o radfft.o sorting.o sys.o
223<<<<<<< TREE
189basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o224basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o sys.o
225=======
226basis_specs.o: basis_types.o chemical.o periodic_table.o precision.o
227basis_specs.o: pseudopotential.o sys.o
228ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o
229ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o
230ldau_specs.o: precision.o pseudopotential.o radial.o sys.o units.o
231>>>>>>> MERGE-SOURCE
190atom.o: atmparams.o atom_options.o basis_specs.o basis_types.o bsc_xcmod.o232atom.o: atmparams.o atom_options.o basis_specs.o basis_types.o bsc_xcmod.o
191atom.o: interpolation.o m_filter.o old_atmfuncs.o periodic_table.o precision.o233atom.o: interpolation.o m_filter.o old_atmfuncs.o periodic_table.o precision.o
234<<<<<<< TREE
192atom.o: sys.o235atom.o: sys.o
193memoryinfo.o: precision.o236memoryinfo.o: precision.o
194memory.o: alloc.o memoryinfo.o parallel.o precision.o237memory.o: alloc.o memoryinfo.o parallel.o precision.o
238=======
239atom.o: pseudopotential.o sys.o
240memory.o: memory_log.o parallel.o
241memory_log.o: m_io.o parallel.o precision.o
242>>>>>>> MERGE-SOURCE
195periodic_table.o: precision.o sys.o243periodic_table.o: precision.o sys.o
196atom_options.o: sys.o244atom_options.o: sys.o
197arw.o: alloc.o parallel.o precision.o sys.o245arw.o: alloc.o parallel.o precision.o sys.o
198sys.o: parallel.o246sys.o: parallel.o
199timer.o: m_timer.o parallel.o sys.o timer_tree.o
200xml.o: precision.o247xml.o: precision.o
201read_xc_info.o: parallel.o precision.o sys.o248read_xc_info.o: parallel.o precision.o sys.o
202gen-basis.o: atom.o atom_options.o basis_io.o basis_specs.o basis_types.o249gen-basis.o: atom.o atom_options.o basis_io.o basis_specs.o basis_types.o
203gen-basis.o: old_atmfuncs.o parallel.o precision.o sys.o250gen-basis.o: old_atmfuncs.o parallel.o precision.o sys.o
204xc.o: alloc.o bsc_xcmod.o precision.o sys.o251xc.o: alloc.o bsc_xcmod.o precision.o sys.o
205bsc_xcmod.o: parallel.o precision.o sys.o252bsc_xcmod.o: parallel.o precision.o sys.o
253<<<<<<< TREE
206ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o254ldau_specs.o: alloc.o atm_types.o atmparams.o atom.o atom_options.o
207ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o255ldau_specs.o: basis_specs.o basis_types.o interpolation.o m_cite.o parallel.o
208ldau_specs.o: precision.o radial.o sys.o units.o256ldau_specs.o: precision.o radial.o sys.o units.o
257=======
258handlers.o: memory_log.o
259>>>>>>> MERGE-SOURCE
209260
=== added file 'Util/Gen-basis/handlers.f'
--- Util/Gen-basis/handlers.f 1970-01-01 00:00:00 +0000
+++ Util/Gen-basis/handlers.f 2016-07-19 08:21:24 +0000
@@ -0,0 +1,114 @@
1!--------------------------------------------------
2! Stand-alone 'die' routine for use by libraries and
3! low-level modules.
4!
5! Each program using the module or library needs to
6! provide a routine with the proper interface, but
7! accomodating the needs and conventions of the program.
8! For example, in Siesta:
9!
10! - The use of a Siesta-specific 'mpi_siesta' module.
11! - The need to have the pxf functionality.
12! - The use of 'unit 6' as output.
13!
14! Routines using this functionality should include
15! the following
16!
17! interface
18! subroutine die(str)
19! character(len=*), intent(in) :: str
20! end subroutine die
21! end interface
22!
23!------------------------------------------------------
24
25 subroutine die(str)
26
27 character(len=*), intent(in) :: str
28
29 write(6,'(a)') trim(str)
30 write(0,'(a)') trim(str)
31 write(6,'(a,i4)') 'Stopping Program from Node: ', Node
32 write(0,'(a,i4)') 'Stopping Program from Node: ', Node
33 call pxfflush(6)
34 call pxfflush(0)
35 call pxfabort()
36
37 end subroutine die
38
39 subroutine timer(str,i)
40
41 character(len=*), intent(in) :: str
42 integer, intent(in) :: i
43 end subroutine timer
44
45!--------------------------------------------------
46! Stand-alone routine to capture error messages from
47! the alloc module
48!
49! This functionality could be made more general,
50! and use a uniform interface for all the utility
51! modules developed in-house. (Let's say, call it
52! 'error_report' with severity arguments, etc).
53!
54! Each program using the alloc module needs to
55! provide a routine with the proper interface, but
56! accomodating the needs and conventions of the program.
57! For example, in Siesta:
58!
59! - The tagging of the message by Node.
60! - The use of 'unit 6' as output and '0' as error.
61!
62! Routines using this functionality should include
63! the following
64!
65! subroutine alloc_error_report(str,code)
66! character(len=*), intent(in) :: str
67! integer, intent(in) :: code
68! end subroutine alloc_error_report
69!
70!------------------------------------------------------
71
72 subroutine alloc_error_report(str,code)
73
74 character(len=*), intent(in) :: str
75 integer, intent(in) :: code
76
77 if (code == 0) then
78 call die(str)
79 else
80 write(0,*) trim(str)
81 write(6,*) trim(str)
82 endif
83
84 end subroutine alloc_error_report
85!--------------------------------------------------
86! Stand-alone routine to capture memory events from
87! the alloc module
88!
89! Each program using the alloc module needs to
90! provide a routine with the proper interface, but
91! accomodating the needs and conventions of the program.
92! For example, in Siesta
93!
94! - The use of the memory_log module for reports
95!
96! Routines using this functionality should include
97! the following
98!
99! subroutine alloc_memory_event(str,code)
100! character(len=*), intent(in) :: str
101! integer, intent(in) :: code
102! end subroutine alloc_memory_event
103!
104!------------------------------------------------------
105
106 subroutine alloc_memory_event(bytes,name)
107 use memory_log, only: memory_event
108
109 integer, intent(in) :: bytes
110 character(len=*), intent(in) :: name
111
112 call memory_event(bytes,name)
113
114 end subroutine alloc_memory_event
0115
=== renamed file 'Util/Gen-basis/local_die.F' => 'Util/Gen-basis/local_die.F.THIS'
=== modified file 'Util/SiestaSubroutine/ProtoNEB/Src/Makefile'
--- Util/SiestaSubroutine/ProtoNEB/Src/Makefile 2016-06-29 04:07:55 +0000
+++ Util/SiestaSubroutine/ProtoNEB/Src/Makefile 2016-07-19 08:21:24 +0000
@@ -39,6 +39,7 @@
39SIESTA_LIB=libSiestaForces.a39SIESTA_LIB=libSiestaForces.a
40FDF=libfdf.a40FDF=libfdf.a
41XMLPARSER=libxmlparser.a41XMLPARSER=libxmlparser.a
42<<<<<<< TREE
42XC=libSiestaXC.a43XC=libSiestaXC.a
43#44#
44include $(MAIN_OBJDIR)/Mk/FoX.mk45include $(MAIN_OBJDIR)/Mk/FoX.mk
@@ -47,6 +48,10 @@
47PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a48PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a
48PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a49PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a
49#50#
51=======
52XC=libGridXC.a
53FoX_LIBS=`$(OBJ_DIR)/FoX/FoX-config --libs --wcml`
54>>>>>>> MERGE-SOURCE
50ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \55ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \
51 $(NCPS) $(PSML) $(PSOP) \56 $(NCPS) $(PSML) $(PSOP) \
52 $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS)57 $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS)
5358
=== modified file 'Util/SiestaSubroutine/SimpleTest/Src/Makefile'
--- Util/SiestaSubroutine/SimpleTest/Src/Makefile 2016-06-29 04:07:55 +0000
+++ Util/SiestaSubroutine/SimpleTest/Src/Makefile 2016-07-19 08:21:24 +0000
@@ -57,6 +57,7 @@
57SIESTA_LIB=libSiestaForces.a57SIESTA_LIB=libSiestaForces.a
58FDF=libfdf.a58FDF=libfdf.a
59XMLPARSER=libxmlparser.a59XMLPARSER=libxmlparser.a
60<<<<<<< TREE
60XC=libSiestaXC.a61XC=libSiestaXC.a
61include $(MAIN_OBJDIR)/Mk/FoX.mk62include $(MAIN_OBJDIR)/Mk/FoX.mk
62#63#
@@ -64,6 +65,10 @@
64PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a65PSOP=$(MAIN_OBJDIR)/psoplib/src/libpsop.a
65PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a66PSML=$(MAIN_OBJDIR)/psml/src/libpsml.a
66#67#
68=======
69XC=libGridXC.a
70FoX_LIBS=`$(OBJ_DIR)/FoX/FoX-config --libs --wcml`
71>>>>>>> MERGE-SOURCE
67ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \72ALL_LIBS= $(SIESTA_LIB) $(FDF) $(WXML) $(XMLPARSER) $(XC) \
68 $(NCPS) $(PSML) $(PSOP) \73 $(NCPS) $(PSML) $(PSOP) \
69 $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS)74 $(MPI_INTERFACE) $(COMP_LIBS) $(FOX_LIBS) $(LIBS)
7075
=== modified file 'Util/VCA/Makefile'
--- Util/VCA/Makefile 2016-07-12 13:38:13 +0000
+++ Util/VCA/Makefile 2016-07-19 08:21:24 +0000
@@ -85,17 +85,28 @@
85#85#
86MIXPS_OBJS= f2kcli.o interpolation.o atom_options.o \86MIXPS_OBJS= f2kcli.o interpolation.o atom_options.o \
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 \
88<<<<<<< TREE
88 memory.o memoryinfo.o mixps.o psml_die.o die.o89 memory.o memoryinfo.o mixps.o psml_die.o die.o
89#90#
90NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a91NCPS=$(MAIN_OBJDIR)/ncps/src/libncps.a
91#92#
92mixps: $(FDF) $(MIXPS_OBJS) $(NCPS) 93mixps: $(FDF) $(MIXPS_OBJS) $(NCPS)
94=======
95 memory.o memory_log.o mixps.o handlers.o
96
97mixps: $(FDF) $(MIXPS_OBJS)
98>>>>>>> MERGE-SOURCE
93 $(FC) -o mixps \99 $(FC) -o mixps \
94 $(LDFLAGS) $(MIXPS_OBJS) $(NCPS) $(FDF) $(PSML_LIBS) $(XMLF90_LIBS)100 $(LDFLAGS) $(MIXPS_OBJS) $(NCPS) $(FDF) $(PSML_LIBS) $(XMLF90_LIBS)
95#----------------------------------------------------------------------------101#----------------------------------------------------------------------------
96FRACTIONAL_OBJS= f2kcli.o m_io.o alloc.o interpolation.o fractional.o \102FRACTIONAL_OBJS= f2kcli.o m_io.o alloc.o interpolation.o fractional.o \
103<<<<<<< TREE
97 atom_options.o memory.o memoryinfo.o sys.o \104 atom_options.o memory.o memoryinfo.o sys.o \
98 io.o pxf.o parallel.o periodic_table.o psml_die.o die.o105 io.o pxf.o parallel.o periodic_table.o psml_die.o die.o
106=======
107 atom_options.o memory.o memory_log.o pseudopotential.o \
108 io.o pxf.o parallel.o periodic_table.o handlers.o sys.o
109>>>>>>> MERGE-SOURCE
99110
100fractional: $(FDF) $(FRACTIONAL_OBJS) $(NCPS) 111fractional: $(FDF) $(FRACTIONAL_OBJS) $(NCPS)
101 $(FC) -o fractional \112 $(FC) -o fractional \
@@ -128,19 +139,38 @@
128sys.o: parallel.o139sys.o: parallel.o
129m_io.o: sys.o140m_io.o: sys.o
130io.o: sys.o141io.o: sys.o
131alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o
132periodic_table.o: precision.o sys.o142periodic_table.o: precision.o sys.o
133memory.o: alloc.o memoryinfo.o parallel.o precision.o143memory.o: memory_log.o parallel.o
134memoryinfo.o: precision.o144memory_log.o: m_io.o parallel.o precision.o
135mixps.o: f2kcli.o interpolation.o periodic_table.o precision.o145mixps.o: f2kcli.o interpolation.o periodic_table.o precision.o
146<<<<<<< TREE
136die.o: parallel.o147die.o: parallel.o
148=======
149mixps.o: pseudopotential.o
150handlers.o: memory_log.o
151>>>>>>> MERGE-SOURCE
137m_io.o: sys.o152m_io.o: sys.o
153<<<<<<< TREE
138alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o154alloc.o: debugmpi.o m_io.o parallel.o precision.o sys.o
139fractional.o: f2kcli.o periodic_table.o precision.o155fractional.o: f2kcli.o periodic_table.o precision.o
156=======
157fractional.o: f2kcli.o periodic_table.o precision.o pseudopotential.o
158>>>>>>> MERGE-SOURCE
140atom_options.o: sys.o159atom_options.o: sys.o
160<<<<<<< TREE
141memory.o: alloc.o memoryinfo.o parallel.o precision.o161memory.o: alloc.o memoryinfo.o parallel.o precision.o
142memoryinfo.o: precision.o162memoryinfo.o: precision.o
143sys.o: parallel.o163sys.o: parallel.o
164=======
165memory.o: memory_log.o parallel.o
166memory_log.o: m_io.o parallel.o precision.o
167pseudopotential.o: alloc.o atom_options.o interpolation.o precision.o sys.o
168>>>>>>> MERGE-SOURCE
144io.o: sys.o169io.o: sys.o
145periodic_table.o: precision.o sys.o170periodic_table.o: precision.o sys.o
171<<<<<<< TREE
146die.o: parallel.o172die.o: parallel.o
173=======
174handlers.o: memory_log.o
175sys.o: parallel.o
176>>>>>>> MERGE-SOURCE
147177
=== added file 'Util/VCA/handlers.f'
--- Util/VCA/handlers.f 1970-01-01 00:00:00 +0000
+++ Util/VCA/handlers.f 2016-07-19 08:21:24 +0000
@@ -0,0 +1,114 @@
1!--------------------------------------------------
2! Stand-alone 'die' routine for use by libraries and
3! low-level modules.
4!
5! Each program using the module or library needs to
6! provide a routine with the proper interface, but
7! accomodating the needs and conventions of the program.
8! For example, in Siesta:
9!
10! - The use of a Siesta-specific 'mpi_siesta' module.
11! - The need to have the pxf functionality.
12! - The use of 'unit 6' as output.
13!
14! Routines using this functionality should include
15! the following
16!
17! interface
18! subroutine die(str)
19! character(len=*), intent(in) :: str
20! end subroutine die
21! end interface
22!
23!------------------------------------------------------
24
25 subroutine die(str)
26
27 character(len=*), intent(in) :: str
28
29 write(6,'(a)') trim(str)
30 write(0,'(a)') trim(str)
31 write(6,'(a,i4)') 'Stopping Program from Node: ', Node
32 write(0,'(a,i4)') 'Stopping Program from Node: ', Node
33 call pxfflush(6)
34 call pxfflush(0)
35 call pxfabort()
36
37 end subroutine die
38
39 subroutine timer(str,i)
40
41 character(len=*), intent(in) :: str
42 integer, intent(in) :: i
43 end subroutine timer
44
45!--------------------------------------------------
46! Stand-alone routine to capture error messages from
47! the alloc module
48!
49! This functionality could be made more general,
50! and use a uniform interface for all the utility
51! modules developed in-house. (Let's say, call it
52! 'error_report' with severity arguments, etc).
53!
54! Each program using the alloc module needs to
55! provide a routine with the proper interface, but
56! accomodating the needs and conventions of the program.
57! For example, in Siesta:
58!
59! - The tagging of the message by Node.
60! - The use of 'unit 6' as output and '0' as error.
61!
62! Routines using this functionality should include
63! the following
64!
65! subroutine alloc_error_report(str,code)
66! character(len=*), intent(in) :: str
67! integer, intent(in) :: code
68! end subroutine alloc_error_report
69!
70!------------------------------------------------------
71
72 subroutine alloc_error_report(str,code)
73
74 character(len=*), intent(in) :: str
75 integer, intent(in) :: code
76
77 if (code == 0) then
78 call die(str)
79 else
80 write(0,*) trim(str)
81 write(6,*) trim(str)
82 endif
83
84 end subroutine alloc_error_report
85!--------------------------------------------------
86! Stand-alone routine to capture memory events from
87! the alloc module
88!
89! Each program using the alloc module needs to
90! provide a routine with the proper interface, but
91! accomodating the needs and conventions of the program.
92! For example, in Siesta
93!
94! - The use of the memory_log module for reports
95!
96! Routines using this functionality should include
97! the following
98!
99! subroutine alloc_memory_event(str,code)
100! character(len=*), intent(in) :: str
101! integer, intent(in) :: code
102! end subroutine alloc_memory_event
103!
104!------------------------------------------------------
105
106 subroutine alloc_memory_event(bytes,name)
107 use memory_log, only: memory_event
108
109 integer, intent(in) :: bytes
110 character(len=*), intent(in) :: name
111
112 call memory_event(bytes,name)
113
114 end subroutine alloc_memory_event
0115
=== modified file 'version.info'
--- version.info 2016-07-16 20:21:18 +0000
+++ version.info 2016-07-19 08:21:24 +0000
@@ -1,6 +1,12 @@
1<<<<<<< TREE
1trunk-506--psml-812trunk-506--psml-81
23
34
45
56
67
8=======
9siesta-trunk-503--gridxc-12
10
11
12>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches