COMBINATORIAL_BLAS
1.3
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
DistEdgeList.h
Go to the documentation of this file.
1
/****************************************************************/
2
/* Parallel Combinatorial BLAS Library (for Graph Computations) */
3
/* version 1.2 -------------------------------------------------*/
4
/* date: 10/06/2011 --------------------------------------------*/
5
/* authors: Aydin Buluc (abuluc@lbl.gov), Adam Lugowski --------*/
6
/****************************************************************/
7
/*
8
Copyright (c) 2011, Aydin Buluc
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
#ifndef _DIST_EDGE_LIST_H_
30
#define _DIST_EDGE_LIST_H_
31
32
#include <iostream>
33
#include <fstream>
34
#include <cmath>
35
#include <mpi.h>
36
#include <vector>
37
#include <iterator>
38
#include "
CombBLAS.h
"
39
#include "
SpMat.h
"
40
#include "
SpTuples.h
"
41
#include "
SpDCCols.h
"
42
#include "
CommGrid.h
"
43
#include "
MPIType.h
"
44
#include "
LocArr.h
"
45
#include "
SpDefs.h
"
46
#include "
Deleter.h
"
47
#include "
SpHelper.h
"
48
#include "
SpParHelper.h
"
49
#include "
DenseParMat.h
"
50
#include "
FullyDistVec.h
"
51
#include "
Friends.h
"
52
#include "
Operations.h
"
53
54
58
typedef
struct
packed_edge
{
59
uint32_t
v0_low
;
60
uint32_t
v1_low
;
61
uint32_t
high
;
/* v1 in high half, v0 in low half */
62
}
packed_edge
;
63
64
static
inline
int64_t
get_v0_from_edge(
const
packed_edge
* p) {
65
return
(p->
v0_low
| ((
int64_t
)((int16_t)(p->
high
& 0xFFFF)) << 32));
66
}
67
68
static
inline
int64_t
get_v1_from_edge(
const
packed_edge
* p) {
69
return
(p->
v1_low
| ((
int64_t
)((int16_t)(p->
high
>> 16)) << 32));
70
}
71
72
static
inline
void
write_edge(
packed_edge
* p,
int64_t
v0,
int64_t
v1) {
73
p->
v0_low
= (uint32_t)v0;
74
p->
v1_low
= (uint32_t)v1;
75
p->
high
= ((v0 >> 32) & 0xFFFF) | (((v1 >> 32) & 0xFFFF) << 16);
76
}
77
78
79
template
<
typename
IT>
80
class
DistEdgeList
81
{
82
public
:
83
// Constructors
84
DistEdgeList
();
85
DistEdgeList
(
const
char
* filename, IT globaln, IT globalm);
// read from binary in parallel
86
~DistEdgeList
();
87
88
void
Dump64bit
(
string
filename);
89
void
Dump32bit
(
string
filename);
90
void
GenGraph500Data
(
double
initiator[4],
int
log_numverts,
int
edgefactor
,
bool
scramble =
false
,
bool
packed=
false
);
91
void
CleanupEmpties
();
92
93
int64_t
getGlobalV
()
const
{
return
globalV; }
94
IT
getNumLocalEdges
()
const
{
return
nedges; }
95
96
private
:
97
shared_ptr<CommGrid> commGrid;
98
99
IT* edges;
// edge list composed of pairs of edge endpoints.
100
// Edge i goes from edges[2*i+0] to edges[2*i+1]
101
packed_edge
* pedges;
102
103
IT nedges;
// number of local edges
104
IT memedges;
// number of edges for which there is space. nedges <= memedges
105
int64_t
globalV;
106
107
void
SetMemSize(IT ne);
108
109
template
<
typename
IU>
110
friend
void
PermEdges
(
DistEdgeList<IU>
& DEL);
111
112
template
<
typename
IU>
113
friend
void
RenameVertices
(
DistEdgeList<IU>
& DEL);
114
115
template
<
class
IU,
class
NU,
class
UDER>
116
friend
class
SpParMat
;
117
};
118
119
template
<
typename
IU>
120
void
PermEdges
(
DistEdgeList<IU>
& DEL);
121
122
123
#include "
DistEdgeList.cpp
"
124
125
#endif
Generated on Wed Feb 6 2013 01:36:32 for COMBINATORIAL_BLAS by
1.8.1.1