HavoqGT
run_triangle_count.cpp File Reference
#include <havoqgt/page_rank.hpp>
#include <havoqgt/environment.hpp>
#include <havoqgt/cache_utilities.hpp>
#include <havoqgt/rmat_edge_generator.hpp>
#include <havoqgt/triangle_count.hpp>
#include <havoqgt/delegate_partitioned_graph.hpp>
#include <havoqgt/upper_triangle_edge_generator.hpp>
#include <havoqgt/gen_preferential_attachment_edge_list.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <havoqgt/distributed_db.hpp>
#include <assert.h>
#include <deque>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <boost/interprocess/managed_heap_memory.hpp>
Include dependency graph for run_triangle_count.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 78 of file run_triangle_count.cpp.

78  {
81 
82  int mpi_rank(0), mpi_size(0);
83 
84  havoqgt::havoqgt_init(&argc, &argv);
85  {
86  CHK_MPI(MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank));
87  CHK_MPI(MPI_Comm_size(MPI_COMM_WORLD, &mpi_size));
89 
90  if (mpi_rank == 0) {
91  std::cout << "MPI initialized with " << mpi_size << " ranks." << std::endl;
92  std::cout << "CMD line:";
93  for (int i = 0; i < argc; ++i) {
94  std::cout << " " << argv[i];
95  }
96  std::cout << std::endl;
98  //print_system_info(false);
99  }
100  MPI_Barrier(MPI_COMM_WORLD);
101 
102 
103  std::string graph_input;
104 
105  if (argc < 2) {
106  std::cerr << "usage: <graph input file name>"
107  << " (argc:" << argc << " )." << std::endl;
108  exit(-1);
109  } else {
110  int pos = 1;
111  graph_input = argv[pos++];
112  }
113 
114 
115  MPI_Barrier(MPI_COMM_WORLD);
116 
117  havoqgt::distributed_db ddb(havoqgt::db_open(), graph_input.c_str());
118 
119  graph_type *graph = ddb.get_segment_manager()->
120  find<graph_type>("graph_obj").first;
121  assert(graph != nullptr);
122 
123  MPI_Barrier(MPI_COMM_WORLD);
124  if (mpi_rank == 0) {
125  std::cout << "Graph Loaded Ready." << std::endl;
126  }
127  //graph->print_graph_statistics();
128  MPI_Barrier(MPI_COMM_WORLD);
129 
130  for(int i=0; i<100; ++i) {
131  uint64_t count = triangle_count(*graph, graph->label_to_locator(i));
132  if(mpi_rank == 0) {
133  std::cout << "Vertex " << i << " has " << count << " triangles." << std::endl;
134  }
135  }
136 
137  } // END Main MPI
139 
140  return 0;
141 }
hmpi::delegate_partitioned_graph< segment_manager_t > graph_type
void havoqgt_finalize()
mapped_type::segment_manager segment_manager_type
segment_manager_type * get_segment_manager()
old_environment & get_environment()
uint64_t triangle_count(TGraph &g, typename TGraph::vertex_locator s)
#define CHK_MPI(a)
Definition: mpi.hpp:68
havoqgt::distributed_db::segment_manager_type segment_manager_t
void havoqgt_init(int *argc, char ***argv)

Here is the call graph for this function: