61 double budget_bytes = 2.0e9)
66 for (
const Eigen::MatrixXd* m :
targets_) {
67 bytes += double(m->size()) * double(
sizeof(
double));
70 nthreads > 1 && double(nthreads - 1) * bytes <= budget_bytes;
74 copies_.resize(std::size_t(nthreads));
78 locks_.resize(std::size_t(n));
79 for (omp_lock_t& l : locks_) {
102 const std::vector<const Eigen::MatrixXd*>& small) {
107 for (
Index k = 0; k < n; ++k) {
108 if (small[std::size_t(k)]->size() > 0) {
110 *small[std::size_t(k)]);
116#pragma omp critical(votca_xtp_gridboxaccumulator)
118 for (
Index k = 0; k < n; ++k) {
119 if (small[std::size_t(k)]->size() > 0) {
121 *small[std::size_t(k)]);
127 std::vector<Eigen::MatrixXd>& mine =
copies_[std::size_t(tid)];
129 mine.reserve(std::size_t(n));
130 for (
const Eigen::MatrixXd* m :
targets_) {
131 mine.push_back(Eigen::MatrixXd::Zero(m->rows(), m->cols()));
134 for (
Index k = 0; k < n; ++k) {
135 if (small[std::size_t(k)]->size() > 0) {
142 if (!locks_.empty()) {
143 for (
Index j = 0; j < n; ++j) {
144 const Index k = (j + tid) % n;
145 if (small[std::size_t(k)]->size() == 0) {
148 omp_set_lock(&locks_[std::size_t(k)]);
150 omp_unset_lock(&locks_[std::size_t(k)]);
155 for (
Index k = 0; k < n; ++k) {
156 if (small[std::size_t(k)]->size() > 0) {