[petsc-dev] behavior of PetscDefined(PETSC_HAVE_CUDA)

Barry Smith bsmith at petsc.dev
Thu Oct 15 23:43:36 CDT 2020


  Could it error if the input starts with PETS_ to prevent inadvertent mistakes hanging around for years?


> On Oct 15, 2020, at 10:39 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> 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