52 #include <boost/bind.hpp>
53 #include <boost/function.hpp>
82 std::cerr <<
"Usage: -o <string> -d <int> [file ...]\n"
83 <<
" -o <string> - output graph base filename (required)\n"
84 <<
" -d <int> - delegate threshold (Default is 1048576)\n"
85 <<
" -h - print help and exit\n"
86 <<
"[file ...] - list of edge list files to ingest\n\n";
90 void parse_cmd_line(
int argc,
char** argv, std::string& output_filename, uint64_t& delegate_threshold, std::vector< std::string >& input_filenames) {
92 std::cout <<
"CMD line:";
93 for (
int i=0; i<argc; ++i) {
94 std::cout <<
" " << argv[i];
96 std::cout << std::endl;
99 bool found_output_filename =
false;
100 delegate_threshold = 1048576;
101 input_filenames.clear();
104 bool prn_help =
false;
105 while ((c = getopt(argc, argv,
"o:d:h ")) != -1) {
111 delegate_threshold = atoll(optarg);
114 found_output_filename =
true;
115 output_filename = optarg;
118 std::cerr <<
"Unrecognized option: "<<c<<
", ignore."<<std::endl;
123 if (prn_help || !found_output_filename) {
128 for (
int index = optind; index < argc; index++) {
129 std::cout <<
"Input file = " << argv[index] << std::endl;
130 input_filenames.push_back(argv[index]);
135 int main(
int argc,
char** argv) {
137 int mpi_rank(0), mpi_size(0);
146 std::cout <<
"MPI initialized with " << mpi_size <<
" ranks." << std::endl;
151 std::string output_filename;
152 uint64_t delegate_threshold;
153 std::vector< std::string > input_filenames;
155 parse_cmd_line(argc, argv, output_filename, delegate_threshold, input_filenames);
158 std::cout <<
"Ingesting graph from " << input_filenames.size() <<
" files." << std::endl;
164 bip::allocator<void, segment_manager_t> alloc_inst(segment_manager);
171 std::cout <<
"Generating new graph." << std::endl;
175 (alloc_inst, MPI_COMM_WORLD, pelr, pelr.
max_vertex_id(), delegate_threshold);
180 std::cout <<
"Graph Ready, Calculating Stats. " << std::endl;
185 for (
int i = 0; i < mpi_size; i++) {
187 double percent = double(segment_manager->get_free_memory()) /
188 double(segment_manager->get_size());
189 std::cout <<
"[" << mpi_rank <<
"] " << segment_manager->get_free_memory()
190 <<
"/" << segment_manager->get_size() <<
" = " << percent << std::endl;
200 uint64_t max_degree(0);
202 max_degree = std::max(max_degree, graph->
degree(*citr));
210 std::cout <<
"Max Degree = " << global_max_degree << std::endl;
hmpi::delegate_partitioned_graph< segment_manager_t > graph_type
int main(int argc, char **argv)
uint64_t degree(vertex_locator locator) const
Returns the degree of a vertex.
void parse_cmd_line(int argc, char **argv, std::string &output_filename, uint64_t &delegate_threshold, std::vector< std::string > &input_filenames)
const communicator & world_comm() const
T mpi_all_reduce(T in_d, Op in_op, MPI_Comm mpi_comm)
controller_iterator controller_end() const
environment * havoqgt_env()
mapped_type::segment_manager segment_manager_type
segment_manager_type * get_segment_manager()
old_environment & get_environment()
controller_iterator controller_begin() const
void print_graph_statistics()
havoqgt::distributed_db::segment_manager_type segment_manager_t
void havoqgt_init(int *argc, char ***argv)