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 #ifndef _chemistry_qc_mbptr12_r12ia_memgrp_h
00029 #define _chemistry_qc_mbptr12_r12ia_memgrp_h
00030
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034
00035 #include <util/ref/ref.h>
00036 #include <util/group/memory.h>
00037 #include <chemistry/qc/mbptr12/r12ia.h>
00038
00039 namespace sc {
00040
00042
00043
00044
00045
00046
00047
00048
00049 class R12IntsAcc_MemoryGrp: public R12IntsAcc {
00050
00051 Ref<MemoryGrp> mem_;
00052 int nproc_;
00053 size_t blksize_memgrp_;
00054
00055 struct PairBlkInfo {
00056 double *ints_[max_num_te_types_];
00057 int refcount_[max_num_te_types_];
00058 distsize_t offset_;
00059 } *pairblk_;
00060
00061
00062 void init();
00064 int ntasks() const { return mem_->n(); }
00066 int taskid() const { return mem_->me(); }
00067
00068 public:
00069 R12IntsAcc_MemoryGrp(Ref<MemoryGrp>&, int num_te_types, int ni, int nj, int nx, int ny);
00070 R12IntsAcc_MemoryGrp(StateIn&);
00071 ~R12IntsAcc_MemoryGrp();
00072 void save_data_state(StateOut&);
00073
00079 void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize);
00081 void store_pair_block(int i, int j, double *ints);
00084 void deactivate();
00086 double* retrieve_pair_block(int i, int j, tbint_type oper_type);
00088 void release_pair_block(int i, int j, tbint_type oper_type);
00090 bool is_local(int i, int j) const { return (ij_proc(i,j) == mem_->me());};
00092 bool is_avail(int i, int j) const { return true;};
00094 bool has_access(int proc) const { return true;};
00096 bool can_restart() const { return false; };
00097
00098
00099 int ij_index(int i, int j) const { return i*nj_ + j; };
00100 int ij_proc(int i, int j) const { return ij_index(i,j)%nproc_;};
00101 };
00102
00103 }
00104
00105 #endif
00106
00107
00108
00109
00110