MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
distarray4_memgrp.h
1//
2// distarray4_memgrp.h
3//
4// Copyright (C) 2002 Edward Valeev
5//
6// Author: Edward Valeev <evaleev@vt.edu>
7// Maintainer: EV
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_qc_mbptr12_distarray4_memgrp_h
29#define _chemistry_qc_mbptr12_distarray4_memgrp_h
30
31#include <util/ref/ref.h>
32#include <util/group/memory.h>
33#include <math/distarray4/distarray4.h>
34
35namespace sc {
36
38
47
48 Ref<MemoryGrp> mem_;
50 size_t blksize_memgrp_;
51
54 struct PairBlkInfo {
55 const double *ints_[max_num_te_types]; // blocks corresponding to each operator type
56 mutable int refcount_[max_num_te_types]; // counts references
57 distsize_t offset_; // global Memgrp offset in bytes
58 } *pairblk_;
59
61 void init();
62 // Utility functions
63 int ij_proc(int i, int j) const { return ij_index(i,j)%ntasks();};
64
65 public:
67 int ni, int nj, int nx, int ny,
68 size_t memorygrp_blksize,
69 DistArray4Storage storage = DistArray4Storage_XY);
73
74 Ref<DistArray4> clone(const DistArray4Dimensions& dim = DistArray4Dimensions::default_dim());
75
76 // Implementation of DistArray4_MemoryGrp::deactivate)_
77 void deactivate();
78 // Implementation of DistArray4::data_persistent()
79 bool data_persistent() const { return false; }
80
81 void store_pair_block(int i, int j, tbint_type oper_type, const double *ints);
82 void store_pair_subblock(int i, int j, tbint_type oper_type,
83 int xstart, int xfence, int ystart, int yfence,
84 const double* ints);
85 const double* retrieve_pair_block(int i, int j, tbint_type oper_type,
86 double* buf = 0) const;
87 void retrieve_pair_subblock(int i, int j, tbint_type oper_type,
88 int xstart, int xfence, int ystart, int yfence,
89 double* buf) const;
91 void release_pair_block(int i, int j, tbint_type oper_type) const;
92
94 bool is_local(int i, int j) const { return (ij_proc(i,j) == mem_->me());};
96 bool is_avail(int i, int j) const { return true;};
98 bool has_access(int proc) const { return true;};
99
100};
101
102}
103
104#endif
105
106// Local Variables:
107// mode: c++
108// c-file-style: "CLJ"
109// End:
DistArray4_MemoryGrp handles transformed integrals held in memory by MemoryGrp.
Definition distarray4_memgrp.h:46
void deactivate()
call this after operations on this object are finished. May destroy data (see data_persistent()).
bool has_access(int proc) const
Does this task have access to all the integrals?
Definition distarray4_memgrp.h:98
const double * retrieve_pair_block(int i, int j, tbint_type oper_type, double *buf=0) const
Retrieves an ij block of integrals.
bool data_persistent() const
if this returns false, call to deactivate may destroy data
Definition distarray4_memgrp.h:79
bool is_avail(int i, int j) const
In this implementation all blocks are globally available.
Definition distarray4_memgrp.h:96
void store_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, const double *ints)
Stores an rectangular subblock of ij block of integrals.
Ref< DistArray4 > clone(const DistArray4Dimensions &dim=DistArray4Dimensions::default_dim())
how to clone.
void release_pair_block(int i, int j, tbint_type oper_type) const
Releases an ij pair block of integrals (if needed)
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
bool is_local(int i, int j) const
Is this block stored locally?
Definition distarray4_memgrp.h:94
void store_pair_block(int i, int j, tbint_type oper_type, const double *ints)
Stores an ij pair block of integrals.
void retrieve_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, double *buf) const
Retrieves a rectangular subblock of ij block of integrals.
DistArray4 contains a set of one or more distributed dense 4-index arrays.
Definition distarray4.h:94
const DistArray4Storage & storage() const
physical storage of the integrals. The default storage is XY. Storage is not mutable.
Definition distarray4.h:122
int ntasks() const
total number of tasks
Definition distarray4.h:198
int nj() const
Rank of index space j.
Definition distarray4.h:116
int ny() const
Rank of index space y.
Definition distarray4.h:120
unsigned int tbint_type
Types of two-body operators that DistArray4 understands.
Definition distarray4.h:108
int nx() const
Rank of index space x.
Definition distarray4.h:118
int ni() const
Rank of index space i.
Definition distarray4.h:114
int num_te_types() const
The number of types of integrals that are being handled together.
Definition distarray4.h:112
A template class that maintains references counts.
Definition ref.h:361
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Definition distarray4.h:43

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.