~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_elem_multiplypatch.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_Elem_multiply_patch (is a collective operation)
 
4
 * GA_Create -- used to create a global array using handles like 'g_A' 
 
5
 * GA_Elem_multiply -- used to multiply two array and store it in one
 
6
 * Here _elem_multiply patch -- help to does the same function of_elem_multiply ...to an specified patch in array 
 
7
 */
 
8
 
 
9
#include<stdio.h>
 
10
 
 
11
#include"mpi.h"
 
12
#include"ga.h"
 
13
#include"macdecls.h"
 
14
 
 
15
#define DIM 2
 
16
 
 
17
main(int argc, char **argv)
 
18
{
 
19
  int rank, nprocs, i, j;
 
20
  int g_A, g_B, g_C, local_C[DIM][DIM]; 
 
21
  int dims[DIM]={5,5}, dims2[DIM], ndim, type;
 
22
  int val_A=5, val_B=3, ld=DIM; 
 
23
  int lo[DIM]={2,2}, hi[DIM]={4,4}, blo[DIM]={0,0}, bhi[DIM]={2,2}, clo[DIM]={1,1}, chi[DIM]={3,3};
 
24
 
 
25
  MPI_Init(&argc, &argv);
 
26
 
 
27
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 
28
  MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
 
29
 
 
30
  MA_init(C_INT, 1000, 1000);
 
31
 
 
32
  GA_Initialize();
 
33
  
 
34
  g_A = NGA_Create(C_INT, DIM, dims, "array_A", NULL);
 
35
  g_B = NGA_Create(C_INT, DIM, dims, "array_B", NULL);
 
36
  g_C = NGA_Create(C_INT, DIM, dims, "array_C", NULL);
 
37
 
 
38
  GA_Fill(g_A, &val_A);
 
39
  GA_Fill(g_B, &val_B);
 
40
  GA_Zero(g_C);
 
41
  GA_Elem_multiply_patch(g_A, lo, hi, g_B, blo, bhi, g_C, clo, chi);
 
42
  GA_Print(g_C);
 
43
  GA_Sync();
 
44
  
 
45
 
 
46
  NGA_Get(g_C, clo, chi, local_C, &ld);
 
47
  if(rank==1)
 
48
    {
 
49
  
 
50
      for(i=0; i<DIM; i++)
 
51
        {
 
52
          for(j=0; j<DIM; j++)printf("%d ", local_C[i][j]);
 
53
          printf("\n");
 
54
        }
 
55
      
 
56
      for(i=0; i<DIM; i++)
 
57
        {
 
58
          for(j=0; j<DIM; j++)
 
59
            if(local_C[i][j]!=val_A*val_B) printf("GA Error : \n");
 
60
        }
 
61
      
 
62
    }
 
63
    
 
64
  GA_Sync();
 
65
  if(rank == 0)
 
66
    printf("Test Completed \n");
 
67
 
 
68
  GA_Terminate();
 
69
  MPI_Finalize();
 
70
 
 
71
}