[petsc-users] PETSC_VERSION_LT

Jed Brown jedbrown at mcs.anl.gov
Wed Feb 6 18:49:24 CST 2013


On Wed, Feb 6, 2013 at 3:41 PM, Mark F. Adams <mark.adams at columbia.edu>wrote:

> I'm running with v3.3.00 and have this in my code:
>
> #ifdef PETSC_VERSION_LT(3,3,0)
>

You need #if PETSC_VERSION_LT(3,3,0), not #ifdef (the macro is always
defined, it just might be zero).

Note that this macro was only put in just before petsc-3.3, so if you want
to support versions older than 3.3, you'll need something like

#if !defined(PETSC_VERSION_LT)
#  define PETSC_VERSION_LT(major,minor,subminor) ...
#endif



>     call MatCreateMPIAIJ( comm, PETSC_DECIDE, PETSC_DECIDE, nnodes,
> nnodes, &
>          maxn1, PETSC_NULL_INTEGER, maxn1/2, PETSC_NULL_INTEGER, &
>          AA, ierr )
> #else
>     call MatCreateAIJ( comm, PETSC_DECIDE, PETSC_DECIDE, nnodes, nnodes, &
>          maxn1, PETSC_NULL_INTEGER, maxn1/2, PETSC_NULL_INTEGER, &
>          AA, ierr )
> #endif
>
>
> and I get errors like:
>
> /autofs/na1_home/adams/XGC1/XGC1_3/./module.F95:1189: undefined reference
> to `matcreatempiaij_'
> /autofs/na1_home/adams/XGC1/XGC1_3/./module.F95:1215: undefined reference
> to `matcreatempiaij_'
> /autofs/na1_home/adams/XGC1/XGC1_3/./module.F95:1235: undefined reference
> to `matcreatempiaij_'
>
>
> Am I not using this correctly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130206/341c41eb/attachment.html>


More information about the petsc-users mailing list