[petsc-users] compiling petsc.h and cusp's headers

Shiyuan gshy2014 at gmail.com
Wed Oct 5 16:15:20 CDT 2011


balay at bb30:~/ex>cat ex1.cu
> #include "petsc.h"
> #undef VecType
>
> #include<iostream>
> #include <cusp/krylov/cg.h>
>
> int main(int argc,char **argv)
> {
>  PetscErrorCode ierr;
>  ierr = PetscInitialize(&argc,&argv,(char *)0,(char*)0);CHKERRQ(ierr);
>   std::cout<<"Hello World!"<<std::endl;
>   ierr = PetscFinalize();
>  return 0;
> }
>
>
That almost works except that petsc.h doesn't include all
definitions/declarations.  I have a function which cannot be compiled by
just adding petsc.h with errors like:
error: identifier "CUSPARRAY" is undefined
error: identifier "Mat_SeqAIJ" is undefined
error: identifier "Mat_SeqAIJCUSP" is undefined
ect.
But it can be compiled if I add the following in addition to petsc.h

PETSC_CUDA_EXTERN_C_BEGIN
#include "../src/mat/impls/aij/seq/aij.h"          /*I "petscmat.h" I*/
#include "petscbt.h"
#include "../src/vec/vec/impls/dvecimpl.h"
#include "private/vecimpl.h"
PETSC_CUDA_EXTERN_C_END
#undef VecType
#include "../src/mat/impls/aij/seq/seqcusp/cuspmatimpl.h"

What's the minimal set of headers I can add to petsc.h such that I can call
alll petsc functions and use all petsc type?
Thanks.


Shiyuan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111005/b42125c8/attachment.htm>


More information about the petsc-users mailing list