~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/tools/ga-4-3/cca/ga_cca_classic/overload.cxx

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "gacca.h"
 
2
 
 
3
#ifdef FALSE
 
4
#undef FALSE
 
5
#endif
 
6
#ifdef TRUE
 
7
#undef TRUE
 
8
#endif
 
9
#define FALSE 0
 
10
#define TRUE  1
 
11
 
 
12
/**
 
13
 * More operator overloading stuff (a lot!!) to come.
 
14
 */
 
15
 
 
16
GA::GlobalArray&
 
17
GA::GlobalArray::operator=(const GA::GlobalArray &g_a) {
 
18
 
 
19
  if(this != &g_a) { 
 
20
    GA_Destroy(mHandle);
 
21
    
 
22
    mHandle = GA_Duplicate(g_a.mHandle, g_a.inquireName());
 
23
    if(!mHandle)  GA_Error((char *)" GA creation failed",0);
 
24
    
 
25
    GA_Copy(g_a.mHandle, mHandle); 
 
26
  }
 
27
  return *this;
 
28
}
 
29
 
 
30
int
 
31
GA::GlobalArray::operator==(const GA::GlobalArray &g_a) const {
 
32
 
 
33
  long isEqual = TRUE;
 
34
  
 
35
  int i, type1, type2, ndim1, ndim2, dims1[GA_MAX_DIM], dims2[GA_MAX_DIM];
 
36
  int alo[GA_MAX_DIM], ahi[GA_MAX_DIM], blo[GA_MAX_DIM], bhi[GA_MAX_DIM];
 
37
 
 
38
  NGA_Inquire(mHandle, &type1, &ndim1, dims1);
 
39
  NGA_Inquire(g_a.mHandle, &type2, &ndim2, dims2);
 
40
  if(type1 != type2) isEqual = FALSE; // check type
 
41
  if(GA_Compare_distr(mHandle, g_a.mHandle)) isEqual = FALSE; 
 
42
  NGA_Distribution(mHandle, GA_Nodeid(), alo, ahi);
 
43
  NGA_Distribution(g_a.mHandle, GA_Nodeid(), blo, bhi);
 
44
  if(ahi[0] != bhi[0]) isEqual = FALSE; // check process owns data?
 
45
  
 
46
  if(ahi[0] >= 0) { // true => process owns data 
 
47
    void *ptr1 = NULL, *ptr2 = NULL;
 
48
    int ld1[GA_MAX_DIM];
 
49
    int ld2[GA_MAX_DIM];
 
50
    int num = 0;
 
51
 
 
52
    NGA_Access(mHandle, alo, ahi, &ptr1, ld1);
 
53
    NGA_Access(g_a.mHandle, blo, bhi, &ptr2, ld2);
 
54
 
 
55
    // number of elements I own.
 
56
    for(i=0; i<ndim1; i++) num += ahi[i] - alo[i] + 1;
 
57
    
 
58
    for(i=0; i<num; i++)
 
59
      switch (type1) {
 
60
      case C_INT:
 
61
        if(((int *)ptr1)[i] != ((int *)ptr2)[i]) isEqual = FALSE;
 
62
        break;
 
63
      case C_LONG:
 
64
        if(((long *)ptr1)[i] != ((long *)ptr2)[i]) isEqual = FALSE;
 
65
        break;
 
66
      case C_FLOAT:
 
67
        if(((float *)ptr1)[i] != ((float *)ptr2)[i]) isEqual = FALSE;
 
68
        break;
 
69
      case C_DBL:
 
70
        if(((double *)ptr1)[i] != ((double *)ptr2)[i]) isEqual = FALSE;
 
71
        break;
 
72
      case C_DCPL: 
 
73
        if(((DoubleComplex *)ptr1)[i].real !=
 
74
           ((DoubleComplex *)ptr2)[i].real) isEqual = FALSE;
 
75
        if(((DoubleComplex *)ptr1)[i].imag !=
 
76
           ((DoubleComplex *)ptr2)[i].imag) isEqual = FALSE;
 
77
      }
 
78
    NGA_Release(mHandle, alo, ahi);
 
79
    NGA_Release(g_a.mHandle, blo, bhi);
 
80
  }
 
81
  
 
82
  GA_Lgop(&isEqual, 1, (char *)"*");
 
83
  if(isEqual == TRUE) return TRUE;
 
84
  else return FALSE;
 
85
}
 
86
 
 
87
int
 
88
GA::GlobalArray::operator!=(const GA::GlobalArray &g_a) const {
 
89
  if(*this == g_a) return FALSE;
 
90
  return TRUE;
 
91
}