614{
615
616
617
618
619
622
623 int n_newpivots = -1;
624 std::atomic<long> n_zero_reductions = 0;
625
626 mtbb::tick_count t0;
627 mtbb::tick_count t1;
628 std::vector<int> spair_rows;
629
631 {
632 n_newpivots =
hilbert->nRemainingExpected();
633 if (n_newpivots == 0)
634 {
635 std::cout << "Oh crap, our logic is wrong: should not get here if no new GB elements expected in this degree" << std::endl;
636 return;
637 }
638 }
639
640 for (int i = 0; i < nrows; ++i)
641 {
643 spair_rows.push_back(i);
644 }
645
646 t0 = mtbb::tick_count::now();
647
648#if defined(WITH_TBB)
649
650 std::mutex cout_guard;
651 using threadLocalDense_t = mtbb::enumerable_thread_specific<ElementArray>;
652
653 threadLocalDense_t threadLocalDense([&]() {
655 });
656
658
659 std::cout << "Number of Threads Used: " << mNumThreads << std::endl;
660 }
661
662 mScheduler.execute([&] {
663 mtbb::parallel_for(mtbb::blocked_range<int>{0,
INTSIZE(spair_rows)},
664 [&](const mtbb::blocked_range<int>& r)
665 {
666
667
668
669
670
671
672
673
674
675
676
677 threadLocalDense_t::reference my_dense = threadLocalDense.local();
678 for (auto i = r.begin(); i != r.end(); ++i)
679 {
681 }
682 });
683 });
684 for (auto tlDense : threadLocalDense)
686
687#else
688
690
691 for (
int i = 0; i <
INTSIZE(spair_rows); ++i)
693
695
696#endif
697
698 t1 = mtbb::tick_count::now();
700
702 std::cout << "About to do serial loop, n_newpivots = " << n_newpivots << std::endl;
703 t0 = mtbb::tick_count::now();
705 for (auto i = 0; i < spair_rows.size(); i++)
706 {
707 auto this_row = spair_rows[i];
708 if ((not
hilbert) or (n_newpivots > 0))
709 {
711 if (newNonzeroReduction)
712 {
713 row_elem &r =
mat->rows[this_row];
715 mat->columns[r.
comps[0]].head = this_row;
717 }
718 else
719 ++n_zero_reductions;
721 {
722
723
724 row_elem &r =
mat->rows[this_row];
726 }
727 }
729 t1 = mtbb::tick_count::now();
731
733 fprintf(stderr, "-- #zeroreductions %ld\n", n_zero_reductions.load());
734
735 t0 = mtbb::tick_count::now();
737 t1 = mtbb::tick_count::now();
739}
HilbertController * hilbert
bool is_pivot_row(int index) const
double mParallelGaussTime
const VectorArithmetic * mVectorArithmetic
bool gauss_reduce_row(int index, ElementArray &gauss_row)
double seconds(DurationType time_diff)