~ubuntu-branches/ubuntu/utopic/nwchem/utopic

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src/include/request.h

  • 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
 
#ifndef _REQUEST_H_
2
 
#define _REQUEST_H_
3
 
 
4
 
 
5
 
/********  client buffer managment ops ****************************/
6
 
extern void  _armci_buf_init();
7
 
extern char* _armci_buf_get(int size, int operation, int to);
8
 
extern void  _armci_buf_release(void *buf);
9
 
extern int   _armci_buf_to_index(void *buf);
10
 
extern char* _armci_buf_ptr_from_id(int id);
11
 
extern void  _armci_buf_ensure_one_outstanding_op_per_node(void *buf, int node);
12
 
#if defined(PEND_BUFS)
13
 
extern void  _armci_buf_ensure_pend_outstanding_op_per_node(void *buf, int node);
14
 
#endif
15
 
extern void _armci_buf_complete_nb_request(int bufid,unsigned int tag, int *retcode);
16
 
extern void _armci_buf_test_nb_request(int bufid,unsigned int tag, int *retcode);
17
 
extern void _armci_buf_set_tag(void *bufptr,unsigned int tag,short int protocol);
18
 
extern void _armci_buf_clear_all();
19
 
 
20
 
extern INLINE char *_armci_buf_get_clear_busy(int size, int operation, int to);
21
 
extern INLINE void _armci_buf_set_busy(void *buf, int state);
22
 
extern INLINE void _armci_buf_set_busy_idx(int tbl_idx, int state);
23
 
extern INLINE int  _armci_buf_cmpld(int bufid);
24
 
extern INLINE void _armci_buf_set_cmpld(void *buf, int state);
25
 
extern INLINE void _armci_buf_set_cmpld_idx(int idx, int state);
26
 
 
27
 
#ifdef LAPI
28
 
#  include "lapidefs.h"
29
 
#elif PORTALS
30
 
#  include "armci_portals.h"
31
 
   typedef long msg_tag_t;
32
 
#elif defined(GM)
33
 
#  include "myrinet.h"
34
 
#elif defined(DOELAN4)
35
 
#  include "elandefs.h"
36
 
#elif defined(QUADRICS)
37
 
#  include <elan/elan.h>
38
 
   typedef void* msg_tag_t; 
39
 
#  ifdef _ELAN_PUTGET_H
40
 
#    define NB_CMPL_T ELAN_EVENT*
41
 
#  endif
42
 
#elif defined(VIA)
43
 
#  include "via.h"
44
 
   typedef void* msg_tag_t;
45
 
#elif defined(VAPI)
46
 
#  include "armci-vapi.h"
47
 
#elif defined(SOCKETS)
48
 
#  include "sockets.h"
49
 
   typedef long msg_tag_t;
50
 
   typedef unsigned short msg_id_t;
51
 
#   define DTAG_ ((1<<(sizeof(msg_id_t)*8))-1)
52
 
#   define NB_SOCKETS_ /* define NB_SOCKETS to allow non-blocking path */
53
 
#elif defined(HITACHI)
54
 
#  include "sr8k.h"
55
 
#elif defined(BGML)
56
 
#  include "bgml.h"
57
 
#  include "bgmldefs.h"
58
 
#  define NB_CMPL_T BG1S_t  
59
 
    typedef long msg_tag_t;
60
 
#elif defined(ARMCIX)
61
 
#  ifndef ARMCIX_OPAQUE_SIZE
62
 
#    define ARMCIX_OPAQUE_SIZE 8
63
 
#  endif
64
 
   typedef char armcix_opaque_t [ARMCIX_OPAQUE_SIZE];
65
 
#  define NB_CMPL_T armcix_opaque_t
66
 
   typedef long msg_tag_t;
67
 
#elif defined(MPI_SPAWN) || defined(MPI_MT)
68
 
#  include "mpi2.h"
69
 
   typedef long msg_tag_t;
70
 
#else
71
 
   typedef long msg_tag_t;
72
 
#endif
73
 
 
74
 
#ifdef OPENIB
75
 
#  include "pendbufs.h"
76
 
#endif
77
 
 
78
 
#ifndef CLEAR_HNDL_FIELD 
79
 
