~ubuntu-branches/ubuntu/utopic/nwchem/utopic

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/global/testing/getmem.c

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

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if HAVE_CONFIG_H
2
 
#   include "config.h"
3
 
#endif
4
 
 
5
 
#if HAVE_STDIO_H
6
 
#   include <stdio.h>
7
 
#endif
8
 
#if HAVE_MATH_H
9
 
#   include <math.h>
10
 
#endif
11
 
 
12
 
#include "ga.h"
13
 
#include "macdecls.h"
14
 
#include "mp3.h"
15
 
 
16
 
#define N 4            /* dimension of matrices */
17
 
 
18
 
 
19
 
int main( int argc, char **argv ) {
20
 
  int g_a, g_b,i;
21
 
  int n=N, type=MT_F_DBL;
22
 
  int dims[6]={N,N,N,N,N,N};
23
 
  int lo[6], hi[6];
24
 
 
25
 
  int heap=30000, stack=20000;
26
 
  int me, nproc;
27
 
 
28
 
  int datatype, elements;
29
 
  double *prealloc_mem;
30
 
 
31
 
  MP_INIT(argc,argv);
32
 
 
33
 
  GA_INIT(argc,argv);                            /* initialize GA */
34
 
  me=GA_Nodeid(); 
35
 
  nproc=GA_Nnodes();
36
 
  if(me==0) {
37
 
    if(GA_Uses_fapi())GA_Error("Program runs with C array API only",1);
38
 
    printf("Using %ld processes\n",(long)nproc);
39
 
    fflush(stdout);
40
 
  }
41
 
 
42
 
  heap /= nproc;
43
 
  stack /= nproc;
44
 
  if(! MA_init(MT_F_DBL, stack, heap)) 
45
 
    GA_Error("MA_init failed",stack+heap);  /* initialize memory allocator*/ 
46
 
 
47
 
 
48
 
  /* This is a regular matrix. */
49
 
  if(me==0)printf("Creating matrix A\n");
50
 
  g_a = NGA_Create(type, 2, dims, "A", NULL);
51
 
  if(!g_a) GA_Error("create failed: A",n); 
52
 
  if(me==0)printf("OK\n");
53
 
  NGA_Distribution( g_a, me, lo, hi );
54
 
 
55
 
#if 1
56
 
  /* This is just allocating and freeing memory. */
57
 
  datatype = type;
58
 
  elements = 1;
59
 
  for ( i=0; i<2; i++ ) {
60
 
    elements *= (hi[i] - lo[i] + 1);
61
 
  }
62
 
  prealloc_mem = GA_Getmem(datatype, elements, 0);
63
 
  for ( i=0; i<elements; i++ ) prealloc_mem[i] = 3.141592654;
64
 
  GA_Freemem(prealloc_mem);
65
 
  if(me==0){printf("getmem&freemem OK\n"); fflush(stdout); }
66
 
#endif
67
 
 
68
 
  /* This is a matrix using preallocated memory. */
69
 
  datatype = type;
70
 
  elements = 1;
71
 
  for ( i=0; i<2; i++ ) {
72
 
    elements *= (hi[i] - lo[i] + 1);
73
 
  }
74
 
  prealloc_mem = GA_Getmem(datatype, elements, 0);
75
 
  g_b = GA_Assemble_duplicate(g_a, "Matrix B", (void*)prealloc_mem );
76
 
  if(GA_Compare_distr(g_a,g_b)){ 
77
 
     if(me==0){printf("GA_Assemble_duplicate failed\n"); fflush(stdout); }
78
 
  }else{
79
 
     if(me==0){printf("GA_Assemble_duplicate OK\n"); fflush(stdout); }
80
 
  }
81
 
  GA_Destroy(g_b);
82
 
 
83
 
  GA_Destroy(g_a);
84
 
  if(me==0)printf("\nSuccess\n");
85
 
  GA_Terminate();
86
 
 
87
 
  MP_FINALIZE();
88
 
 
89
 
 return 0;
90
 
}
91