[petsc-dev] What is this even supposed to do?

Jed Brown jed at 59A2.org
Wed Sep 8 04:14:15 CDT 2010


"to" is uninitialized here, it can't possibly work.

PetscErrorCode PETSCMAP1(VecScatterBegin)(VecScatter ctx,Vec xin,Vec yin,InsertMode addv,ScatterMode mode)
{
  VecScatter_MPI_General *to,*from;
  PetscScalar            *xv,*yv,*svalues;
  MPI_Request            *rwaits,*swaits;
  PetscErrorCode         ierr;
  PetscInt               i,*indices,*sstarts,nrecvs,nsends,bs;

  PetscFunctionBegin;
#if defined(PETSC_HAVE_CUDA)
  if (xin->valid_GPU_array == PETSC_CUDA_GPU) {
    if (!ctx->spptr) {
      PetscInt *indices,n = to->n; 
      ierr = PetscMalloc(n*sizeof(PetscInt),&indices);CHKERRQ(ierr);
      ierr = PetscMemcpy(indices,to->indices,n*sizeof(PetscInt));CHKERRQ(ierr);
      ierr = PetscSortRemoveDupsInt(&n,indices);CHKERRQ(ierr);
     
      ierr = PetscIntView(n,indices,0);CHKERRQ(ierr);

      ierr = PetscFree(indices);CHKERRQ(ierr);
    }
  } else {
    ierr = VecGetArrayRead(xin,(const PetscScalar**)&xv);CHKERRQ(ierr);
  }
#else
  ierr = VecGetArrayRead(xin,(const PetscScalar**)&xv);CHKERRQ(ierr);
#endif



The PETSC_HAVE_CUDA block was added by

  changeset:   16792:571800d0bf67
  parent:      16784:e7052ddd3def
  user:        Barry Smith bsmith at mcs.anl.gov
  date:        Mon Aug 23 18:37:40 2010 -0500
  summary:     better message in check of positive definite shift for ILU

With commit messages like these...


This can probably just get relocated to later in the function (after
"to" is resolved), but I hear that CUDA works (I'm fighting with a
broken CUDA environment at the moment), in which case this branch must
never be taken, so it should just be deleted.

Jed



More information about the petsc-dev mailing list