Changeset 16132


Ignore:
Timestamp:
09/13/13 14:02:47 (11 years ago)
Author:
utke
Message:

CHG ensure contigous explicit calls are no longer needed here because
they are embedded in the xNew specialization; m should be ==n but I
changed it anyway; in order to update the adjoint of the matrix I need
first broadcast the original solution and the adjoint of the right hand
side because the matrix is assembled and therefore the individual matrix
partitions must be updated on the respective ranks; also to get the
matrix elements right we use the original values for the indices
in the iArr because the local_irn/local_jcn may be changed during the
factorization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp

    r16083 r16132  
    262262    packedDimsSparseArr[3+local_nnz+i]=jcn_loc[i];
    263263  }
    264   ensureContiguousLocations(local_nnz+n);
    265264  IssmDouble *pack_A_rhs=xNew<IssmDouble>(local_nnz+n);
    266265  for (int i=0;i<local_nnz;++i) {
     
    272271  IssmPDouble *passivePack_A_rhs=xNew<IssmPDouble>(local_nnz+n);
    273272  IssmPDouble *passiveSol=xNew<IssmPDouble>(n);
    274   ensureContiguousLocations(n);
    275273  IssmDouble *sol=xNew<IssmDouble>(n);
    276274  call_ext_fct(dynamic_cast<GenericParam<Adolc_edf> * >(parameters->FindParamObject(AdolcParamEnum))->GetParameterValue().myEDF_for_solverx_p,
     
    302300          local_irn[i]=iArr[3+i];
    303301          local_jcn[i]=iArr[3+local_nnz+i];
    304     a_loc[i]=dp_x[i];
     302          a_loc[i]=dp_x[i];
    305303  }
    306304  IssmPDouble *rhs_sol=xNew<IssmPDouble>(n);
     
    326324  MumpsFinalize(theMumpsStruc);
    327325  // update the adjoint of the rhs:
    328   for (int i=0;i<m;++i) {
     326  for (int i=0;i<n;++i) {
    329327    dp_Z[local_nnz+i]+=rhs_sol[i];
    330328  }
    331   // update the adjoint of the matrix:
     329  // bcast dp_y (the solution of the forward system)
     330  ISSM_MPI_Bcast(dp_y,n,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm());
     331  // bcast the adjoint of the right-hand-side, i.e. this solution
     332  ISSM_MPI_Bcast(rhs_sol,n,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm());
     333  // update the adjoint of the matrix with the outer product of right-hand-side adjoint and the original solution
    332334  for (int i=0;i<local_nnz;++i) {
    333     dp_Z[i]+=-dp_U[local_irn[i]-1]*dp_y[local_jcn[i]-1];
     335    dp_Z[i]-=rhs_sol[iArr[3+i]-1]*dp_y[iArr[3+local_nnz+i]-1];
    334336  }
    335337  xDelete(rhs_sol);
Note: See TracChangeset for help on using the changeset viewer.