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

« back to all changes in this revision

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