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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src/devices/dcmf/dcmf-0.3.0/armcix_fence.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
 
/* begin_generated_IBM_copyright_prolog                             */
5
 
/*                                                                  */
6
 
/* ---------------------------------------------------------------- */
7
 
/* (C)Copyright IBM Corp.  2007, 2008                               */
8
 
/* IBM BSD License                                                  */
9
 
/* ---------------------------------------------------------------- */
10
 
/*                                                                  */
11
 
/* end_generated_IBM_copyright_prolog                               */
12
 
/**
13
 
 * \file armci/src/armcix/dcmf/armcix_fence.c
14
 
 * \brief DCMF ARMCI Extension for fence operations.
15
 
 */
16
 
 
17
 
#include "armcix_impl.h"
18
 
#include <stdio.h>
19
 
 
20
 
DCMF_Protocol_t __fence_rts_protocol;
21
 
DCMF_Protocol_t __fence_ack_protocol;
22
 
 
23
 
/**
24
 
 * \brief DCMF ARMCI Extention receive short fence request callback
25
 
 *
26
 
 * \see ARMCIX_Fence
27
 
 * \see ARMCIX_AllFence
28
 
 * \see ARMCIX_DCMF_ReceiveFenceAck
29
 
 * \see DCMF_RecvSendShort
30
 
 */
31
 
void ARMCIX_DCMF_ReceiveFenceRequest (void           * clientdata,
32
 
                                      const DCQuad   * msginfo,
33
 
                                      unsigned         count,
34
 
                                      unsigned         peer,
35
 
                                      const char     * src,
36
 
                                      unsigned         bytes)
37
 
{
38
 
  DCMF_Callback_t * cb = (DCMF_Callback_t *) msginfo;
39
 
  DCMF_Control_t info;
40
 
  DCMF_Callback_t * ack = (DCMF_Callback_t *) &info;
41
 
  *ack = *cb;
42
 
 
43
 
  DCMF_Control (&__fence_ack_protocol,
44
 
                DCMF_SEQUENTIAL_CONSISTENCY,
45
 
                peer,
46
 
                &info);
47
 
}
48
 
 
49
 
/**
50
 
 * \brief Receive a fence control message.
51
 
 *
52
 
 * The fence message type is either a fence \e request or a fence \e ack.
53
 
 *
54
 
 * \param[in] clientdata Registered clientdata, the armci connection array
55
 
 * \param[in] info       Fence control information
56
 
 * \param[in] peer       Rank of the node that sent this control message
57
 
 *
58
 
 * \see ARMCIX_Fence
59
 
 * \see ARMCIX_AllFence
60
 
 * \see ARMCIX_DCMF_ReceiveFenceRequest
61
 
 * \see DCMF_RecvControl
62
 
 */
63
 
void ARMCIX_DCMF_ReceiveFenceAck (void                 * clientdata,
64
 
                                  const DCMF_Control_t * info,
65
 
                                  unsigned               peer)
66
 
{
67
 
  DCMF_Callback_t * cb = (DCMF_Callback_t *) info;
68
 
  if (cb->function)
69
 
    cb->function(cb->clientdata, NULL);
70
 
}
71
 
 
72
 
 
73
 
/**
74
 
 * \brief Register the DCMF ARMCI Extention fence operation.
75
 
 *
76
 
 * \param[in]  connection_array Connection array
77
 
 *
78
 
 * \see DCMF_Control_register
79
 
 */
80
 
void ARMCIX_DCMF_Fence_register (ARMCIX_DCMF_Connection_t * connection_array)
81
 
{
82
 
  DCMF_CriticalSection_enter (0);
83
 
 
84
 
  DCMF_Send_Configuration_t send_configuration = {
85
 
    DCMF_DEFAULT_SEND_PROTOCOL,
86
 
    DCMF_DEFAULT_NETWORK,
87
 
    ARMCIX_DCMF_ReceiveFenceRequest,
88
 
    connection_array,
89
 
    NULL,
90
 
    NULL
91
 
  };
92
 
  DCMF_Send_register (&__fence_rts_protocol, &send_configuration);
93
 
 
94
 
  DCMF_Control_Configuration_t configuration = {
95
 
    DCMF_DEFAULT_CONTROL_PROTOCOL,
96
 
    DCMF_DEFAULT_NETWORK,
97
 
    ARMCIX_DCMF_ReceiveFenceAck,
98
 
    connection_array
99
 
  };
100
 
  DCMF_Control_register (&__fence_ack_protocol, &configuration);
101
 
 
102
 
  DCMF_CriticalSection_exit (0);
103
 
}
104
 
 
105
 
 
106
 
