<div dir="ltr"><div>Thanks for the reply! I've tried that and again it doesn't seem to work for the kokkos files. I went a bit overboard and set every variable I could find but it doesn't seem to change the kokkos compilation, despite some of those flags definitely being present in the kokkos compile targets.</div><div><br></div><div><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:9.6px;line-height:12px;white-space:pre"><div><span style="color:rgb(156,220,254)">CPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">FPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">CPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">CXXPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">CXXCPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">CUDAC_FLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">HIPC_FLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">SYCLC_FLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">PETSC_CXXCPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">PETSC_CCPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">PETSC_FCPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">PETSC_CUDACPPFLAGS</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(156,220,254)">MPICXX_INCLUDES</span><span style="color:rgb(204,204,204)"> = </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">INCLUDE</span><span style="color:rgb(206,145,120)">)</span></div><br><div><span style="color:rgb(106,153,85)"># Read in the petsc compile/linking variables and makefile rules</span></div><div><span style="color:rgb(197,134,192)">include</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">${</span><span style="color:rgb(156,220,254)">PETSC_DIR</span><span style="color:rgb(206,145,120)">}</span><span style="color:rgb(204,204,204)">/lib/petsc/conf/variables</span></div><div><span style="color:rgb(197,134,192)">include</span><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">${</span><span style="color:rgb(156,220,254)">PETSC_DIR</span><span style="color:rgb(206,145,120)">}</span><span style="color:rgb(204,204,204)">/lib/petsc/conf/rules</span></div></div></div><div><br></div><div>The strangest thing is if I echo the value of PETSC_KOKKOSCOMPILE_SINGLE before building, it seems to have the correct flags in it. <br></div><div><br></div><div><div style="color:rgb(204,204,204);background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:9.6px;line-height:12px;white-space:pre"><div><span style="color:rgb(106,153,85)"># Build the tests</span></div><div><span style="color:rgb(220,220,170)">build_tests</span><span style="color:rgb(204,204,204)">: </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">OUT</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(204,204,204)"> echo </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">PETSC_KOKKOSCOMPILE_SINGLE</span><span style="color:rgb(206,145,120)">)</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(197,134,192)">@</span><span style="color:rgb(204,204,204)">for t in </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(156,220,254)">TEST_TARGETS</span><span style="color:rgb(206,145,120)">)</span><span style="color:rgb(204,204,204)">; do </span><span style="color:rgb(215,186,125)">\</span></div><div><span style="color:rgb(204,204,204)"> </span><span style="color:rgb(206,145,120)">$(</span><span style="color:rgb(86,156,214)">MAKE</span><span style="color:rgb(206,145,120)">)</span><span style="color:rgb(204,204,204)"> -C tests </span><span style="color:rgb(86,156,214)">$$</span><span style="color:rgb(204,204,204)">t; </span><span style="color:rgb(215,186,125)">\</span></div><div><span style="color:rgb(204,204,204)"> done</span></div></div></div><div><br></div><div>for example the echo gives (where I've bolded the flags I need added):</div><div><br></div><div>mpicxx -o .o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -g -O0 -std=gnu++17 -fPIC <b>-I/home/sdargavi/projects/PFLARE -Iinclude</b></div><div><b><br></b></div><div>but the actual command that is called when the build is happening is (which doesn't have the includes I need):</div><div><br></div><div>mpicxx -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -g -O0 -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-psabi -fstack-protector -g -O0 -std=gnu++17 -fPIC -I/home/sdargavi/projects/dependencies/petsc-3.22.0/include -I/home/sdargavi/projects/dependencies/petsc-3.22.0/arch-linux-c-debug/include adv_1dk.kokkos.cxx -L/home/sdargavi/projects/PFLARE/lib -lpflare -Wl,-rpath,/home/sdargavi/projects/PFLARE/lib:-Wl,-rpath,/home/sdargavi/projects/dependencies/petsc-3.22.0/arch-linux-c-debug/lib -L/home/sdargavi/projects/dependencies/petsc-3.22.0/arch-linux-c-debug/lib -Wl,-rpath,/usr/lib/x86_64-linux-gnu/openmpi/lib/fortran/gfortran -L/usr/lib/x86_64-linux-gnu/openmpi/lib/fortran/gfortran -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11 -lpetsc -lkokkoskernels -lkokkoscontainers -lkokkoscore -lkokkossimd -lflapack -lfblas -lparmetis -lmetis -lm -lX11 -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lopen-rte -lopen-pal -lhwloc -levent_core -levent_pthreads -lgfortran -lm -lz -lgfortran -lm -lgfortran -lgcc_s -lquadmath -lstdc++ -lquadmath -o adv_1dk</div><div><br></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, 20 Feb 2025 at 00:32, Satish Balay <<a href="mailto:balay.anl@fastmail.org">balay.anl@fastmail.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Try setting CPPFLAGS, FPPFLAGS, CXXPPFLAGS [and not via PETSC_FC_INCLUDES].<br>
<br>
I think kokkos compile targets [for *.kokkos.cxx sources] should pick up one of them. <br>
<br>
for ex:<br>
<br>
>>><br>
CPPFLAGS = -Wall<br>
FPPFLAGS = -Wall<br>
CXXPPFLAGS = -Wall<br>
<br>
include ${PETSC_DIR}/lib/petsc/conf/variables<br>
include ${PETSC_DIR}/lib/petsc/conf/rules<br>
<br>
...<br>
<<<<br>
<br>
Satish<br>
<br>
On Wed, 19 Feb 2025, Steven Dargaville wrote:<br>
<br>
> Hi<br>
> <br>
> I'm trying to build my application code (which includes C and Fortran<br>
> files) with a Makefile based off $PETSC_DIR/share/petsc/Makefile.basic.user<br>
> by using the variables and rules defined in<br>
> ${PETSC_DIR}/lib/petsc/conf/variables. My application uses petsc as well as<br>
> another library, and hence I have to add some extra include statements<br>
> pointing at the other library during compilation. Currently I have been<br>
> doing:<br>
> <br>
> # Read in the petsc compile/linking variables and makefile rules<br>
> include ${PETSC_DIR}/lib/petsc/conf/variables<br>
> include ${PETSC_DIR}/lib/petsc/conf/rules<br>
> <br>
> # Add the extra include files<br>
> PETSC_FC_INCLUDES += $(INCLUDE_OTHER_LIB)<br>
> PETSC_CC_INCLUDES += $(INCLUDE_OTHER_LIB)<br>
> <br>
> <br>
> which works very well, with the correct include flags from<br>
> INCLUDE_OTHER_LIBS being added to the compilation of both fortran and C<br>
> files.<br>
> <br>
> If however I try and compile a kokkos file, named adv_1dk.kokkos.cxx (by<br>
> calling "make adv_1dk"), the extra flags are not included. If I instead<br>
> call "make adv_1dk.kokkos", the rule for cxx files is instead triggered and<br>
> correctly includes the include flags, but this just calls the c++ wrapper,<br>
> rather than the nvcc_wrapper and therefore breaks when kokkos has been<br>
> built with cuda (or hip, etc).<br>
> <br>
> Just wondering if there is something I have missed, from what I can tell<br>
> the kokkos rules don't use the PETSC_CC_INCLUDES during compilation.<br>
> <br>
> Thanks for all your help<br>
> Steven<br>
> <br>
<br>
</blockquote></div>