Ticket #50958: graph_blockmodel.hh.patch
File graph_blockmodel.hh.patch, 2.7 KB (added by essandess (Steve Smith), 9 years ago) |
---|
-
./graph_blockmodel.hh
old new 2638 2638 vector<int64_t>& vlist, vector<int64_t>& block_list, 2639 2639 bool deg_corr, bool dense, bool multigraph, double beta, 2640 2640 Eprop eweight, Vprop vweight, Graph& g, bool sequential, 2641 bool parallel , bool random_move, double c, size_t nmerges,2641 bool parallel_enabled, bool random_move, double c, size_t nmerges, 2642 2642 Vprop merge_map, size_t niter, size_t B, bool verbose, RNG& rng, 2643 2643 double& S, size_t& nmoves) 2644 2644 { 2645 2645 typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; 2646 2646 2647 2647 if (vlist.size() < 100) 2648 parallel = false;2648 parallel_enabled = false; 2649 2649 2650 2650 nmoves = 0; 2651 2651 S = 0; 2652 2652 2653 2653 vector<rng_t*> rngs; 2654 2654 size_t num_threads = 1; 2655 if (parallel )2655 if (parallel_enabled) 2656 2656 { 2657 2657 #ifdef USING_OPENMP 2658 2658 num_threads = omp_get_max_threads(); … … 2690 2690 // used only if merging 2691 2691 gt_hash_set<vertex_t> past_moves; 2692 2692 vector<pair<vertex_t, double> > best_move; 2693 if (nmerges > 0 || parallel )2693 if (nmerges > 0 || parallel_enabled) 2694 2694 best_move.resize(num_vertices(g), make_pair(vertex_t(0), numeric_limits<double>::max())); 2695 2695 2696 2696 std::uniform_int_distribution<size_t> s_rand(0, block_list.size() - 1); … … 2699 2699 2700 2700 for (size_t iter = 0; iter < niter; ++iter) 2701 2701 { 2702 if (nmerges == 0 && !parallel )2702 if (nmerges == 0 && !parallel_enabled) 2703 2703 std::shuffle(vlist.begin(), vlist.end(), rng); 2704 2704 2705 2705 int i = 0, N = vlist.size(); 2706 2706 #pragma omp parallel for default(shared) private(i) \ 2707 2707 firstprivate(past_moves, m_entries) \ 2708 schedule(runtime) if (parallel )2708 schedule(runtime) if (parallel_enabled) 2709 2709 for (i = 0; i < N; ++i) 2710 2710 { 2711 2711 size_t tid = 0; 2712 if (parallel )2712 if (parallel_enabled) 2713 2713 { 2714 2714 #ifdef USING_OPENMP 2715 2715 tid = omp_get_thread_num(); … … 2862 2862 2863 2863 if (accept) 2864 2864 { 2865 if (!parallel )2865 if (!parallel_enabled) 2866 2866 { 2867 2867 assert(b[v] == int(r)); 2868 2868 move_vertex(v, s, b, cv, vmap, deg_corr, states, … … 2884 2884 } 2885 2885 } 2886 2886 2887 if (parallel && (nmerges == 0))2887 if (parallel_enabled && (nmerges == 0)) 2888 2888 { 2889 2889 for (vertex_t v : vlist) 2890 2890 { … … 2910 2910 } 2911 2911 } 2912 2912 2913 if (parallel && (nmerges == 0))2913 if (parallel_enabled && (nmerges == 0)) 2914 2914 { 2915 2915 for (auto r : rngs) 2916 2916 delete r;