[petsc-dev] behavior of PetscDefined(PETSC_HAVE_CUDA)

Jed Brown jed at jedbrown.org
Thu Oct 15 22:39:37 CDT 2020


Mark Adams <mfadams at lbl.gov> writes:

> I have:
>
> #if defined(PETSC_HAVE_CUDA)
>   ierr = PetscInfo3(pc,"PETSC_HAVE_CUDA ---------------------Test:
> factor=%D. cuda=%D
> level=%D\n",pc_gamg->level_reduction_factors[pc_gamg->current_level],
> *PetscDefined(PETSC_HAVE_CUDA)*,pc_gamg->current_level);CHKERRQ(ierr);
> #endif
>
> and see:
>
> [0] PCGAMGCreateLevel_GAMG(): PETSC_HAVE_CUDA ---------------------Test:
> factor=2.* cuda=0* level=0
>
> So PETSC_HAVE_CUDA is defined yet PetscDefined(PETSC_HAVE_CUDA) is 0. Am I
> missing something?

The syntax is PetscDefined(HAVE_CUDA).  This is explained by way of example in the man page, but perhaps it should be explicitly repeated.

https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscDefined.html


More information about the petsc-dev mailing list