Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CuSPPartitioner.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2019, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
26 #ifndef _GALOIS_CUSP_
27 #define _GALOIS_CUSP_
28 
29 #include "galois/DistGalois.h"
33 
34 namespace galois {
39 };
40 
78 template <typename PartitionPolicy, typename NodeData = char,
79  typename EdgeData = void>
81 cuspPartitionGraph(std::string graphFile, CUSP_GRAPH_TYPE inputType,
82  CUSP_GRAPH_TYPE outputType, bool symmetricGraph = false,
83  std::string transposeGraphFile = "",
84  std::string masterBlockFile = "", bool cuspAsync = true,
85  uint32_t cuspStateRounds = 100,
88  uint32_t nodeWeight = 0, uint32_t edgeWeight = 0) {
90  using DistGraphConstructor =
92 
93  // TODO @todo bring back graph saving/reading functionality?
94 
95  if (!symmetricGraph) {
96  // out edges or in edges
97  std::string inputToUse;
98  // depending on output type may need to transpose edges
99  bool useTranspose;
100 
101  // see what input is specified
102  if (inputType == CUSP_CSR) {
103  inputToUse = graphFile;
104  if (outputType == CUSP_CSR) {
105  useTranspose = false;
106  } else if (outputType == CUSP_CSC) {
107  useTranspose = true;
108  } else {
109  GALOIS_DIE("CuSP output graph type is invalid");
110  }
111  } else if (inputType == CUSP_CSC) {
112  inputToUse = transposeGraphFile;
113  if (outputType == CUSP_CSR) {
114  useTranspose = true;
115  } else if (outputType == CUSP_CSC) {
116  useTranspose = false;
117  } else {
118  GALOIS_DIE("CuSP output graph type is invalid");
119  }
120  } else {
121  GALOIS_DIE("Invalid input graph type specified in CuSP partitioner");
122  }
123 
124  return new DistGraphConstructor(inputToUse, net.ID, net.Num, cuspAsync,
125  cuspStateRounds, useTranspose, readPolicy,
126  nodeWeight, edgeWeight, masterBlockFile);
127  } else {
128  // symmetric graph path: assume the passed in graphFile is a symmetric
129  // graph; output is also symmetric
130  return new DistGraphConstructor(graphFile, net.ID, net.Num, cuspAsync,
131  cuspStateRounds, false, readPolicy,
132  nodeWeight, edgeWeight, masterBlockFile);
133  }
134 }
135 } // end namespace galois
136 #endif
galois::graphs::DistGraph< NodeData, EdgeData > * cuspPartitionGraph(std::string graphFile, CUSP_GRAPH_TYPE inputType, CUSP_GRAPH_TYPE outputType, bool symmetricGraph=false, std::string transposeGraphFile="", std::string masterBlockFile="", bool cuspAsync=true, uint32_t cuspStateRounds=100, galois::graphs::MASTERS_DISTRIBUTION readPolicy=galois::graphs::BALANCED_EDGES_OF_MASTERS, uint32_t nodeWeight=0, uint32_t edgeWeight=0)
Main CuSP function: partitions a graph on disk, one partition per host.
Definition: CuSPPartitioner.h:81
#define GALOIS_DIE(...)
Definition: gIO.h:96
Contains the main graph class as well as the partitioning logic that CuSP uses.
MASTERS_DISTRIBUTION
Enums specifying how masters are to be distributed among hosts.
Definition: DistributedGraph.h:48
NetworkInterface & getSystemNetworkInterface()
Get the network interface.
Definition: Network.cpp:131
CUSP_GRAPH_TYPE
Enum for the input/output format of the partitioner.
Definition: CuSPPartitioner.h:36
Contains the implementation for DistGraph.
Compressed sparse column graph format, i.e. incoming edges.
Definition: CuSPPartitioner.h:38
Definition: NewGeneric.h:47
Contains the declaration of DistMemSys, a way to explicitly initiate the Galois runtime.
Compressed sparse row graph format, i.e. outgoing edges.
Definition: CuSPPartitioner.h:37
Base DistGraph class that all distributed graphs extend from.
Definition: DistributedGraph.h:64
balance edges
Definition: DistributedGraph.h:52