52 #include <boost/bind.hpp>
53 #include <boost/function.hpp>
80 std::cerr <<
"Usage: -s <int> -d <int> -o <string>\n"
81 <<
" -s <int> - RMAT graph Scale (default 17)\n"
82 <<
" -d <int> - delegate threshold (Default is 1048576)\n"
83 <<
" -o <string> - output graph base filename\n"
84 <<
" -h - print help and exit\n\n";
89 void parse_cmd_line(
int argc,
char** argv, uint64_t& scale, uint64_t& delegate_threshold, std::string& output_filename) {
91 std::cout <<
"CMD line:";
92 for (
int i=0; i<argc; ++i) {
93 std::cout <<
" " << argv[i];
95 std::cout << std::endl;
98 bool found_output_filename =
false;
100 delegate_threshold = 1048576;
103 bool prn_help =
false;
104 while ((c = getopt(argc, argv,
"s:d:o:h ")) != -1) {
110 scale = atoll(optarg);
113 delegate_threshold = atoll(optarg);
116 found_output_filename =
true;
117 output_filename = optarg;
120 std::cerr <<
"Unrecognized option: "<<c<<
", ignore."<<std::endl;
125 if (prn_help || !found_output_filename) {
131 int main(
int argc,
char** argv) {
137 int mpi_rank(0), mpi_size(0);
147 std::cout <<
"MPI initialized with " << mpi_size <<
" ranks." << std::endl;
152 uint64_t num_vertices = 1;
154 uint64_t hub_threshold;
155 std::string fname_output;
157 parse_cmd_line(argc, argv, vert_scale, hub_threshold, fname_output);
159 num_vertices <<= vert_scale;
161 std::cout <<
"Building Graph500"<< std::endl
162 <<
"Building graph Scale: " << vert_scale << std::endl
163 <<
"Hub threshold = " << hub_threshold << std::endl
164 <<
"File name = " << fname_output << std::endl;
170 bip::allocator<void, segment_manager_t> alloc_inst(segment_manager);
173 uint64_t num_edges_per_rank = num_vertices * 16 / mpi_size;
175 vert_scale, num_edges_per_rank,
176 0.57, 0.19, 0.19, 0.05,
true,
true);
180 std::cout <<
"Generating new graph." << std::endl;
182 graph_type *graph = segment_manager->construct<graph_type>
184 (alloc_inst, MPI_COMM_WORLD, rmat, rmat.
max_vertex_id(), hub_threshold);
189 std::cout <<
"Graph Ready, Calculating Stats. " << std::endl;
194 for (
int i = 0; i < mpi_size; i++) {
196 double percent = double(segment_manager->get_free_memory()) /
197 double(segment_manager->get_size());
198 std::cout <<
"[" << mpi_rank <<
"] " << segment_manager->get_free_memory()
199 <<
"/" << segment_manager->get_size() <<
" = " << percent << std::endl;
209 uint64_t max_degree(0);
211 max_degree = std::max(max_degree, graph->
degree(*citr));
219 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.
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 parse_cmd_line(int argc, char **argv, uint64_t &scale, uint64_t &delegate_threshold, std::string &output_filename)
void print_graph_statistics()
havoqgt::distributed_db::segment_manager_type segment_manager_t
void havoqgt_init(int *argc, char ***argv)