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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-1/armci/src-gemini/locks.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
 
/* $Id: locks.h,v 1.28.2.4 2006-12-21 23:50:48 manoj Exp $ */
2
 
#ifndef _ARMCI_LOCKS_H_
3
 
#define _ARMCI_LOCKS_H_
4
 
#include <sys/types.h>
5
 
#define MAX_LOCKS 1024
6
 
#define NUM_LOCKS MAX_LOCKS 
7
 
 
8
 
#ifndef EXTERN
9
 
#   define EXTERN extern
10
 
#endif
11
 
#ifdef QUADRICS
12
 
#include <elan/elan.h>
13
 
#endif
14
 
 
15
 
#if !defined(CYGNUS) && !defined(QUADRICS) || defined(ELAN_ACC)
16
 
#include "spinlock.h"
17
 
#endif
18
 
 
19
 
#if 0
20
 
/* code disabled until more tests of pthread locking is done */
21
 
#if !defined(SPINLOCK) && (defined(SGI) || defined(DECOSF)) && defined(PTHREADS)
22
 
/* check if Pthreads locks in Posix 1003.1c support processes*/
23
 
#include <pthread.h>
24
 
#include <unistd.h>
25
 
#ifdef _POSIX_THREAD_PROCESS_SHARED
26
 
#  define PMUTEXES
27
 
#endif
28
 
#endif
29
 
#endif
30
 
 
31
 
 
32
 
#if defined(PTHREADS) && !(defined(PMUTEXES) || defined(SPINLOCK)||defined(QUADRICS))
33
 
# if defined(LINUX) && defined(__sparc__) && defined(GM)
34
 
#    define PMUTEXES
35
 
#    include <pthread.h>
36
 
# else
37
 
     cannot run
38
 
# endif
39
 
#endif
40
 
 
41
 
 
42
 
#if (defined(SPINLOCK) || defined(PMUTEXES) || defined(HITACHI)\
43
 
) && !defined(BGML)
44
 
#  include "shmem.h"
45
 
   typedef struct {
46
 
     long off;
47
 
     long idlist[SHMIDLEN];
48
 
   }lockset_t;
49
 
   extern lockset_t lockid;
50
 
#elif defined(BGML)
51
 
   typedef int lockset_t;
52
 
#endif
53
 
 
54
 
 
55
 
#if defined(SPINLOCK) 
56
 
 
57
 
# ifdef SGIALTIX
58
 
/*
59
 
#  define NAT_LOCK(x,p) armci_acquire_spinlock((LOCK_T*)(((void**)_armci_int_mutexes)[]))
60
 
#  define NAT_UNLOCK(x,p) armci_release_spinlock((LOCK_T*)(((void**)_armci_int_mutexes)[x]))
61
 
*/
62
 
#  define NAT_LOCK(x,p) \
63
 
    armci_acquire_spinlock((LOCK_T*)( ((PAD_LOCK_T*)(((void**)_armci_int_mutexes)[p]))+x ))
64
 
#  define NAT_UNLOCK(x,p) \
65
 
    armci_release_spinlock((LOCK_T*)( ((PAD_LOCK_T*)(((void**)_armci_int_mutexes)[p]))+x ))
66
 
   EXTERN PAD_LOCK_T *_armci_int_mutexes;
67
 
# else
68
 
#  define NAT_LOCK(x,p) armci_acquire_spinlock((LOCK_T*)(_armci_int_mutexes+(x)))
69
 
#  define NAT_UNLOCK(x,p) armci_release_spinlock((LOCK_T*)(_armci_int_mutexes+(x)))
70
 
   EXTERN PAD_LOCK_T *_armci_int_mutexes;
71
 
# endif
72
 
 
73
 
#elif defined(PMUTEXES)
74
 
 
75
 
#  define NAT_LOCK(x,p) pthread_mutex_lock(_armci_int_mutexes +x)
76
 
#  define NAT_UNLOCK(x,p) pthread_mutex_unlock(_armci_int_mutexes +x)
77
 
