~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/tools/ga-5-2/global/testing/unit-tests/ga_create.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
/*
 
2
 * Test Program for GA
 
3
 * This is to test GA_Create (is a collective operation)
 
4
 * GA_Create -- used to create a global array using handles like 'g_A' 
 
5
 * Here used GA_Inquire to verify that g_A hanle returns the right values of created_array
 
6
 */
 
7
 
 
8
#include<stdio.h>
 
9
 
 
10
#include"mpi.h"
 
11
#include"ga.h"
 
12
#include"macdecls.h"
 
13
 
 
14
#define GSIZE 5
 
15
 
 
16
one_dimension(int rank, int nprocs)
 
17
{
 
18
  int g_V; 
 
19
  int ndim=1, dims=GSIZE;
 
20
  int dims2, ndim2, type, value=5;
 
21
 
 
22
  g_V = NGA_Create(C_INT, ndim, &dims, "array_V", NULL);
 
23
 
 
24
  GA_Fill(g_V, &value);
 
25
  GA_Print(g_V);
 
26
  GA_Sync();
 
27
 
 
28
  //  NGA_Inquire(g_V, &type, &ndim2, dims2);
 
29
  //printf(" %d -- %d,,\n", type, ndim2);
 
30
 
 
31
  //for(i=0; i<DIM; i++)
 
32
  //printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);   
 
33
  GA_Destroy(g_V);                                                                                                              
 
34
}                       
 
35
                                
 
36
two_dimension(int rank, int nprocs)                     
 
37
{                                                       
 
38
  int g_A;                                              
 
39
  int ndim=2, dims[2]={GSIZE,GSIZE};                    
 
40
  int dims2[ndim], ndim2, type, value=5, i;     
 
41
                                                        
 
42
  g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL); 
 
43
                                                        
 
44
  GA_Fill(g_A, &value);                                 
 
45
  GA_Print(g_A);                                        
 
46
  GA_Sync();                                            
 
47
                                                        
 
48
  NGA_Inquire(g_A, &type, &ndim2, dims2);               
 
49
  printf(" %d -- %d,,\n", type, ndim2);                 
 
50
                                                        
 
51
  for(i=0; i<ndim; i++)                                 
 
52
    printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);   
 
53
  GA_Destroy(g_A);                                                      
 
54
}                                                       
 
55
 
 
56
three_dimension(int rank, int nprocs)                   
 
57
{                                                       
 
58
  int g_A;                                              
 
59
  int ndim=3, dims[3]={GSIZE,GSIZE,GSIZE};                      
 
60
  int dims2[ndim], ndim2, type, value=5, i;     
 
61
                                                        
 
62
  g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL); 
 
63
                                                        
 
64
  GA_Fill(g_A, &value);                                 
 
65
  GA_Print(g_A);                                        
 
66
  GA_Sync();                                            
 
67
                                                        
 
68
  NGA_Inquire(g_A, &type, &ndim2, dims2);               
 
69
  printf(" %d -- %d,,\n", type, ndim2);                 
 
70
                                                        
 
71
  for(i=0; i<ndim; i++)                                 
 
72
    printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);   
 
73
  GA_Destroy(g_A);                                                      
 
74
}                                                       
 
75
 
 
76
fourth_dimension(int rank, int nprocs)                  
 
77
{                                                       
 
78
  int g_A;                                              
 
79
  int ndim=4, dims[4]={GSIZE,GSIZE,GSIZE,GSIZE};                        
 
80
  int dims2[ndim], ndim2, type, value=5, i;     
 
81
                                                        
 
82
  g_A = NGA_Create(C_INT, ndim, dims, "array_A", NULL); 
 
83
                                                        
 
84
  GA_Fill(g_A, &value);                                 
 
85
  GA_Print(g_A);                                        
 
86
  GA_Sync();                                            
 
87
                                                        
 
88
  NGA_Inquire(g_A, &type, &ndim2, dims2);               
 
89
  printf(" %d -- %d,,\n", type, ndim2);                 
 
90
                                                        
 
91
  for(i=0; i<ndim; i++)                                 
 
92
    printf("%d: %d[ %d] ...* \n", rank, i, dims2[i]);   
 
93
  GA_Destroy(g_A);                                                      
 
94
}                                                       
 
95
 
 
96
                                                
 
97
main(int argc, char **argv)                             
 
98
{                                                       
 
99
  int rank, nprocs, i;                                  
 
100
 
 
101
  MPI_Init(&argc, &argv);                               
 
102
                                                        
 
103
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);                 
 
104
  MPI_Comm_size(MPI_COMM_WORLD, &nprocs);               
 
105
                                                        
 
106
  MA_init(C_INT, 1000, 1000);                           
 
107
                                                        
 
108
  GA_Initialize();                                      
 
109
        
 
110
  if(rank==1)  printf(" ONE DIMENSION\n");                                              
 
111
  one_dimension(rank, nprocs);
 
112
  GA_Sync();
 
113
  if(rank==1)  printf(" TWO DIMENSION\n");                                              
 
114
  two_dimension(rank, nprocs);
 
115
  GA_Sync();
 
116
  if(rank==1)  printf(" THREE DIMENSION\n");                                            
 
117
  three_dimension(rank, nprocs);
 
118
 
 
119
  //  fourth_dimension(rank, nprocs);
 
120
  GA_Sync();
 
121
  if(rank == 0)
 
122
    printf("Test Completed \n");
 
123
  GA_Terminate();
 
124
  MPI_Finalize();
 
125
  
 
126
}