[Debichem-devel] Bug#696361: nwchem: Qualitatively wrong anisotropic properties
Michael Banck
mbanck at debian.org
Thu Dec 20 00:54:27 UTC 2012
Package: nwchem
Version: 6.1-3
Severity: important
Tags: patch
While running the full test suite, the following test fails badly:
-----------------------------
echo
start h2o-response
memory global 40 mb stack 23 mb heap 5 mb
geometry units au
O 0 0 0
H 0 1.430 -1.107
H 0 -1.430 -1.107
end
basis
O library 6-31g*
H library 6-31g*
end
dft
xc b3lyp
end
set cphf:thresh 1.0d-6
set cphf:acc 1.0d-16
set cphf:maxiter 60
property
dipole
aoresponse 1 .0911267060
velocity
damping 0.007
end
task dft property
-----------------------------
Running tests/h2o-response/h2o-response
cleaning scratch
copying input and verified output files
running nwchem (/usr/bin/nwchem)
21.1u 0.4s 0:13.01 166.4% (0t+0ds+0avg+34190max)k 0i+257656o 6pf 0swaps
verifying output ... 4c4
< Anisotropic = 2.693
---
> Anisotropic = 17.467
failed
Note that the reference value of 2.693 is only present in the 6.0 and
6.1.1 test suites, the 6.1 testsuite in the current Debian upstream
version has a wrong reference value of 17.486, which makes it appear to
go mostly fine.
This problem unfortunately persists with nwchem_6.1-5. Besides the
backported 6.1.1 point release changes, also the changes in the Global
Arrays library are needed to fix the property calculation. I have
isolated the unrelated changes and reduced the patch to the changes to
the src/tools/ga-5-1/global directory, modulo some hunks which were
dependent on other changes and made NWChem segfault immediately. The
patch is attached.
Michael
-------------- next part --------------
diff -Naur ./src/tools/ga-5-1/global/src/base.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/base.c
--- ./src/tools/ga-5-1/global/src/base.c 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/base.c 2012-06-25 20:41:34.000000000 +0200
@@ -2092,7 +2091,7 @@
Integer g_A;
_ga_sync_begin = 1; _ga_sync_end=1; /*remove any previous sync masking*/
- pnga_sync();
+ pnga_pgroup_sync(p_handle);
GA_PUSH_NAME("pnga_create_ghosts_irreg_config");
g_A = pnga_create_handle();
diff -Naur ./src/tools/ga-5-1/global/src/capi.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/capi.c
--- ./src/tools/ga-5-1/global/src/capi.c 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/capi.c 2012-06-25 20:41:34.000000000 +0200
@@ -2134,7 +2134,7 @@
Integer a=(Integer)g_a;
Integer ndim = wnga_ndim(a);
Integer _ga_work[MAXDIM], _ga_lo[MAXDIM];
- COPYC2F(_ga_lo,index, ndim);
+ COPYC2F(index, _ga_lo, ndim);
wnga_access_block_grid_ptr(a,_ga_lo,ptr,_ga_work);
COPYF2C(_ga_work,ld, ndim-1);
}
@@ -2144,7 +2144,7 @@
Integer a=(Integer)g_a;
Integer ndim = wnga_ndim(a);
Integer _ga_lo[MAXDIM], _ga_work[MAXDIM];
- COPYC2F(_ga_lo,index, ndim);
+ COPYC2F(index, _ga_lo, ndim);
wnga_access_block_grid_ptr(a,_ga_lo,ptr,_ga_work);
COPYF2C_64(_ga_work,ld, ndim-1);
}
@@ -3218,7 +3218,7 @@
DoubleComplex alpha, int g_a, int g_b,
DoubleComplex beta, int g_c )
{
- GA_Zgemm64_c(ta, tb, n, m, k, alpha, g_b, g_a, beta, g_c);
+ GA_Zgemm64_c(tb, ta, n, m, k, alpha, g_b, g_a, beta, g_c);
}
void GA_Cgemm64(char ta, char tb, int64_t m, int64_t n, int64_t k,
diff -Naur ./src/tools/ga-5-1/global/src/ga.h ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ga.h
--- ./src/tools/ga-5-1/global/src/ga.h 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ga.h 2012-06-25 20:41:34.000000000 +0200
@@ -193,8 +193,8 @@
extern int NGA_Create_config(int type,int ndim,int dims[], char *name, int chunk[], int p_handle);
extern int NGA_Create_ghosts_config(int type,int ndim,int dims[], int width[], char *name, int chunk[], int p_handle);
extern int NGA_Create_ghosts(int type,int ndim,int dims[], int width[], char *name, int chunk[]);
-extern int NGA_Create_ghosts_irreg_config(int type,int ndim,int dims[], int width[], char *name, int map[], int nblock[], int p_handle);
-extern int NGA_Create_ghosts_irreg(int type,int ndim,int dims[], int width[], char *name, int map[], int nblock[]);
+extern int NGA_Create_ghosts_irreg_config(int type,int ndim,int dims[], int width[], char *name, int block[], int map[], int p_handle);
+extern int NGA_Create_ghosts_irreg(int type,int ndim,int dims[], int width[], char *name, int block[], int map[]);
extern int NGA_Create(int type,int ndim,int dims[], char *name, int chunk[]);
extern int NGA_Create(int type,int ndim,int dims[], char *name, int chunk[]);
extern int NGA_Create_irreg_config(int type,int ndim,int dims[],char *name, int block[], int map[], int p_handle);
@@ -369,8 +369,8 @@
extern int NGA_Create_config64(int type,int ndim,int64_t dims[], char *name, int64_t chunk[], int p_handle);
extern int NGA_Create_ghosts64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t chunk[]);
extern int NGA_Create_ghosts_config64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t chunk[], int p_handle);
-extern int NGA_Create_ghosts_irreg64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t map[], int64_t nblock[]);
-extern int NGA_Create_ghosts_irreg_config64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t map[], int64_t nblock[], int p_handle);
+extern int NGA_Create_ghosts_irreg64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t nblock[], int64_t map[]);
+extern int NGA_Create_ghosts_irreg_config64(int type,int ndim,int64_t dims[], int64_t width[], char *name, int64_t nblock[], int64_t map[], int p_handle);
extern int NGA_Create_irreg64(int type,int ndim,int64_t dims[],char *name, int64_t block[], int64_t map[]);
extern int NGA_Create_irreg_config64(int type,int ndim,int64_t dims[],char *name, int64_t block[], int64_t map[], int p_handle);
extern double NGA_Ddot_patch64(int g_a, char t_a, int64_t alo[], int64_t ahi[], int g_b, char t_b, int64_t blo[], int64_t bhi[]);
diff -Naur ./src/tools/ga-5-1/global/src/ga_malloc.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ga_malloc.c
--- ./src/tools/ga-5-1/global/src/ga_malloc.c 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ga_malloc.c 2012-06-25 20:41:34.000000000 +0200
@@ -7,6 +7,7 @@
#include "globalp.h"
#include "ga-papi.h"
+#include "ga-wapi.h"
#define GA_MAXMEM_AVAIL ( ( (long)1 << (8*sizeof(Integer)-2) ) -1)
#define CHECK 0
#define ALIGNMENT sizeof(DoubleComplex)
diff -Naur ./src/tools/ga-5-1/global/src/ghosts.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ghosts.c
--- ./src/tools/ga-5-1/global/src/ghosts.c 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/ghosts.c 2012-06-25 20:41:34.000000000 +0200
@@ -779,7 +779,7 @@
}
}
/* synchronize all processors and update increment array */
- if (idx < ndim-1) pnga_sync();
+ if (idx < ndim-1) pnga_pgroup_sync(p_handle);
if (corner_flag)
increment[idx] = 2*nwidth;
}
@@ -1282,7 +1282,7 @@
(int)(ndim - 1), (int)proc_rem);
}
/* synchronize all processors and update increment array */
- if (idx < ndim-1) pnga_sync();
+ if (idx < ndim-1) pnga_pgroup_sync(p_handle);
increment[idx] = 2*nwidth;
}
@@ -2762,14 +2762,14 @@
if (!pnga_has_ghosts(g_a))
return TRUE;
- if(local_sync_begin)pnga_sync();
+ p_handle = GA[handle].p_handle;
+ if(local_sync_begin)pnga_pgroup_sync(p_handle);
idim = pdim;
idir = pdir;
flag = pflag;
size = GA[handle].elemsize;
ndim = GA[handle].ndim;
- p_handle = GA[handle].p_handle;
/* initialize ghost cell widths and get array dimensions */
for (idx=0; idx < ndim; idx++) {
width[idx] = (Integer)GA[handle].width[idx];
@@ -2909,7 +2909,7 @@
}
GA_POP_NAME;
- if(local_sync_end)pnga_sync();
+ if(local_sync_end)pnga_pgroup_sync(p_handle);
return TRUE;
}
@@ -2967,7 +2967,8 @@
local_sync_begin = _ga_sync_begin; local_sync_end = _ga_sync_end;
_ga_sync_begin = 1; _ga_sync_end=1; /*remove any previous masking*/
- if(local_sync_begin)pnga_sync();
+ p_handle = GA[handle].p_handle;
+ if(local_sync_begin)pnga_pgroup_sync(p_handle);
#ifdef USE_MP_NORTHSOUTH
strcpy(send_name,"send_buffer");
@@ -2983,7 +2984,6 @@
/*size = GA[handle].elemsize;*/
ndim = GA[handle].ndim;
- p_handle = GA[handle].p_handle;
for (i=0; i<ndim; i++) {
width[i] = (Integer)GA[handle].width[i];
}
@@ -3085,7 +3085,7 @@
}
#endif
GA_POP_NAME;
- if(local_sync_end)pnga_sync();
+ if(local_sync_end)pnga_pgroup_sync(p_handle);
return TRUE;
}
@@ -3334,10 +3334,11 @@
update operation fails then use slow but robust version of
update operation */
int local_sync_begin,local_sync_end;
+ Integer handle = GA_OFFSET + g_a;
local_sync_begin = _ga_sync_begin; local_sync_end = _ga_sync_end;
_ga_sync_begin = 1; _ga_sync_end=1; /*remove any previous masking*/
- if(local_sync_begin)pnga_sync();
+ if(local_sync_begin)pnga_pgroup_sync(GA[handle].p_handle);
#ifdef CRAY_T3D
if (!pnga_update5_ghosts(g_a))
@@ -3348,7 +3349,7 @@
pnga_update1_ghosts(g_a);
}
- if(local_sync_end)pnga_sync();
+ if(local_sync_end)pnga_pgroup_sync(GA[handle].p_handle);
}
/* Utility function for ga_update6_ghosts routine */
diff -Naur ./src/tools/ga-5-1/global/src/global.npatch.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/global.npatch.c
--- ./src/tools/ga-5-1/global/src/global.npatch.c 2012-01-28 00:45:27.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/src/global.npatch.c 2012-06-25 20:41:34.000000000 +0200
@@ -2522,6 +2522,7 @@
B_created = 1;
if(andim > bndim) cndim = bndim;
if(andim < bndim) cndim = andim;
+ cndim = bndim;
pnga_copy_patch(¬rans, g_a, alo, ahi, g_c, clo, chi);
pnga_scale_patch(g_c, clo, chi, alpha);
/* determine subsets of my patches to access */
diff -Naur ./src/tools/ga-5-1/global/trace/adjust.c ../nwchem-6.1.1-src/src/tools/ga-5-1/global/trace/adjust.c
--- ./src/tools/ga-5-1/global/trace/adjust.c 2012-01-28 00:45:29.000000000 +0100
+++ ../nwchem-6.1.1-src/src/tools/ga-5-1/global/trace/adjust.c 2012-06-25 20:41:35.000000000 +0200
@@ -41,7 +41,7 @@
int proc=0, arrays=0, event_types=0;
-static int tcomp(unsigned long int *t1, unsigned long int *t2);
+static int tcomp(const void *t1, const void *t2);
int main(argc,argv)
int argc;
@@ -201,10 +201,11 @@
static int tcomp(t1, t2)
-unsigned long int *t1, *t2;
+const void *t1, *t2;
{
int flag;
- flag = (*t1 == *t2) ? 0 :(*t1 > *t2 ? 1 : -1);
+ flag = (*(unsigned long int*)t1 == *(unsigned long int*)t2) ? 0 :
+ (*(unsigned long int*)t1 > *(unsigned long int*)t2 ? 1 : -1);
return (flag);
}
More information about the Debichem-devel
mailing list