#  define LOCK_T pthread_mutex_t
78
 
#  define PAD_LOCK_T LOCK_T
79
 
   EXTERN PAD_LOCK_T *_armci_int_mutexes;
80
 
 
81
 
#elif defined(HITACHI)
82
 
 
83
 
   extern void armcill_lock(int mutex, int proc);
84
 
   extern void armcill_unlock(int mutex, int proc);
85
 
 
86
 
#  define LOCK_T int
87
 
#  define PAD_LOCK_T LOCK_T
88
 
#  define NAT_LOCK(x,p) armcill_lock((x),(p))
89
 
#  define NAT_UNLOCK(x,p) armcill_unlock((x),(p))
90
 
   EXTERN PAD_LOCK_T *_armci_int_mutexes;
91
 
 
92
 
#elif defined(SGI)
93
 
 
94
 
#  define SGI_SPINS 100
95
 
#  include <ulocks.h>
96
 
 
97
 
   typedef struct {
98
 
        int id;
99
 
        ulock_t * lock_array[NUM_LOCKS];
100
 
   }lockset_t;
101
 
 
102
 
   extern lockset_t lockset;
103
 
#  define NAT_LOCK(x,p)    (void) uswsetlock(lockset.lock_array[(x)],SGI_SPINS)
104
 
#  define NAT_UNLOCK(x,p)  (void) usunsetlock(lockset.lock_array[(x)])
105
 
 
106
 
#elif defined(CONVEX)
107
 
 
108
 
#  include <sys/cnx_ail.h>
109
 
   typedef struct{
110
 
        unsigned state;
111
 
        unsigned pad[15];
112
 
   } lock_t;
113
 
 
114
 
   typedef int lockset_t;
115
 
   extern lock_t *lock_array;
116
 
   extern void setlock(unsigned * volatile lp);
117
 
   extern void unsetlock(unsigned  * volatile lp);
118
 
#  define NAT_LOCK(x,p)    (void) setlock(&lock_array[x].state)
119
 
#  define NAT_UNLOCK(x,p)  (void) unsetlock(&lock_array[(x)].state)
120
 
 
121
 
#elif defined(WIN32)
122
 
 
123
 
   typedef int lockset_t;
124
 
   extern void setlock(int);
125
 
   extern void unsetlock(int);
126
 
#  define NAT_LOCK(x,p)   setlock(x)
127
 
#  define NAT_UNLOCK(x,p)  unsetlock(x)
128
 
 
129
 
#elif defined(CRAY_YMP) && !defined(__crayx1)
130
 
#  include <tfork.h>
131
 
 
132
 
    typedef int lockset_t;
133
 
    extern  lock_t cri_l[NUM_LOCKS];
134
 
#  pragma  _CRI common cri_l
135
 
 
136
 
#  define NAT_LOCK(x,p)   t_lock(cri_l+(x))
137
 
#  define NAT_UNLOCK(x,p) t_unlock(cri_l+(x))
138
 
 
139
 
#elif defined(QUADRICS) && defined(_ELAN_LOCK_H)
140
 
 
141
 
extern void armcill_allocate_locks(int);
142
 
extern void armcill_lock(int m, int proc);
143
 
extern void armcill_unlock(int m, int proc);
144
 
#  undef NUM_LOCKS
145
 
#  define NUM_LOCKS 4
146
 
#  define NAT_LOCK armcill_lock
147
 
#  define NAT_UNLOCK armcill_unlock
148
 
   typedef int lockset_t;
149
 
 
150
 
 
151
 
#elif defined(CRAY_T3E) || defined(QUADRICS) || defined(__crayx1)\
152
 
        || defined(CATAMOUNT) || defined(CRAY_SHMEM)
153
 
#  include <limits.h>
154
 
#  if defined(CRAY) || defined(CRAY_SHMEM)
155
 
#    include <mpp/shmem.h>
156
 
#  endif
157
 
#if defined(DECOSF) || defined(LINUX64) || defined(__crayx1)\
158
 
        || defined(CATAMOUNT)