#   define CLEAR_HNDL_FIELD(_x) 
80
 
#endif
81
 
 
82
 
#define ACK_QUIT 0
83
 
#define QUIT 33
84
 
#define ATTACH 34
85
 
#define REGISTER 35
86
 
   
87
 
/*\ the internal request structure for non-blocking api. 
88
 
\*/
89
 
typedef struct{
90
 
   unsigned int tag;
91
 
   short int bufid;
92
 
   short int agg_flag;
93
 
   int op;
94
 
   int proc;
95
 
#ifdef PORTALS
96
 
   int flag;
97
 
#endif
98
 
#ifdef NB_CMPL_T
99
 
   NB_CMPL_T cmpl_info;
100
 
#endif
101
 
#ifdef BGML
102
 
   unsigned count;
103
 
#endif
104
 
} armci_ireq_t;
105
 
/*\ the internal request structure for non-blocking api. 
106
 
\*/
107
 
typedef armci_ireq_t* armci_ihdl_t;
108
 
extern void armci_set_nbhandle_bufid(armci_ihdl_t nb_handle, char *buf, int val);
109
 
extern void set_nbhandle(armci_ihdl_t *nbh, armci_hdl_t *nb_handle,
110
 
                                int op, int proc);
111
 
 
112
 
typedef struct {
113
 
#if 0 
114
 
   int   to:16;               /* message recipient */
115
 
   int from:16;               /* message sender */
116
 
#else
117
 
   short int   to;            /* message recipient */
118
 
   short int from;            /* message sender */
119
 
#endif
120
 
unsigned int   operation:8;   /* operation code */
121
 
#if defined(DOELAN4) 
122
 
unsigned int   format:2;      /* data format used */
123
 
unsigned int   dowait:1;      /* indicates if should wait for data  */
124
 
unsigned int   inbuf:1;       /* data is in one of the buffers */
125
 
#elif defined(CLIENT_BUF_BYPASS) || defined(LAPI2)
126
 
unsigned int   format:2;      /* data format used */
127
 
unsigned int   pinned:1;      /* indicates if sender memory was pinned */
128
 
unsigned int   bypass:1;      /* indicate if bypass protocol used */
129
 
#else
130
 
unsigned int   format:4;      /* data format used */
131
 
#endif
132
 
unsigned int   bytes:20;      /* number of bytes requested */
133
 
         int   datalen;       /* >0 in lapi means that data is included */
134
 
unsigned int   ehlen:8;       /* size of extra header and the end of descr */
135
 
  signed int   dscrlen:24;    /* >0 in lapi means that descriptor is included */
136
 
         msg_tag_t tag;       /* message tag for response to this request, MUST BE LAST */
137
 
}request_header_t;
138
 
 
139
 
/*******gpc call strctures*************/
140
 
#if HAVE_SIGNAL_H
141
 
#   include <signal.h>
142
 
#endif
143
 
#define MAX_GPC_REQ 1
144
 
#define MAX_GPC_REPLY_LEN (64*1024)
145
 
#define MAX_GPC_SEND_LEN (64*1024)
146
 
#define GPC_COMPLETION_SIGNAL SIGUSR1
147
 
 
148
 
typedef struct {
149
 
  int hndl;
150
 
  int hlen, dlen;
151
 
  void *hdr, *data;
152
 
  int rhlen, rdlen;
153
 
  void *rhdr, *rdata;
154
 
} gpc_call_t;
155
 
 
156
 
typedef struct {
157
 
  int active;
158
 
/*    int zombie; */
159
 
  request_header_t  msginfo;
160
 
  gpc_call_t call;
161
 
  char send[MAX_GPC_SEND_LEN];
162
 
  char reply[MAX_GPC_REPLY_LEN];
163
 
} gpc_buf_t;
164
 
 
165
 
/*  gpc_buf_t *gpc_req; */
166
 
extern gpc_buf_t *gpc_req;
167
 
 
168
 
extern void block_pthread_signal(int signo);
169
 
extern void unblock_pthread_signal(int signo);
170
 
 
171
 
/*******structures copied from async.c for storing cmpl dscr for nb req*******/
172
 
#define UBUF_LEN 112
173
 
 
174
 
