00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _chemistry_qc_basis_distshpair_h
00031 #define _chemistry_qc_basis_distshpair_h
00032
00033 #ifdef __GNUC__
00034 #pragma interface
00035 #endif
00036
00037 #include <util/misc/regtime.h>
00038 #include <util/group/message.h>
00039 #include <util/group/thread.h>
00040 #include <chemistry/qc/basis/basis.h>
00041
00042 using namespace sc;
00043
00044 namespace sc {
00045
00047 class DistShellPair {
00048 public:
00052 class SharedData {
00053 public:
00054 volatile long int shellpair_;
00056 SharedData() { init(); }
00060 void init() { shellpair_ = 0; }
00061 };
00062 private:
00063 Ref<MessageGrp> msg_;
00064 int nthread_;
00065 Ref<ThreadLock> lock_;
00066 Ref<GaussianBasisSet> bs1_;
00067 Ref<GaussianBasisSet> bs2_;
00068 bool bs1_eq_bs2_;
00069 bool task_dynamic_;
00070 bool thread_dynamic_;
00071 int debug_;
00072
00073 double print_percent_;
00074 SharedData *shared_;
00075
00076
00077
00078
00079 long int ntask_;
00080
00081 long int print_interval_;
00082
00083 long int current_shellpair_;
00084
00085
00086 int req_type_;
00087 int ans_type_;
00088 int ncpu_less_0_;
00089 void serve_tasks();
00090
00091
00092 int S_, R_;
00093 int ncpu_;
00094 int incS_, incR_;
00095 int mythread_;
00096
00097
00098 int *cost_;
00099 int *Svec_;
00100 int *Rvec_;
00101 int *Ivec_;
00102
00103 void init_dynamic_work();
00104 public:
00108 DistShellPair(const Ref<MessageGrp> &, int nthread, int mythread,
00109 const Ref<ThreadLock>& lock,
00110 const Ref<GaussianBasisSet>& bs1, const Ref<GaussianBasisSet>& bs2,
00111 bool dynamic, SharedData *shared = 0);
00112 ~DistShellPair();
00114 void init();
00116 void set_debug(int d) { debug_ = d; }
00118 void set_print_percent(double p);
00126 int get_task(int &P, int &Q);
00127 };
00128
00129 }
00130
00131 #endif
00132
00133
00134
00135
00136
00137
00138