<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 12.10.2020 um 20:11 schrieb Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Mon, Oct 12, 2020 at 3:47 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" class="">patrick.sanan@gmail.com</a>> wrote:<br class=""></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;" class=""><div dir="auto" style="overflow-wrap: break-word;" class="">I have a toy application code built on PETSc which needs to compile and link a .cu file.<div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Okay, here is where the pkgconf file gets generated, and in fact where the language sections are</div><div class=""><br class=""></div><div class="">  <a href="https://gitlab.com/petsc/petsc/-/blob/master/config/PETSc/Configure.py#L161" class="">https://gitlab.com/petsc/petsc/-/blob/master/config/PETSc/Configure.py#L161</a></div><div class=""><br class=""></div><div class="">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></div></div></blockquote><div><br class=""></div>That's where I got stuck as well :D </div><div><br class=""></div><div>I can follow the pattern to get the compiler (CUDAC) and some of the flags, but that doesn't seem to have all the information that CUDAC, CUDAC_FLAGS, CUDA_INCLUDE, and CUDA_LIB provide in petscvariables.</div><div><br class=""></div><div>Naively I would assume I'd need to dig around to figure out how those variables are populated, and get the same info into petsc.pc</div><div><br class=""></div><div>But, I worry that I'm misunderstanding fundamentals about pkg-config and how it is supposed to work. Am I free to put whatever fields I want in there, or is there some authority on what's "standard"?</div><div><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""> </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;" class=""><div dir="auto" style="overflow-wrap: break-word;" class=""><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><div class="">include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class="">%.o : %.cu</div></div><div class=""><div class="">        $(CUDAC) -c $(CUDAC_FLAGS) $(CUDA_INCLUDE) -o $@ $<</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class="">app : ${OBJ}</div></div><div class=""><div class="">        $(<a href="http://link.cc/" target="_blank" class="">LINK.cc</a>) -o $@ $^ $(LDLIBS) $(CUDA_LIB)</div></div><div class=""><br class=""></div><div class=""><br class=""></div></blockquote></div><div dir="auto" style="overflow-wrap: break-word;" class=""><div dir="auto" style="overflow-wrap: break-word;" class="">Is it possible / easy / advisable to add CUDA support to petsc.pc ?</div></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</blockquote></div><br class=""></body></html>