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

« back to all changes in this revision

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