Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omp loop fix #235

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/utils/ComplexFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,6 @@
rotatedCoeffVec.push_back(std::move(rotatedCoeff));
}
}

} else { // MPI case

// TODO? rotate in bank, so that we do not get and put. Requires clever handling of splits.
Expand Down Expand Up @@ -1602,7 +1601,6 @@
}
}
}

IntVector conjMat = IntVector::Zero(N);
for (int i = 0; i < N; i++) {
if (!mrcpp::mpi::my_orb(BraKet[i])) continue;
Expand Down Expand Up @@ -1736,7 +1734,8 @@
int totget = 0;
int mxtotsiz = 0;
int ibank = 0;
#pragma omp parallel for schedule(dynamic) if (serial)
//For some unknown reason the h2_mag_lda test sometimes fails when schedule(dynamic) is chosen
#pragma omp parallel for schedule(static) if (serial)
for (int n = 0; n < max_n; n++) {
if (n % mrcpp::mpi::wrk_size != mrcpp::mpi::wrk_rank) continue;
int csize;
Expand Down Expand Up @@ -1781,7 +1780,6 @@
}
}
}

} else {

DoubleMatrix coeffBlockBra(csize, 2 * N);
Expand Down Expand Up @@ -1833,12 +1831,6 @@

mrcpp::mpi::allreduce_matrix(S, mrcpp::mpi::comm_wrk);

conjMatKet[0] = totsiz;
conjMatKet[1] = mxtotsiz;
conjMatKet[2] = totget;

mrcpp::mpi::allreduce_vector(conjMatKet, mrcpp::mpi::comm_wrk);

return S;
}

Expand Down Expand Up @@ -1991,7 +1983,6 @@

// Assumes linearity: result is sum of all nodes contributions
mrcpp::mpi::allreduce_matrix(S, mrcpp::mpi::comm_wrk);

return S;
}

Expand All @@ -2005,7 +1996,7 @@
int M = Ket.size();
DoubleVector Ketnorms = DoubleVector::Zero(M);
for (int i = 0; i < M; i++) {
Ketnorms(i) = Ket[i].squaredNorm();
if (mpi::my_orb(Ket[i])) Ketnorms(i) = Ket[i].squaredNorm();

Check warning on line 1999 in src/utils/ComplexFunction.cpp

View check run for this annotation

Codecov / codecov/patch

src/utils/ComplexFunction.cpp#L1999

Added line #L1999 was not covered by tests
}
mrcpp::mpi::allreduce_vector(Ketnorms, mrcpp::mpi::comm_wrk);
ComplexMatrix rmat = ComplexMatrix::Zero(M, N);
Expand Down
Loading