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

« back to all changes in this revision

Viewing changes to src/tools/ga-5-2/tascel/src/SharedQueue.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_SharedQueue_h__
 
2
#define __tascel_SharedQueue_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 forces the entire queue on a given proc to be locked
 
16
   * during any modification by itself or by any other proc.
 
17
   */
 
18
  class SharedQueue {
 
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  head; /**< the head of the queue */
 
26
        int  tail; /**< the tail of the queue */
 
27
        int  size; /**< the number of 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 state */
 
35
      int *tail;              /**< pointer to this procs tail state */
 
36
      int *size;              /**< pointer to this procs size state */
 
37
      int *dirty;             /**< pointer to this procs dirty state */
 
38
      TerminationDetector td; /**< the TerminationDetector */
 
39
 
 
40
    public:
 
41
      /**
 
42
       * Constructs the SharedQueue instance.
 
43
       *
 
44
       * @param[in] tsk_size size of a single task
 
45
       * @param[in] max_ntsks max number of tasks in a queue
 
46
       *
 
47
       * @pre tsk_size must be the same value on all procs
 
48
       * @pre max_ntsks must be the same value on all procs
 
49
       */
 
50
      SharedQueue(int tsk_size, int max_ntsks);
 
51
      
 
52
      /**
 
53
       * Destroys the SharedQueue instance.
 
54
       */
 
55
      ~SharedQueue();
 
56
      
 
57
      /**
 
58
       * Returns true if the local queue is empty.
 
59
       *
 
60
       * @return true if the local queue is empty.
 
61
       */
 
62
      bool empty() const;
 
63
      
 
64
      /**
 
65
       * Retrieves a task from the local queue.
 
66
       *
 
67
       * @param[out] dscr the retrieved task
 
68
       * @param[in] dlen size of the retrieved task
 
69
       *
 
70
       * @pre dscr is not NULL
 
71
       * @pre dlen == tsk_size
 
72
       *
 
73
       * @return true if task was successfully retrieved
 
74
       */
 
75
      bool getTask(void *dscr, int dlen);
 
76
      
 
77
      /**
 
78
       * Adds a task to the local queue.
 
79
       *
 
80
       * @param[in] dscr the task to add
 
81
       * @param[in] dlen size of the added task
 
82
       *
 
83
       * @pre dscr is not NULL
 
84
       * @pre dlen == tsk_size
 
85
       *
 
86
       * @return true if task was successfully added
 
87
       */
 
88
      void addTask(void *dscr, int dlen);
 
89
      
 
90
      /**
 
91
       * Steals one or more tasks from the given proc.
 
92
       *
 
93
       * @param[in] proc to steal from
 
94
       */
 
95
      bool steal(int proc);
 
96
      
 
97
      /**
 
98
       * Returns true if all of the tasks have been processed.
 
99
       *
 
100
       * @return true if all of the tasks have been processed.
 
101
       */
 
102
      bool hasTerminated();
 
103
      
 
104
      /**
 
105
       * Runs the termination detector.
 
106
       */
 
107
      void td_progress();
 
108
 
 
109
  }; /* SharedQueue */
 
110
}; /* tascel */
 
111
 
 
112
#endif /*__tascel_SharedQueue_h__*/
 
113