typedef struct {
175
 
  unsigned int tag;             /* request id*/
176
 
  short int bufid;              /* communication buffer id */
177
 
  short int protocol;           /* what does this buf hold?*/
178
 
  union {                 
179
 
        void *dscrbuf;          /*in case dscr below is not enough, do a*/
180
 
        double pad;             /*malloc, save pointer in dscrbuf and use it*/
181
 
  }ptr;
182
 
  char dscr[UBUF_LEN];          /*place to store the dscr*/
183
 
}_buf_info_t;
184
 
 
185
 
#define BUF_INFO_T _buf_info_t
186
 
extern BUF_INFO_T *_armci_buf_to_bufinfo(void *buf);
187
 
#define BUF_TO_BUFINFO _armci_buf_to_bufinfo
188
 
 
189
 
void armci_complete_req_buf(BUF_INFO_T *info, void *buffer);
190
 
extern INLINE BUF_INFO_T *_armci_id_to_bufinfo(int bufid);
191
 
 
192
 
#if 0 && defined(DATA_SERVER) && defined(SOCKETS)
193
 
#define MAX_BUFS  1
194
 
#define MAX_SMALL_BUFS 1
195
 
#else
196
 
#define MAX_BUFS 15
197
 
#define MAX_SMALL_BUFS 16
198
 
#endif
199
 
 
200
 
/* tracks sockets used for receiving responces from data server (GET) */
201
 
typedef struct {
202
 
  int socks[MAX_BUFS+MAX_SMALL_BUFS]; /* sock # or -1 if not used */
203
 
  int ready[MAX_BUFS+MAX_SMALL_BUFS]; /* 1 - ready, 0 - not */
204
 
} active_socks_t;
205
 
 
206
 
 
207
 
 
208
 
/*valid values for the element protocol in BUF_INFO_T*/
209
 
#define SDSCR_IN_PLACE 1 /*indicated that strided descriptor is in place*/
210
 
#define VDSCR_IN_PLACE 2 /*indicated that vector descriptor is in place*/
211
 
#define VDSCR_IN_PTR   3 /*indicates that the vector descriptor in allocated 
212
 
                           and pointer stored in dscrbuf */
213
 
/****************************************************************************/
214
 
 
215
 
 
216
 
#ifndef MSG_BUFLEN_DBL
217
 
# if defined(HITACHI)
218
 
#  define MSG_BUFLEN_DBL 0x50000
219
 
# else
220
 
#  define MSG_BUFLEN_DBL 50000
221
 
# endif
222
 
#endif
223
 
 
224
 
#define MSG_BUFLEN  sizeof(double)*MSG_BUFLEN_DBL
225
 
extern  char* MessageRcvBuffer;
226
 
extern  char* MessageSndBuffer;
227
 
 
228
 
#ifdef LAPI
229
 
#  define GET_SEND_BUFFER_(_size)(MessageSndBuffer+sizeof(lapi_cmpl_t));\
230
 
          CLEAR_COUNTER(*((lapi_cmpl_t*)MessageSndBuffer));\
231
 
          SET_COUNTER(*((lapi_cmpl_t*)MessageSndBuffer),1);
232
 
#  define GET_SEND_BUFFER _armci_buf_get
233
 
#  define GA_SEND_REPLY armci_lapi_send
234
 
#else
235
 
#  ifdef SOCKETS
236
 
#    define GA_SEND_REPLY(tag, buf, len, p) armci_sock_send(p,buf,len)
237
 
#  else
238
 
#    define GA_SEND_REPLY(tag, buf, len, p)  
239
 
#  endif
240
 
#endif
241
 
 
242
 
#ifdef QUADRICS_
243
 
#  define GET_SEND_BUFFER(_size,_op,_to) MessageSndBuffer;\
244
 
                    while(((request_header_t*)MessageSndBuffer)->tag)\
245
 
                    armci_util_spin(100, MessageSndBuffer)
246
 
#  define FREE_SEND_BUFFER(_ptr) ((request_header_t*)MessageSndBuffer)->tag = (void*)0 
247
 
#endif
248
 
 
249
 
#ifndef GET_SEND_BUFFER
250
 
#  define GET_SEND_BUFFER(_size,_op,_to) MessageSndBuffer
251
 
