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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/testing/msgcheck.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_STDLIB_H
9
 
#   include <stdlib.h>
10
 
#endif
11
 
 
12
 
#include "armcip.h"
13
 
#include "message.h"
14
 
 
15
 
#define armci_msg_brdcst__ armci_msg_bcast_lapi
16
 
 
17
 
int me, nproc;
18
 
 
19
 
#define LOOP 20
20
 
 
21
 
void time_gop(double *test, int len)
22
 
{
23
 
  int i;
24
 
  double t;
25
 
 
26
 
  t = armci_timer();
27
 
  for (i = 0; i < LOOP; i++) {
28
 
    armci_msg_dgop(test, len, "+");
29
 
  }
30
 
  t = armci_timer() - t;
31
 
 
32
 
  t /= LOOP;
33
 
 
34
 
  if (me == 0) {
35
 
    printf("Time per gop %f len=%d doubles\n", t, len);
36
 
    fflush(stdout);
37
 
  }
38
 
}
39
 
 
40
 
 
41
 
void time_reduce(double *test, int len)
42
 
{
43
 
  int i;
44
 
  double t;
45
 
 
46
 
  t = armci_timer();
47
 
  for (i = 0; i < LOOP; i++) {
48
 
    armci_msg_reduce(test, len, "+", ARMCI_DOUBLE);
49
 
  }
50
 
  t = armci_timer() - t;
51
 
 
52
 
  t /= LOOP;
53
 
 
54
 
  if (me == 0) {
55
 
    printf("Time per reduce %f len=%d doubles\n", t, len);
56
 
    fflush(stdout);
57
 
  }
58
 
}
59
 
 
60
 
 
61
 
 
62
 
void TestGlobals()
63
 
