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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-2/tascel/src/SplitQueue.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 __tascel_SplitQueue_h__
 
2
#define __tascel_SplitQueue_h__
 
3
 
 
4
#include "TerminationDetector.h"
 
5
 
 
6
namespace tascel {
 
7
 
 
8
  /**
 
9
   * A set of task queues shared among processes.
 
10
   *
 
11
   * Each process has a local queue with a maximum number of possible tasks.
 
12
   * A process can steal tasks from any other process's queue and have
 
13
   * tasks stolen from its own queue.
 
14
   *
 
15
   * This implementation splits the queue into a local and shared portion.
 
16
   * This allows the local process to modify its queue without locking.
 
17
   */
 
18
  class SplitQueue {
 
19
    private:
 
20
      /**
 
21
       * The local queue state which other procs can modify.
 
22
       */
 
23
      struct sq_state_t {
 
24
        int dirty;      /**< whether a steal has occurred */
 
25
        int split;      /**< the split between head and tail */
 
26
        int tail;       /**< the tail of the queue */
 
27
        int size_shared;/**< the number of shared tasks in the queue */
 
28
      };
 
29
 
 
30
      const int max_ntsks;    /**< max number of tasks allowed in queue */
 
31
      const int tsk_size;     /**< size of a single task */
 
32
      char **q;               /**< addresses of queue data on all procs */
 
33
      sq_state_t **sq_state;  /**< addresses of queue state on all procs */
 
34
      int *head;              /**< pointer to this procs head_val */
 
35
      int *tail;              /**< pointer to this procs tail state */
 
36
      int *size_local;        /**< pointer to this procs size_local_val */
 
37
      int *size_shared;       /**< pointer to this procs size_shared state */
 
38
      int *split;             /**< pointer to this procs split state */
 
39
      int *dirty;             /**< pointer to this procs dirt state */
 
40
      int size_local_val;     /**< size of local portion of local queue */
 
41
      int head_val;           /**< index of the local queue's head */
 
42
      TerminationDetector td; /**< the termination detector */
 
43
 
 
44
      /**
 
45
       * Moves tasks from the shared portion to the local portion.
 
46
       *
 
47
       * @param[in] _nacquire number of tasks to move
 
48
       */
 
49
      int acquireFromShared(int _nacquire);
 
50
 
 
51
      /**
 
52
       * Moves tasks from the local portion to the shared portion.
 
53
       *
 
54
       * @param[in] ndonate number of tasks to move
 
55
       */
 
56
      void releaseToShared(int ndonate);
 
57
 
 
58
    public:
 
59
      /**
 
60
       * Constructs the SplitQueue instance.
 
61
       *
 
62
       * @param[in] tsk_size size of a single task
 
63
       * @param[in] max_ntsks max number of tasks allowed in a queue
 
64
       *
 
65
       * @pre tsk_size must be the same value on all procs
 
66
       * @pre max_ntsks must be the same value on all procs
 
67
       */
 
68
      SplitQueue(int tsk_size, int max_ntsks);
 
69
 
 
70
      /**
 
71
       * Destroys the SplitQueue instance.
 
72
       */
 
73
      ~SplitQueue();
 
74
 
 
75
      /**
 
76
       * Returns true if the local queue is empty.
 
77
       */
 
78
      bool empty() const;
 
79
 
 
80
      /**
 
81
       * Returns true if the local queue is full.
 
82
       */
 
83
      bool full() const;
 
84
 
 
85
      /**
 
86
       * Retrieves a task from the private portion of the local queue.
 
87
       *
 
88
       * @param[out] dscr the retrieved task
 
89
       * @param[in] dlen size of the retrieved task
 
90
       *
 
91
       * @pre dscr is not NULL
 
92
       * @pre dlen == tsk_size
 
93
       */
 
94
      bool getTask(void *dscr, int dlen);
 
95
 
 
96
      /**
 
97
       * Adds a task to the private portion of the local queue.
 
98
       *
 
99
       * @param[in] dscr the task to add
 
100
       * @param[in] dlen size of the added task
 
101
       *
 
102
       * @pre dscr is not NULL
 
103
       * @pre dlen == tsk_size
 
104
       */
 
105
      void addTask(void *dscr, int dlen);
 
106
      
 
107
      /**
 
108
       * Steals one or more tasks from the given proc's shared portion.
 
109
       *
 
110
       * @param[in] proc to steal from
 
111
       */
 
112
      bool steal(int proc);
 
113
      
 
114
      /**
 
115
       * Returns true if all of the tasks have been processed.
 
116
       */
 
117
      bool hasTerminated();
 
118
      
 
119
      /**
 
120
       * Returns the number of tasks in the entire local queue.
 
121
       */
 
122
      int numTasks() const {
 
123
        return *size_local + *size_shared;
 
124
      }
 
125
      
 
126
      /**
 
127
       * Runs the termination detector.
 
128
       */
 
129
      void td_progress();
 
130
 
 
131
  }; /* SplitQueue */
 
132
}; /* tascel */
 
133
 
 
134
#endif /*__tascel_SplitQueue_h__*/
 
135