Skip to content

Commit

Permalink
Don't complete Q_bb on all processes
Browse files Browse the repository at this point in the history
  • Loading branch information
mricherzhagen committed Jul 23, 2014
1 parent c23f7d1 commit 3ecc14f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions psmo/psmo_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,15 +923,15 @@ void Solver_Parallel_SMO::Solve(int l, const QMatrix& Q, const double *b_,
MPI_Type_commit(&tr);


MPI_Allgather(MPI_IN_PLACE, 1, t, Q_bb, 1, tr, comm);
MPI_Gather(rank == 0 ? MPI_IN_PLACE : Q_bb + rank*n, 1, t, Q_bb, 1, tr, 0, comm);
if (n%size != 0) {
int *displ = new int[size];
int *cnt = new int[size];
for (int i = 0; i < size; ++i) {
displ[i] = i*n;
cnt[i] = i < n%size ? n : 0;
}
MPI_Allgatherv(MPI_IN_PLACE,cnt[rank],Qmpitype,&Q_bb[n*(n-(n%size))],cnt,displ,Qmpitype,comm);
MPI_Gatherv(rank == 0 ? MPI_IN_PLACE : Q_bb + n*(n-(n%size)) + rank*n,cnt[rank],Qmpitype,&Q_bb[n*(n-(n%size))],cnt,displ,Qmpitype,0, comm);
delete[] displ;
delete[] cnt;
}
Expand All @@ -948,15 +948,15 @@ void Solver_Parallel_SMO::Solve(int l, const QMatrix& Q, const double *b_,
CheckError(ierr);
num_elements += (n_up[k]-n_low[k])*n;
}*/
//TODO: Do all processes need to create the full Q_bb?
// Complete symmetric Q
for(int i=0; i<n; ++i)
{
for(int j=0; j<i; ++j)
Q_bb[j*n+i] = Q_bb[i*n+j];
QD_b[i] = Q_bb[i*n+i];
}
if (rank == 0) {
for(int i=0; i<n; ++i)
{
for(int j=0; j<i; ++j)
Q_bb[j*n+i] = Q_bb[i*n+j];
QD_b[i] = Q_bb[i*n+i];
}

for(int i=0; i<n; ++i)
{
c[i] = G[work_set[i]];
Expand Down

0 comments on commit 3ecc14f

Please sign in to comment.