{
64
 
#define MAXLENG 256*1024
65
 
  double *dtest;
66
 
  int *itest;
67
 
  long *ltest;
68
 
  int len;
69
 
  int ifrom = nproc - 1, lfrom = 1, dfrom = 1;
70
 
 
71
 
  if (me == 0) {
72
 
    printf("Global test ... broadcast and reduction for int, long, double\n----------\n");
73
 
    fflush(stdout);
74
 
  }
75
 
 
76
 
  if (!(dtest = (double *) malloc((unsigned)(MAXLENG * sizeof(double))))) {
77
 
    ARMCI_Error("TestGlobals: failed to allocated dtest", MAXLENG);
78
 
  }
79
 
  if (!(ltest = (long *) malloc((unsigned)(MAXLENG * sizeof(long))))) {
80
 
    ARMCI_Error("TestGlobals: failed to allocated ltest", MAXLENG);
81
 
  }
82
 
  if (!(itest = (int *) malloc((unsigned)(MAXLENG * sizeof(int))))) {
83
 
    ARMCI_Error("TestGlobals: failed to allocated itest", MAXLENG);
84
 
  }
85
 
 
86
 
  for (len = 1; len < MAXLENG; len *= 2) {
87
 
    int ilen = len * sizeof(int);
88
 
    int dlen = len * sizeof(double);
89
 
    int llen = len * sizeof(long);
90
 
    int i;
91
 
 
92
 
    ifrom = (ifrom + 1) % nproc;
93
 
    lfrom = (lfrom + 1) % nproc;
94
 
    dfrom = (lfrom + 1) % nproc;
95
 
 
96
 
#if 0
97
 
    printf("%d:ifrom=%d lfrom=%d dfrom=%d\n", me, ifrom, lfrom, dfrom);
98
 
    fflush(stdout);
99
 
#endif
100
 
 
101
 
    if (me == 0) {
102
 
      printf("Test length = %d ... ", len);
103
 
      fflush(stdout);
104
 
    }
105
 
 
106
 
    if (me == ifrom)for (i = 0; i < len; i++) {
107
 
        itest[i] = i;
108
 
      }
109
 
    else for (i = 0; i < len; i++) {
110
 
        itest[i] = 0;
111
 
      }
112
 
    if (me == lfrom)for (i = 0; i < len; i++) {
113
 
        ltest[i] = (long)i;
114
 
      }
115
 
    else for (i = 0; i < len; i++) {
116
 
        ltest[i] = 0L;
117
 
      }
118
 
    if (me == dfrom)for (i = 0; i < len; i++) {
119
 
        dtest[i] = (double)i;
120
 
      }
121
 
    else for (i = 0; i < len; i++) {
122
 
        dtest[i] = 0.0;
123
 
      }
124
 
 
125
 
    /* Test broadcast */
126
 
    armci_msg_brdcst(itest, ilen, ifrom);
127
 
    armci_msg_brdcst(ltest, llen, lfrom);
128
 
    armci_msg_brdcst(dtest, dlen, dfrom);
129
 
 
130
 
    for (i = 0; i < len; i++) {
131
 
      if (itest[i] != i) {
132
 
        armci_die2("int broadcast failed", i, itest[i]);
133
 
      }
134
 
      if (ltest[i] != (long)i) {
135
 
        armci_die2("long broadcast failed", i, (int)ltest[i]);
136
 
      }
137
 
      if (dtest[i] != (double)i) {
138
 
        armci_die2("double broadcast failed", i, (int)dtest[i]);
139
 
      }
140
 
    }
141
 
 
142
 
    if (me == 0) {
143
 
      printf("broadcast OK ...");
144
 
      fflush(stdout);
145
 
    }
146
 
 
147
 
    /* Test global sum */
148
 
    for (i = 0; i < len; i++) {
149
 
      itest[i] = i * me;
150
 
      ltest[i] = (long) itest[i];
151
 
      dtest[i] = (double) itest[i];
152
 
    }
153
 
 
154
 
 
155
 
    armci_msg_igop(itest, len, "+");
156
 
    armci_msg_lgop(ltest, len, "+");
157
 
    armci_msg_dgop(dtest, len, "+");
158
 
 
159
 
 
160
 
    for (i = 0; i < len; i++) {
161
 
      int iresult = i * nproc * (nproc - 1) / 2;
162
 
      if (itest[i] != iresult || ltest[i] != (long)iresult ||
163
 
          dtest[i] != (double) iresult) {
164
 
        ARMCI_Error("TestGlobals: global sum failed", (int) i);
165
 
      }
166
 
    }
167
 
 
168
 
 
169
 
    if (me == 0) {
170
 
      printf("global sums OK\n");
171
 
      fflush(stdout);
172
 
    }
173
 
  }
174
 
 
175
 
 
176
 
  /* now we get timing data */
177
 
  time_gop(dtest, MAXLENG);
178
 
  time_reduce(dtest, MAXLENG);
179
 
 
180
 
  free((char *) itest);
181
 
  free((char *) ltest);
182
 
  free((char *) dtest);
183
 
}
184
 
 
185
 
 
186
 
int main(int argc, char **argv)
187
 
{
188
 
 
189
 
  /* initialize ARMCI */
190
 
  ARMCI_Init_args(&argc, &argv);
191
 
  me = armci_msg_me();
192
 
  nproc = armci_msg_nproc();
193
 
 
194
 
  if (nproc < 2) {
195
 
    if (me == 0)
196
 
      fprintf(stderr,
197
 
              "USAGE: 2 <= processes < %d\n", nproc);
198
 
    ARMCI_Barrier();
199
 
    armci_msg_finalize();
200
 
    exit(0);
201
 
  }
202
 
 
203
 
  if (me == 0) {
204
 
    printf("Test of ARMCI Wrappers to Basic Message Passing Operations\n");
205
 
    fflush(stdout);
206
 
  }
207
 
 
208
 
 
209
 
  ARMCI_Barrier();
210
 
 
211
 
  TestGlobals();
212
 
 
213
 
  /* done */
214
 
  ARMCI_Finalize();
215
 
  armci_msg_finalize();
216
 
  return(0);
217
 
}
218
 
 
219