COMBINATORIAL_BLAS
1.6
Loading...
Searching...
No Matches
OptBuf.h
Go to the documentation of this file.
1
/****************************************************************/
2
/* Parallel Combinatorial BLAS Library (for Graph Computations) */
3
/* version 1.6 -------------------------------------------------*/
4
/* date: 6/15/2017 ---------------------------------------------*/
5
/* authors: Ariful Azad, Aydin Buluc --------------------------*/
6
/****************************************************************/
7
/*
8
Copyright (c) 2010-2017, The Regents of the University of California
9
10
Permission is hereby granted, free of charge, to any person obtaining a copy
11
of this software and associated documentation files (the "Software"), to deal
12
in the Software without restriction, including without limitation the rights
13
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
copies of the Software, and to permit persons to whom the Software is
15
furnished to do so, subject to the following conditions:
16
17
The above copyright notice and this permission notice shall be included in
18
all copies or substantial portions of the Software.
19
20
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
THE SOFTWARE.
27
*/
28
29
30
#ifndef _OPT_BUF_H
31
#define _OPT_BUF_H
32
#include "
BitMap.h
"
33
34
namespace
combblas
{
35
42
template
<
class
IT,
class
NT>
43
class
OptBuf
44
{
45
public
:
46
OptBuf
():
isthere
(
NULL
),
p_c
(0),
totmax
(0),
localm
(0) {};
47
void
MarkEmpty
()
48
{
49
if
(
totmax
> 0)
50
{
51
isthere
->
reset
();
52
}
53
}
54
55
void
Set
(
const
std::vector<int> &
maxsizes
,
int
mA
)
56
{
57
p_c
=
maxsizes
.size();
58
totmax
= std::accumulate(
maxsizes
.begin(),
maxsizes
.end(), 0);
59
inds
=
new
IT
[
totmax
];
60
std::fill_n(
inds
,
totmax
, -1);
61
nums
=
new
NT
[
totmax
];
62
dspls
=
new
int
[
p_c
]();
63
std::partial_sum(
maxsizes
.begin(),
maxsizes
.end()-1,
dspls
+1);
64
localm
=
mA
;
65
66
isthere
=
new
BitMap
(
localm
);
67
};
68
~OptBuf
()
69
{
if
(
localm
> 0)
70
{
71
delete
isthere
;
72
}
73
74
if
(
totmax
> 0)
75
{
76
delete
[]
inds
;
77
delete
[]
nums
;
78
}
79
if
(
p_c
> 0)
80
delete
[]
dspls
;
81
}
82
OptBuf
(
const
OptBuf<IT,NT>
&
rhs
)
83
{
84
p_c
=
rhs
.p_c;
85
totmax
=
rhs
.totmax;
86
localm
=
rhs
.localm;
87
inds
=
new
IT
[
totmax
];
88
nums
=
new
NT
[
totmax
];
89
dspls
=
new
int
[
p_c
]();
90
isthere
=
new
BitMap
(
localm
);
91
}
92
OptBuf<IT,NT>
&
operator=
(
const
OptBuf<IT,NT>
&
rhs
)
93
{
94
if
(
this
!= &
rhs
)
95
{
96
if
(
localm
> 0)
97
{
98
delete
isthere
;
99
}
100
if
(
totmax
> 0)
101
{
102
delete
[]
inds
;
103
delete
[]
nums
;
104
}
105
if
(
p_c
> 0)
106
delete
[]
dspls
;
107
108
p_c
=
rhs
.p_c;
109
totmax
=
rhs
.totmax;
110
localm
=
rhs
.localm;
111
inds
=
new
IT
[
totmax
];
112
nums
=
new
NT
[
totmax
];
113
dspls
=
new
int
[
p_c
]();
114
isthere
=
new
BitMap
(*(
rhs
.isthere));
115
}
116
return
*
this
;
117
}
118
119
IT
*
inds
;
120
NT
*
nums
;
121
int
*
dspls
;
122
BitMap
*
isthere
;
123
int
p_c
;
124
int
totmax
;
125
int
localm
;
126
};
127
128
}
129
130
#endif
131
IT
int64_t IT
Definition
BlockedSpGEMM.cpp:9
NT
double NT
Definition
BlockedSpGEMM.cpp:10
combblas::BitMap
Definition
BitMap.h:40
combblas::BitMap::reset
void reset()
Definition
BitMap.h:79
combblas::DistEdgeList
Definition
DistEdgeList.h:82
combblas::OptBuf::~OptBuf
~OptBuf()
Definition
OptBuf.h:68
combblas::OptBuf::p_c
int p_c
Definition
OptBuf.h:123
combblas::OptBuf::localm
int localm
Definition
OptBuf.h:125
combblas::OptBuf::isthere
BitMap * isthere
Definition
OptBuf.h:122
combblas::OptBuf::OptBuf
OptBuf(const OptBuf< IT, NT > &rhs)
Definition
OptBuf.h:82
combblas::OptBuf::MarkEmpty
void MarkEmpty()
Definition
OptBuf.h:47
combblas::OptBuf::totmax
int totmax
Definition
OptBuf.h:124
combblas::OptBuf::inds
IT * inds
Definition
OptBuf.h:119
combblas::OptBuf::dspls
int * dspls
Definition
OptBuf.h:121
combblas::OptBuf::operator=
OptBuf< IT, NT > & operator=(const OptBuf< IT, NT > &rhs)
Definition
OptBuf.h:92
combblas::OptBuf::nums
NT * nums
Definition
OptBuf.h:120
combblas::OptBuf::Set
void Set(const std::vector< int > &maxsizes, int mA)
Definition
OptBuf.h:55
combblas::OptBuf::OptBuf
OptBuf()
Definition
OptBuf.h:46
BitMap.h
combblas
Definition
CCGrid.h:4
include
CombBLAS
OptBuf.h
Generated by
1.9.8