[CPMD-list] density calculation: memory errors

Axel Kohlmeyer axel.kohlmeyer at theochem.ruhr-uni-bochum.de
Wed Feb 16 12:50:11 CET 2005


>>> "WF" == Wolfgang Fritsch <fritsch at hmi.de> writes:

WF> Dear in the knowing,

dear wolfgang,

WF> for a band structure calculation I have used an input file for the 
WF> density, that I have modified from file found somewhere in this list 
WF> here and which seems to have run successfully. Now this does not run at 
WF> all here. I am getting memory errors. No matter what I can think of in 
WF> terms of cutting back on the size of the calculation, the memory errors 
WF> stay on though the details of the complaints look different.

WF> Surely something I am doing is odd?

you may be simply tripping over some bugs, i found some 
time ago in the swapfile handling for k-points.

please try the following changes (you may have to apply them 
manually, since they are extracted from the cvs but may overlap
with other changes, that don't matter here).

-begin-patch--begin-patch--begin-patch--begin-patch--begin-patch-

Index: rwswap.F
===================================================================
RCS file: /users/cvsroot/cpmd/CPMD/rwswap.F,v
retrieving revision 1.12.4.1
retrieving revision 1.12.4.3
diff -u -r1.12.4.1 -r1.12.4.3
--- rwswap.F	17 Aug 2004 09:19:29 -0000	1.12.4.1
+++ rwswap.F	19 Sep 2004 16:37:56 -0000	1.12.4.3
@@ -408,12 +408,14 @@
         ENDDO
         TSWCALC=TKBCALC
         TSWAPC0=.NOT.TKNOSWAP
+        CALL TIHALT('  INI_SWAP',ISUB)
         RETURN
       ENDIF
 C     ==--------------------------------------------------------------==
 C     Special case if we want to calculate k point per k point(TKNOSWAP)
       IF(IFILE.EQ.1.AND.(.NOT.TSWAPC0)) THEN
 C       Do nothing (no swap file for C0).
+        CALL TIHALT('  INI_SWAP',ISUB)
         RETURN
       ENDIF
 C     ==--------------------------------------------------------------==
@@ -427,11 +429,18 @@
         IF(ISIDISW(IFILE).LE.0)
      &       CALL STOPGM('INI_SWAP','SIZE OF RECORD NOT SPECIFIED')
         IUNITSW(IFILE)=50+IFILE
-C       WARNING: THE RECORDSIZE IS PROCESSOR-DEPENDENT!!
-#if defined(__SUN)
-C       You must specify the length in number of characters.
+C       WARNING: THE RECORDSIZE IS MACHINE/COMPILER-DEPENDENT!!
+#if defined(__SUN) || defined(__PGI) || defined(LINUX_IFC) || defined(__IBM) || defined(__HP) || defined(__OSX)
+C       these machines specify the length in number of characters.
         IRECORDSIZE=8*ISIDISW(IFILE)
+#elif defined(__SGI) || defined(__alpha)
+C       these machines specify the length in number of real words.
+        IRECORDSIZE=2*ISIDISW(IFILE)
 #else
+        WRITE(*,'(/,2A,/,2A)') ' WARNING| RECORDSIZE MULTIPLIER FOR',
+     &   ' DIRECT ACCESS SWAP FILES NOT KNOWN.',
+     &   ' WARNING| USING DEFAULT OF 2.',
+     &   ' CHANGE IN FILE rwswap.F IF NEEDED.'
         IRECORDSIZE=2*ISIDISW(IFILE)
 #endif        
         OPEN(UNIT=IUNITSW(IFILE),FILE=SWFILE(IFILE),
@@ -635,6 +644,7 @@
       ENDIF
  30   CONTINUE
       IF(ISWMEM(INDI,IFILE).EQ.IKPT) THEN
+        CALL TIHALT('  REA_SWAP',ISUB)
         RETURN
       ENDIF
       IPOSITION=ISWPOS(IKPT,INDI,IFILE)
Index: sysin.F
===================================================================
RCS file: /users/cvsroot/cpmd/CPMD/sysin.F,v
retrieving revision 1.42.2.3
retrieving revision 1.42.2.5
diff -u -r1.42.2.3 -r1.42.2.5
--- sysin.F	18 May 2004 13:40:39 -0000	1.42.2.3
+++ sysin.F	19 Sep 2004 16:37:58 -0000	1.42.2.5
@@ -574,6 +574,7 @@
           I1=INDEX(LINE,'BLOCK')
           IF(I1.NE.0) THEN
             TKBLOCK=.TRUE.
+            TKBCALC=.TRUE.
             I2=I1+INDEX(LINE(I1:80),'=')
             CALL READSI(LINE(I2:80),1,IOUT,NKPNT,ERREAD)
             IF(ERREAD) THEN
@@ -585,7 +586,9 @@
      &         CALL STOPGM('  SYSIN','WRONG NUMBER OF K POINTS BLOCK')  
             IF(INDEX(LINE,'ALL').NE.0) THEN
               TKALL=.TRUE.
+              TKBCALC=.FALSE.
             ELSEIF(INDEX(LINE,'CALC').NE.0) THEN
+              TKALL=.FALSE.
               TKBCALC=.TRUE.
             ENDIF
             IF(INDEX(LINE,'NOSWAP').NE.0) THEN
Index: sysin.F
===================================================================
RCS file: /users/cvsroot/cpmd/CPMD/sysin.F,v
retrieving revision 1.42.2.6
retrieving revision 1.42.2.7
diff -u -r1.42.2.6 -r1.42.2.7
--- sysin.F	22 Sep 2004 09:18:27 -0000	1.42.2.6
+++ sysin.F	18 Dec 2004 12:40:31 -0000	1.42.2.7
@@ -589,6 +589,8 @@
           IF(I1.NE.0) THEN
             TKBLOCK=.TRUE.
             TKBCALC=.TRUE.
+            IF(.NOT.TLANC)
+     &        CALL STOPGM('  SYSIN','SWAP FILES ONLY WITH LANCZOS')
             I2=I1+INDEX(LINE(I1:80),'=')
             CALL READSI(LINE(I2:80),1,IOUT,NKPNT,ERREAD)
             IF(ERREAD) THEN
Index: memory.F
===================================================================
RCS file: /users/cvsroot/cpmd/CPMD/memory.F,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.3
diff -u -r1.18.2.1 -r1.18.2.3
--- memory.F	2 Jun 2004 09:09:45 -0000	1.18.2.1
+++ memory.F	21 Jan 2005 12:10:33 -0000	1.18.2.3
@@ -95,14 +95,14 @@
 #endif
       LEN = 8 * LEN
       LEN=MAX(LEN,400)
-#if defined(__IBM) || defined(__SR2201)
+#if defined(__IBM) || defined(__SR2201) || defined(__OSX)
       IP_XM=MALLOC(%VAL(LEN))
 #elif defined(__SR8000)
       IP_XM=MALLOC(LEN)  ! cmb: compile with -DMALLOC8 !
 #else
       IP_XM=MALLOC(LEN)
 #endif
-#if defined(__HP)
+#if defined(__HP) || defined(__PGI) || defined(LINUX_IFC) || defined(__alpha)
       IF(IP_XM.EQ.0) THEN
         IERROR=1
       ENDIF


-end-patch--end-patch--end-patch--end-patch--end-patch--end-patch-

WF> This is on a cluster of parallel alpha workstation, with some 4 GB 

running linux or OSF/True64?

WF> memory, 500 MB is available at each node.

WF> I am appending first the input file and then the output from the job, 
WF> calculated with the serial version of the code.

last time i checked, swap files didn't work 
in parallel at all.

WF> Thank you very much for any suggestions,

WF> Wolfgang

[...]

WF>    MEMORY| MEMORY REQUIRED:   269051914  WORDS


WF>   PROGRAM STOPS IN SUBROUTINE MEMORY| TOO BIG VALUE

the last part of the patch above relaxes the check in
memory a little bit, so that allocations > 2GB work. 
alternatively, you can try compiling with -DMALLOC8,
i don't know whether that will work, though.

regards,
        axel.

WF> _______________________________________________
WF> CPMD-list mailing list
WF> CPMD-list at cpmd.org
WF> http://cpmd.org/mailman/listinfo/cpmd-list



--

=======================================================================
Axel Kohlmeyer       e-mail: axel.kohlmeyer at theochem.ruhr-uni-bochum.de
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum  http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.



More information about the CPMD-list mailing list