[petsc-dev] What is this even supposed to do?
Barry Smith
bsmith at mcs.anl.gov
Wed Sep 8 08:26:21 CDT 2010
On Sep 8, 2010, at 4:14 AM, Jed Brown wrote:
> "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...
Sorry, my fault. It is because I don't have a decent hg commit tool that tells me what I changed so I can comment on it.
Yes that code is currently broken, I started in and then got distracted and didn't finish it. You can just stick it inside a #if defined(foo) for now.
Barry
>
>
> 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