159
 
#  define  _INT_MIN_64 (LONG_MAX-1)
160
 
#endif
161
 
#  undef NUM_LOCKS
162
 
#  define NUM_LOCKS 4
163
 
   static long armci_lock_var[4]={0,0,0,0};
164
 
   typedef int lockset_t;
165
 
#  define INVALID (long)(_INT_MIN_64 +1)
166
 
#  define NAT_LOCK(x,p) while( shmem_swap(armci_lock_var+(x),INVALID,(p)) )
167
 
#  define NAT_UNLOCK(x,p) shmem_swap(armci_lock_var+(x), 0, (p))
168
 
 
169
 
 
170
 
#elif  defined(SYSV) && defined(LAPI) && defined(AIX)
171
 
 
172
 
int **_armci_int_mutexes;
173
 
#  define NAT_LOCK(x,p)  armci_lapi_lock(_armci_int_mutexes[armci_master]+(x))
174
 
#  define NAT_UNLOCK(x,p)  armci_lapi_unlock(_armci_int_mutexes[armci_master]+(x))
175
 
   typedef int lockset_t;
176
 
 
177
 
#elif defined(CYGNUS)
178
 
 
179
 
   typedef int lockset_t;
180
 
#  define NAT_LOCK(x,p) armci_die("does not run in parallel",0) 
181
 
#  define NAT_UNLOCK(x,p) armci_die("does not run in parallel",0)  
182
 
 
183
 
#elif defined(LAPI) && !defined (LINUX)
184
 
 
185
 
#  include <pthread.h>
186
 
   typedef int lockset_t;
187
 
   extern pthread_mutex_t _armci_mutex_thread;
188
 
#  define NAT_LOCK(x,p)   pthread_mutex_lock(&_armci_mutex_thread)
189
 
#  define NAT_UNLOCK(x,p) pthread_mutex_unlock(&_armci_mutex_thread)
190
 
 
191
 
 
192
 
#elif defined(FUJITSU)
193
 
   typedef int lockset_t;
194
 
#  include "fujitsu-vpp.h"
195
 
 
196
 
#elif defined(SYSV) ||defined(MACX)
197
 
 
198
 
#  include "semaphores.h"
199
 
#  undef NUM_LOCKS
200
 
#  define NUM_LOCKS ((MAX_LOCKS< SEMMSL) ? MAX_LOCKS:SEMMSL)
201
 
 
202
 
#  define NAT_LOCK(x,p)   P_semaphore(x)
203
 
#  define NAT_UNLOCK(x,p)  V_semaphore(x)
204
 
 
205
 
#ifndef _LOCKS_C_
206
 
#define CreateInitLocks Sem_CreateInitLocks
207
 
#define InitLocks Sem_InitLocks
208
 
#define DeleteLocks Sem_DeleteLocks
209
 
#endif
210
 
 
211
 
#else
212
 
 
213
 
   typedef int lockset_t;
214
 
#  define NAT_LOCK(x,p)  crap
215
 
#  define NAT_UNLOCK(x,p) crap2
216
 
# error "no spin lock?"
217
 
 
218
 
#endif
219
 
 
220
 
extern void CreateInitLocks(int num, lockset_t *id);
221
 
extern void InitLocks(int num , lockset_t id);
222
 
extern void DeleteLocks(lockset_t id);
223
 
 
224
 
#ifdef FUJITSU
225
 
#define NATIVE_LOCK(x,p) if(armci_nproc>1) { NAT_LOCK(p); }
226
 
#define NATIVE_UNLOCK(x,p) if(armci_nproc>1) { NAT_UNLOCK(p); }
227
 
#else
228
 
#define NATIVE_LOCK(x,p) if(armci_nproc>1) { NAT_LOCK(x,p); }
229
 
#define NATIVE_UNLOCK(x,p) if(armci_nproc>1) { NAT_UNLOCK(x,p); }
230
 
#endif
231
 
 
232
 
#endif