Hi,<br> I cannot compiling a source file with petsc.h and cusp headers like the following:<br><br>#include"petsc.h"<br>#include<iostream><br>#include "cusp/csr_matrix.h"<br>#include <cusp/krylov/cg.h><br>
int main(void){<br> std::cout<<"Hello World!"<<std::endl;<br> return 0;<br>}<br><br>I use the following to compile it:<br><br>nvcc -m64 -O -arch=sm_13 -c --compiler-options="-Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O -I/home/guest/sgu1/softwares/petsc-dev/include -I/home/guest/sgu1/softwares/petsc-dev/helena-cxx-nompi-os64-release/include -I/usr/local/cuda/include -I/home/guest/sgu1/softwares/cusp-library/ -I/home/guest/sgu1/softwares/thrust/ -I/home/guest/sgu1/softwares/petsc-dev/include/mpiuni -DCUDA=1 -I/home/guest/sgu1/softwares/slepc-dev -I/home/guest/sgu1/softwares/slepc-dev/helena-cxx-nompi-os64-release/include -I/home/guest/sgu1/softwares/slepc-dev/include -I/home/guest/sgu1/softwares/ImageMagick-6.7.2/include/ImageMagick -D__INSDIR__= -I/home/guest/sgu1/softwares/slepc-dev -I/home/guest/sgu1/softwares/slepc-dev/helena-cxx-nompi-os64-release/include -I/home/guest/sgu1/softwares/slepc-dev/include" MyKspTmp4.cu -o MyKspTmp4.o<br>
<br>and it gives me error:<br>/usr/local/cuda/include/thrust/detail/device/cuda/detail/b40c/vector_types.h(37): error: expected an identifier<br><br>I think I did not do it in a correct way. I took a a look at some of petsc's .cu files, they usually include a long list of headers. Can petsc.h directly included in a source code with cusp headers? What's the correct way to do it? Does the makefile system in petsc provide the command or flags to do that? How can I obtain those flags? <br>
<br>And after I compile it and obtain .o files, can I use g++ to link the .o files with petcs libs and other .o files as usual, i.e.,<br> g++ -o $(BIN_DIR)/$@ $(CPPFLAGS) $@.s $(objects) $(PETSC_LIB) $(OTHERS)<br>or I need to do some extra steps and some specific linking flags to do that?<br>
Thanks. <br><br>Shiyuan <br><br><br><br>