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 namespace sc {
00043
00045 class DistShellPair {
00046 public:
00050 class SharedData {
00051 public:
00052 volatile long int shellpair_;
00054 SharedData() { init(); }
00058 void init() { shellpair_ = 0; }
00059 };
00060 private:
00061 Ref<MessageGrp> msg_;
00062 int nthread_;
00063 Ref<ThreadLock> lock_;
00064 Ref<GaussianBasisSet> bs1_;
00065 Ref<GaussianBasisSet> bs2_;
00066 bool bs1_eq_bs2_;
00067 bool task_dynamic_;
00068 bool thread_dynamic_;
00069 int debug_;
00070
00071 double print_percent_;
00072 SharedData *shared_;
00073
00074
00075
00076
00077 long int ntask_;
00078
00079 long int print_interval_;
00080
00081 long int current_shellpair_;
00082
00083
00084 int req_type_;
00085 int ans_type_;
00086 int ncpu_less_0_;
00087 void serve_tasks();
00088
00089
00090 int S_, R_;
00091 int ncpu_;
00092 int incS_, incR_;
00093 int mythread_;
00094
00095
00096 int *cost_;
00097 int *Svec_;
00098 int *Rvec_;
00099 int *Ivec_;
00100
00101 void init_dynamic_work();
00102 public:
00106 DistShellPair(const Ref<MessageGrp> &, int nthread, int mythread,
00107 const Ref<ThreadLock>& lock,
00108 const Ref<GaussianBasisSet>& bs1, const Ref<GaussianBasisSet>& bs2,
00109 bool dynamic, SharedData *shared = 0);
00110 ~DistShellPair();
00112 void init();
00114 void set_debug(int d) { debug_ = d; }
00117 void set_print_percent(double p);
00125 int get_task(int &P, int &Q);
00126 };
00127
00128 }
00129
00130 #endif
00131
00132
00133
00134
00135
00136
00137