#endif
252
 
 
253
 
#ifndef FREE_SEND_BUFFER
254
 
#define FREE_SEND_BUFFER(_ptr)  
255
 
#endif
256
 
 
257
 
#ifndef INIT_SENDBUF_INFO
258
 
#define INIT_SENDBUF_INFO(_hdl,_buf,_op,_proc) 
259
 
#endif
260
 
 
261
 
typedef struct {
262
 
           char *buf; char* buf_posted; int count; int proc; int op; int extra;
263
 
} buf_arg_t;
264
 
 
265
 
/*includes for SERVER_LOCK*/
266
 
#if defined(SERVER_THREAD) && !defined(VIA)
267
 
   extern void armci_rem_lock(int mutex, int proc, int *ticket);
268
 
   extern void armci_rem_unlock(int mutex, int proc, int ticket);
269
 
   extern void armci_unlock_waiting_process(msg_tag_t tag,int proc, int ticket);
270
 
#endif
271
 
 
272
 
 
273
 
#ifdef PIPE_BUFSIZE 
274
 
   extern void armcill_pipe_post_bufs(void *ptr, int stride_arr[], int count[],
275
 
                                      int strides, void* argvoid);
276
 
   extern void armcill_pipe_extract_data(void *ptr,int stride_arr[],int count[],
277
 
                                         int strides, void* argvoid);
278
 
   extern void armcill_pipe_send_chunk(void *data, int stride_arr[],int count[],
279
 
                                       int strides, void* argvoid);
280
 
#endif
281
 
 
282
 
extern void armci_send_strided(int proc, request_header_t *msginfo, char *bdata,
283
 
                         void *ptr, int strides, int stride_arr[], int count[]);
284
 
 
285
 
extern void armci_rcv_hdlr(request_header_t* msginfo);
286
 
 
287
 
extern char *armci_rcv_data(int proc, request_header_t *msginfo);
288
 
extern void armci_rcv_strided_data_bypass(int proc, request_header_t *msginfo,
289
 
                                          void *ptr, int stride_levels);
290
 
extern void armci_send_strided_data_bypass(int proc, request_header_t *msginfo,
291
 
            void *loc_buf, int msg_buflen, void *loc_ptr, int *loc_stride_arr,
292
 
            void *rem_ptr, int *rem_stride_arr, int *count, int stride_levels);
293
 
 
294
 
extern void armci_rcv_strided_data(int proc, request_header_t* msginfo, 
295
 
                  int datalen, void *ptr, int strides,int stride_arr[],int count[]);
296
 
extern void armci_send_strided_data(int proc,  request_header_t *msginfo, 
297
 
            char *bdata, void *ptr, int strides, int stride_arr[], int count[]);
298
 
extern void armci_send_req(int proc, request_header_t* msginfo, int len);
299
 
extern void armci_server_rmw(request_header_t* msginfo,void* ptr, void* pextra);
300
 
extern int armci_rem_vector(int op, void *scale, armci_giov_t darr[],int len,
301
 
                            int proc,int flag,armci_ihdl_t nb_handle);
302
 
extern int armci_rem_strided(int op, void* scale, int proc,
303
 
                       void *src_ptr, int src_stride_arr[],
304
 
                       void* dst_ptr, int dst_stride_arr[],
305
 
                       int count[], int stride_levels, 
306
 
                       ext_header_t *h, int lockit,armci_ihdl_t nb_handle);
307
 
 
308
 
extern void armci_rem_rmw(int op, int *ploc, int *prem, int extra, int proc);
309
 
extern void armci_rem_ack(int clus);
310
 
extern void armci_server(request_header_t *msginfo, char *dscr, char* buf, 
311
 
                         int buflen);
312
 
extern void armci_server_vector(request_header_t *msginfo,
313
 
                                char *dscr, char* buf, int buflen);
314
 
extern void armci_serv_attach_req(void *info, int ilen, long size,
315
 
                                  void* resp,int rlen);
316
 
extern void armci_server_lock(request_header_t *msginfo);
317
 
extern void armci_server_unlock(request_header_t *msginfo, char* dscr);
318
 
extern void armci_create_server_thread ( void* (* func)(void*) );
319
 
