<div dir="ltr"><div dir="ltr">On Mon, Oct 12, 2020 at 3:03 PM 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;"><br><div><br><blockquote type="cite"><div>Am 12.10.2020 um 20:11 schrieb Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:</div><br><div><div dir="ltr"><div dir="ltr">On Mon, Oct 12, 2020 at 3:47 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" target="_blank">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><div dir="auto">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" target="_blank">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></div></div></blockquote><div><br></div>That's where I got stuck as well :D </div><div><br></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></blockquote><div><br></div><div>I can dig around and find all these for you.</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>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></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"><div dir="ltr"><div class="gmail_quote"><div></div></div></div></blockquote></div></div></blockquote><div>I do not understand anything about pkg-config (and think it is a fundamentally misguided mechanism). Jed, how should CUDA work with this?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt </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><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><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><div dir="auto"><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"><div dir="auto">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"><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>
</blockquote></div><br></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>