//-------------------------------------------------------- // output //-------------------------------------------------------- void ChargeRegulatorMethod::output(OUTPUT_LIST & outputData) { //vector<double> localSum(sum_.size()); //lammpsInteface_->allsum(localSum.pointer,sum_.pointer,sum_.size()); DENS_VEC localSum(sum_.size()); lammpsInterface_->allsum(localSum.ptr(),sum_.ptr(),sum_.size()); for (int i = 0; i < sum_.size(); i++) { string name = "charge_regulator_influence_"+to_string(i); // atc_->fe_engine()->add_global(name,sum_[i]); } }
void test(const char c, int threadsCount) { ans = 0; std::vector<std::thread*> threads; std::vector<int> localSum(threadsCount, 0); std::chrono::time_point<std::chrono::system_clock> start, end; if (c == 'f'){ Futex f; start = std::chrono::system_clock::now(); for(int i = 0; i < threadsCount; ++i){ threads.push_back(new std::thread (name, std::ref(localSum[i]), std::ref(f))); } for(int i = 0; i < threadsCount; ++i){ threads[i] -> join(); } end = std::chrono::system_clock::now(); std::cout << c << ' ' << threadsCount << '\n'; for(int i = 0; i < threadsCount; ++i){ delete threads[i]; std::cout << localSum[i] << ' '; } double l = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() / static_cast<double>(1000); std::cout << '\n' << ans <<'\n' << std::accumulate(localSum.begin(), localSum.end(), 0) << "\nTime: " << l << "\n\n"; }else{ std::mutex m; start = std::chrono::system_clock::now(); for(int i = 0; i < threadsCount; ++i){ threads.push_back(new std::thread (nameM, std::ref(localSum[i]), std::ref(m))); } for(int i = 0; i < threadsCount; ++i){ threads[i] -> join(); } end = std::chrono::system_clock::now(); std::cout << c << ' ' << threadsCount << '\n'; for(int i = 0; i < threadsCount; ++i){ delete threads[i]; std::cout << localSum[i] << ' '; } double l = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() / static_cast<double>(1000); std::cout << '\n' << ans <<'\n' << std::accumulate(localSum.begin(), localSum.end(), 0) << "\nTime: " << l << "\n\n"; } }
void GBitset::pageStart(vector<vector<int> > &INFase, vector<vector<int> > &INGilb, vector<vector<int> > &Buf1, vector<vector<int> > &Buf2, vector<int> &LFase, vector<int> &LGilb, float &Alpha){ TIME_START DM(END); localSum(INFase,INGilb,Buf1,Buf2);DM("localSum "); TIME_PRINT CalculatAmplitude(INFase,INGilb); DM("CalculatAmplitude "); TIME_PRINT deltaSlice(INFase,INGilb); DM("deltaSlice "); TIME_PRINT matExpDispers(INFase,INGilb,LFase,LGilb); DM("matExpDispers "); TIME_PRINT }//_____________________________________________________________________________