extern int armci_server_lock_mutex(int mutex, int proc, msg_tag_t tag);
320
 
extern void armci_send_data(request_header_t* msginfo, void *data);
321
 
extern int armci_server_unlock_mutex(int mutex, int p, int tkt, msg_tag_t* tag);
322
 
extern void armci_rcv_vector_data(int p, request_header_t* msginfo, armci_giov_t dr[], int len);
323
 
 
324
 
#if !defined(LAPI) 
325
 
extern void armci_wait_for_server();
326
 
extern void armci_start_server();
327
 
extern void armci_transport_cleanup();
328
 
extern int armci_send_req_msg(int proc, void *buf, int bytes);
329
 
extern void armci_WriteToDirect(int proc, request_header_t* msginfo, void *buf);
330
 
extern char *armci_ReadFromDirect(int proc, request_header_t *msginfo, int len);
331
 
extern void armci_init_connections();
332
 
extern void *armci_server_code(void *data);
333
 
extern void armci_rcv_req(void *mesg, void *phdr, void *pdescr, 
334
 
                          void *pdata, int *buflen);
335
 
extern void armci_client_connect_to_servers();
336
 
extern void armci_data_server(void *mesg);
337
 
extern void armci_server_initial_connection();
338
 
extern void armci_call_data_server();
339
 
#endif
340
 
#ifdef SOCKETS
341
 
extern void armci_ReadStridedFromDirect(int proc, request_header_t* msginfo,
342
 
                  void *ptr, int strides, int stride_arr[], int count[]);
343
 
extern void armci_WriteStridedToDirect(int proc, request_header_t* msginfo,
344
 
                         void *ptr, int strides, int stride_arr[], int count[]);
345
 
extern void armci_serv_quit();
346
 
extern int armci_send_req_msg_strided(int proc, request_header_t *msginfo,
347
 
                          char *ptr, int strides, int stride_arr[],int count[]);
348
 
extern void armci_server_goodbye(request_header_t* msginfo);
349
 
#endif
350
 
#if defined(MPI_SPAWN) || defined(MPI_MT)
351
 
extern void armci_serv_quit();
352
 
extern void armci_server_goodbye(request_header_t* msginfo);
353
 
#endif
354
 
#ifdef HITACHI
355
 
extern void armci_server_goodbye(request_header_t* msginfo);
356
 
extern void armci_serv_quit();
357
 
#endif
358
 
extern void armci_server_ipc(request_header_t* msginfo, void* descr,
359
 
                             void* buffer, int buflen);
360
 
 
361
 
#ifdef PIPE_BUFSIZE
362
 
extern void armci_pipe_prep_receive_strided(request_header_t *msginfo,char *buf,
363
 
                       int strides, int stride_arr[], int count[], int bufsize);
364
 
extern void armci_pipe_receive_strided(request_header_t* msginfo, void *ptr,
365
 
                                int stride_arr[], int count[], int strides);
366
 
extern void armci_pipe_send_req(int proc, void *buf, int bytes);
367
 
#endif
368
 
 
369
 
extern void armci_rcv_strided_data_bypass_both(int, request_header_t*,void*, int*, int);
370
 
extern int armci_rem_get(int proc, void *src_ptr, int src_stride_arr[],
371
 
                  void* dst_ptr, int dst_stride_arr[], int count[], int stride_levels,
372
 
                  armci_ihdl_t nb_handle,void *mhloc,void *mhrem);
373
 
 
374
 
#if defined(ALLOW_PIN) && defined(VAPI)
375
 
extern int armci_two_phase_send(int proc,void *src_ptr,int src_stride_arr[],
376
 
                    void *dst_ptr,int dst_stride_arr[],int count[],
377
 
                    int stride_levels,void ** context_ptr,armci_ihdl_t nbhandle,
378
 
                    ARMCI_MEMHDL_T *mhloc);
379
 
extern int armci_two_phase_get(int proc, void*src_ptr, int src_stride_arr[],
380
 
                    void*dst_ptr,int dst_stride_arr[], int count[],
381
 
                    int stride_levels, void**context_ptr,
382
 
                    armci_ihdl_t nbhandle, ARMCI_MEMHDL_T *mhloc);
383
 
#endif
384
 
#endif