/**
107
 
 * \brief Point-to-point fence operation.
108
 
 *
109
 
 * Blocks until all active messages between the local node and the remote
110
 
 * node have completed and acknowledged by the remote node.
111
 
 *
112
 
 * \param[in] proc       Rank of the remote node to fence
113
 
 *
114
 
 * \see ARMCIX_AllFence
115
 
 * \see ARMCIX_DCMF_ReceiveFenceRequest
116
 
 * \see ARMCIX_DCMF_ReceiveFenceAck
117
 
 */
118
 
void ARMCIX_Fence (int proc)
119
 
{
120
 
  DCMF_CriticalSection_enter (0);
121
 
 
122
 
  DCMF_Request_t request;
123
 
  volatile unsigned active = 1;
124
 
  DCQuad quad;
125
 
  DCMF_Callback_t * cb = (DCMF_Callback_t *) &quad;
126
 
  cb->function   = ARMCIX_DCMF_cb_decrement;
127
 
  cb->clientdata = (void *) &active;
128
 
  DCMF_Send ( &__fence_rts_protocol,
129
 
              &request,
130
 
              (DCMF_Callback_t) { NULL, NULL },
131
 
              DCMF_SEQUENTIAL_CONSISTENCY,
132
 
              proc,
133
 
              0,
134
 
              NULL,
135
 
              (DCQuad *) &quad,
136
 
              1);
137
 
 
138
 
  while (active) DCMF_Messager_advance ();
139
 
 
140
 
  DCMF_CriticalSection_exit (0);
141
 
}
142
 
 
143
 
/**
144
 
 * \brief Global fence operation.
145
 
 *
146
 
 * Blocks until all active messages between the local node and all remote
147
 
 * nodes have completed and acknowledged by the remote node.
148
 
 *
149
 
 * \see ARMCIX_Fence
150
 
 * \see ARMCIX_DCMF_ReceiveFenceRequest
151
 
 * \see ARMCIX_DCMF_ReceiveFenceAck
152
 
 */
153
 
void ARMCIX_AllFence ()
154
 
{
155
 
  DCMF_CriticalSection_enter (0);
156
 
 
157
 
  unsigned size = DCMF_Messager_size ();
158
 
  unsigned peer;
159
 
 
160
 
  volatile unsigned active = 0;
161
 
  DCQuad quad;
162
 
  DCMF_Callback_t * cb = (DCMF_Callback_t *) &quad;
163
 
  cb->function   = ARMCIX_DCMF_cb_decrement;
164
 
  cb->clientdata = (void *) &active;
165
 
 
166
 
  DCMF_Callback_t cb_null = { NULL, NULL };
167
 
  DCMF_Callback_t cb_done = { (void (*)(void *, DCMF_Error_t *))ARMCIX_DCMF_request_free, NULL };
168
 
  for (peer = 0; peer < size; peer++)
169
 
  {
170
 
    ARMCIX_DCMF_Request_t * new_request = ARMCIX_DCMF_request_allocate (cb_null);
171
 
    cb_done.clientdata = new_request;
172
 
 
173
 
    active++;
174
 
    DCMF_Send ( &__fence_rts_protocol,
175
 
                &(new_request->request),
176
 
                cb_done,
177
 
                DCMF_SEQUENTIAL_CONSISTENCY,
178
 
                peer,
179
 
                0,
180
 
                NULL,
181
 
                (DCQuad *) &quad,
182
 
                1);
183
 
 
184
 
    while (active) DCMF_Messager_advance ();
185
 
  }
186
 
 
187
 
  DCMF_CriticalSection_exit (0);
188
 
}
189
 
 
190
 
void ARMCIX_Barrier ()
191
 
{
192
 
#warning implement ARMCIX_Barrier ?
193
 
assert (0);
194
 
}