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_mpiiofile_h
00029 #define _chemistry_qc_mbptr12_r12ia_mpiiofile_h
00030
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034
00035 #define MPICH_SKIP_MPICXX
00036 #include <mpi.h>
00037 #include <util/ref/ref.h>
00038 #include <util/group/memory.h>
00039 #include <chemistry/qc/mbptr12/r12ia.h>
00040
00041 namespace sc {
00042
00044
00045
00046
00047
00048
00049
00050
00051
00052 class R12IntsAcc_MPIIOFile: public R12IntsAcc {
00053
00054 protected:
00055 Ref<MemoryGrp> mem_;
00056 int nproc_;
00057 size_t nints_per_block_;
00058 char *filename_;
00059 MPI_File datafile_;
00060
00061 struct PairBlkInfo {
00062 double* ints_[max_num_te_types_];
00063 int refcount_[max_num_te_types_];
00064 MPI_Offset offset_;
00065 } *pairblk_;
00066
00068 void check_error_code_(int errcod) const;
00069
00070 void init(bool restart);
00071
00073 int ntasks() const { return mem_->n(); }
00075 int taskid() const { return mem_->me(); }
00076
00077 public:
00078 R12IntsAcc_MPIIOFile(Ref<MemoryGrp>& mem, const char *filename, int num_te_types,
00079 int ni, int nj, int nx, int ny);
00080 R12IntsAcc_MPIIOFile(StateIn&);
00081 ~R12IntsAcc_MPIIOFile();
00082 void save_data_state(StateOut&);
00083
00085 void store_pair_block(int i, int j, double *ints);
00088 void commit();
00090 void activate();
00093 void deactivate();
00095 void release_pair_block(int i, int j, tbint_type oper_type);
00097 bool is_local(int i, int j) const { return true;};
00099 bool is_avail(int i, int j) const { return true;};
00101 bool has_access(int proc) const { return true;};
00103 bool can_restart() const { return true; };
00104
00105
00106 int ij_index(int i, int j) const { return i*nj_ + j; };
00107 };
00108
00110
00111
00112
00113
00114
00115
00116
00117 class R12IntsAcc_MPIIOFile_Ind: public R12IntsAcc_MPIIOFile {
00118
00119 public:
00120 R12IntsAcc_MPIIOFile_Ind(Ref<MemoryGrp>& mem, const char *filename, int num_te_types,
00121 int ni, int nj, int nx, int ny);
00122 R12IntsAcc_MPIIOFile_Ind(StateIn&);
00123 ~R12IntsAcc_MPIIOFile_Ind();
00124 void save_data_state(StateOut&);
00125
00134 void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize = 0);
00136 double* retrieve_pair_block(int i, int j, tbint_type oper_type);
00137 };
00138
00139 }
00140
00141 #endif
00142
00143
00144
00145
00146