~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/utils.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: utils.h,v 1.1.2.3 2007-07-02 05:35:31 d3p687 Exp $
2
 
 *
3
 
 * primitives for transparent handling of multi-threading
4
 
 */
5
 
 
6
 
#ifndef UTILS_H
7
 
#define UTILS_H
8
 
 
9
 
/*
10
 
 * This header file describes the "barrier" synchronization
11
 
 * construct. The type barrier_t describes the full state of the
12
 
 * barrier including the POSIX 1003.1c synchronization objects
13
 
 * necessary.
14
 
 *
15
 
 * A barrier causes threads to wait until a set of threads has
16
 
 * all "reached" the barrier. The number of threads required is
17
 
 * set when the barrier is initialized, and cannot be changed
18
 
 * except by reinitializing.
19
 
 */
20
 
 
21
 
 
22
 
#ifdef THREAD_SAFE
23
 
#   ifdef POSIX_THREADS
24
 
 
25
 
#       include <pthread.h>
26
 
 
27
 
#if 1
28
 
        typedef pthread_mutex_t thread_lock_t;
29
 
#       define THREAD_LOCK_INIT(x)    pthread_mutex_init(&x,NULL)
30
 
#       define THREAD_LOCK_DESTROY(x) pthread_mutex_destroy(&x)
31
 
#       define THREAD_LOCK(x)         pthread_mutex_lock(&x)
32
 
#       define THREAD_UNLOCK(x)       pthread_mutex_unlock(&x)
33
 
#else
34
 
 
35
 
#ifndef INLINE
36
 
#       define INLINE
37
 
#       include "spinlock.h"
38
 
#       undef INLINE
39
 
#else
40
 
#       include "spinlock.h"
41
 
#endif
42
 
 
43
 
        typedef LOCK_T thread_lock_t;
44
 
#       define THREAD_LOCK_INIT(x)    armci_init_spinlock(&x)
45
 
#       define THREAD_LOCK_DESTROY(x) 0
46
 
#       define THREAD_LOCK(x)         armci_acquire_spinlock(&x)
47
 
#       define THREAD_UNLOCK(x)       armci_release_spinlock(&x)
48
 
#endif
49
 
        typedef pthread_t thread_t;
50
 
#       define THREAD_CREATE(th_,func_,arg_) pthread_create(th_,NULL,func_,arg_)
51
 
#       define THREAD_JOIN(th_,ret_) pthread_join(th_,ret_)
52
 
 
53
 
        /* structure describing a barrier */
54
 
        typedef struct thread_barrier_tag {
55
 
            pthread_mutex_t     mutex;          /* Control access to barrier */
56
 
            pthread_cond_t      cv;             /* wait for barrier */
57
 
            int                 valid;          /* set when valid */
58
 
            int                 threshold;      /* number of threads required */
59
 
            int                 counter;        /* current number of threads */
60
 
            int                 cycle;          /* alternate wait cycles (0 or 1) */
61
 
        } thread_barrier_t;
62
 
 
63
 
#       define BARRIER_VALID   0xdbcafe
64
 
 
65
 
        /* support static initialization of barriers */
66
 
#       define BARRIER_INITIALIZER(cnt) {\
67
 
            PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER,\
68
 
            BARRIER_VALID, cnt, cnt, 0}
69
 
 
70
 
#   else
71
 
#       error ONLY PTHREADS SUPPORT HAS BEEN IMPLEMENTED
72
 
#   endif
73
 
 
74
 
#   define TH2PROC(th_) (th_/mt_tpp) /* computes processor from thread id */
75
 
 
76
 
    /* barrier functions */
77
 
    int thread_barrier_init (thread_barrier_t *barrier, int count);
78
 
    int thread_barrier_destroy (thread_barrier_t *barrier);
79
 
    int thread_barrier_wait (thread_barrier_t *barrier);
80
 
 
81
 
    /* multi-threaded memory functions */
82
 
    int armci_malloc_mt(void *ptr[], int bytes);
83
 
    int armci_free_mt(void *ptr, int th_idx);
84
 
#   define ARMCI_MALLOC_MT armci_malloc_mt
85
 
#   define ARMCI_FREE_MT armci_free_mt
86
 
 
87
 
 
88
 
#   define TH_INIT(p_,t_)   mt_size=p_;mt_tpp=t_;\
89
 
                            thread_barrier_init(&mt_barrier,mt_tpp)
90
 
#   define TH_FINALIZE()    thread_barrier_destroy(&mt_barrier)
91
 
#   define MT_BARRIER()     if (thread_barrier_wait(&mt_barrier)==-1) armci_msg_barrier();\
92
 
                                thread_barrier_wait(&mt_barrier)
93
 
 
94
 
    extern int mt_size;
95
 
    extern int mt_tpp;
96
 
    extern thread_barrier_t mt_barrier;
97
 
#else
98
 
#   define THREAD_LOCK_INIT(x)
99
 
#   define THREAD_LOCK_DESTROY(x)
100
 
#   define THREAD_LOCK(x)
101
 
#   define THREAD_UNLOCK(x)
102
 
#   define TH_INIT(p_,t_)
103
 
#   define TH_FINALIZE()
104
 
#   define MT_BARRIER armci_msg_barrier
105
 
#   define ARMCI_MALLOC_MT PARMCI_Malloc
106
 
#   define ARMCI_FREE_MT(p_,th_) PARMCI_Free(p_)
107
 
#endif
108
 
 
109
 
 
110
 
 
111
 
 
112
 
 
113
 
 
114
 
#endif/*UTILS_H*/
115
 
 
116