<div dir="ltr"><div dir="ltr">On Mon, Oct 12, 2020 at 3:47 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com">patrick.sanan@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;">I have a toy application code built on PETSc which needs to compile and link a .cu file.<div><br></div><div>I'd love to be able to configure PETSc (with CUDA), and then use a modified version of share/petsc/Makefile.user to compile and link my code, using a consistent set of compilers, libraries, and flags.  Makefile.user uses petsc.pc (via pkg-config) and implicit GNU make rules to do almost everything for you for C, C++, and Fortran.</div><div><br></div><div>However, I don't think it currently supports CUDA, and I'm not familiar enough with BuildSystem or pkg-config to quickly add support myself, so I resort to the "old" way, including things like this in my Makefile:</div></div></div></blockquote><div><br></div><div>Okay, here is where the pkgconf file gets generated, and in fact where the language sections are</div><div><br></div><div>  <a href="https://gitlab.com/petsc/petsc/-/blob/master/config/PETSc/Configure.py#L161">https://gitlab.com/petsc/petsc/-/blob/master/config/PETSc/Configure.py#L161</a></div><div><br></div><div>I think you can just put a "CUDA" section in. I do not know what names to use, so I have not done it.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables</div></div><div><div><br></div></div><div><div>%.o : %.cu</div></div><div><div>        $(CUDAC) -c $(CUDAC_FLAGS) $(CUDA_INCLUDE) -o $@ $<</div></div><div><div><br></div></div><div><div>app : ${OBJ}</div></div><div><div>        $(<a href="http://LINK.cc" target="_blank">LINK.cc</a>) -o $@ $^ $(LDLIBS) $(CUDA_LIB)</div></div><div><br></div><div><br></div></blockquote></div><div dir="auto" style="overflow-wrap: break-word;"><div dir="auto" style="overflow-wrap: break-word;">Is it possible / easy / advisable to add CUDA support to petsc.pc ?</div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>