~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_gather.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_Gather (is a one-sided operation)                                                 
 
4
 * GA_Create -- used to create a global array using handles like 'g_A'                                   
 
5
 *
 
6
 * GA_gather -- used to get data from different location
 
7
 */
 
8
 
 
9
#include<stdio.h>
 
10
#include<stdlib.h>
 
11
 
 
12
#include"mpi.h"
 
13
#include"ga.h"
 
14
#include"macdecls.h"
 
15
#include"ga_unit.h"
 
16
 
 
17
#define N 5
 
18
#define D 2
 
19
 
 
20
main(int argc, char **argv)
 
21
{
 
22
  int rank, nprocs;
 
23
  int g_A, dims[D]={5,10}, local_A[N], local_G[N], sub_array[N][D], **s_array=NULL;
 
24
  int i, j, value=5;
 
25
  
 
26
  MPI_Init(&argc, &argv);
 
27
  GA_Initialize();
 
28
  MA_init(C_INT, 1000, 1000);
 
29
  
 
30
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 
31
  MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
 
32
 
 
33
  s_array=(int**)malloc(N*sizeof(int*));
 
34
  for(i=0; i<N; i++)
 
35
    {
 
36
      s_array[i]=(int*)malloc(D*sizeof(int));
 
37
      for(j=0; j<D; j++) s_array[i][j]=rand()%5;
 
38
    }
 
39
 
 
40
  for(i=0; i<N; i++)
 
41
    for(j=0; j<D; j++)sub_array[i][j]=rand()%5;
 
42
  /*
 
43
   * depends on the value of array ..we can generate the location values in randon 
 
44
   * we can also use the if-condition
 
45
   */
 
46
  
 
47
  for(i=0; i<N; i++)
 
48
    {
 
49
      for(j=0; j<D; j++)printf("%d ",s_array[i][j]);
 
50
      printf("\n");
 
51
    } 
 
52
 
 
53
  printf("\n");
 
54
  for(i=0; i<N; i++)
 
55
    {
 
56
      for(j=0; j<D; j++)printf("%d ",sub_array[i][j]);
 
57
      printf("\n");
 
58
    } 
 
59
  
 
60
  printf("\n");
 
61
  for(i=0; i<N; i++)printf("%d \n",local_A[i]=rand()%5+1);
 
62
  
 
63
  g_A=NGA_Create(C_INT, D, dims, "array_A", NULL);
 
64
  GA_Fill(g_A, &value);
 
65
  GA_Sync();
 
66
                                                   
 
67
  NGA_Scatter(g_A, local_A, s_array, N);
 
68
  NGA_Gather(g_A, local_G, s_array, N);
 
69
  GA_Sync();
 
70
  GA_Print(g_A);
 
71
 
 
72
  for(i=0; i<N; i++)printf("%d \n",local_G[i]);
 
73
  printf("\n");
 
74
 
 
75
  if(rank==0)
 
76
    {
 
77
      for(i=0; i<N; i++)
 
78
        if(local_G[i]!=local_A[i]) printf("Error : \n");
 
79
    }
 
80
  GA_Sync();
 
81
  if(rank==1)
 
82
    GA_PRINT_MSG();
 
83
 
 
84
  GA_Terminate();
 
85
  MPI_Finalize();
 
86
  return 0;
 
87
}