<div dir="ltr"><div>Hi PETSc friends! </div><div><br></div><div>Hope you are all doing great.<br><br>With my time I am porting my code to gpu. This is a really instructive project but it comes with several headaches  as well.</div><div><br></div><div>I have some valuable questions you might be able to answer that would help me a lot understanding how things work in the modern world:</div><div><b><br></b></div><div><b>My goal: </b><br></div><div>Assembly loops are <i>do concurrent</i> compiled with nvfortran -stdpar=gpu, so my field/work arrays live in CUDA managed memory (cudaMallocManaged). The linear solve uses PETSc with MATAIJCUSPARSE + (intended) VECCUDA. PETSc 3.25.1 (git), built with NVHPC 24.11 / CUDA 12.6; targets cc61 and cc86 (no HMM),. Iwant the whole outer iteration to stay device-resident.</div><div><br>1) Managed pointer as a VECCUDA device array. Can I wrap a cudaMallocManaged pointer as the device array of a Vec via VecCreateMPICUDAWithArray (or VecCUDAPlaceArray)? Will the offload-mask logic treat managed memory coherently, or assume a distinct host array and issue redundant H2D/D2H copies? Recommended pattern for stdpar-managed + PETSc-CUDA interop?</div><div><br>2) On-device RHS fill / solution read. Icurrently use VecSetValues/VecGetValues against host arrays, which flips the mask to CPU every iteration. With VECCUDA, is the recommended replacement VecCUDAGetArrayWrite (RHS) and VecCUDAGetArray (solution)? Offload-mask pitfalls?</div><div><br>3) MatSetValuesCOO from device memory. Ipreallocate with MatSetPreallocationCOO and assemble with MatSetValuesCOO. For an AIJCUSPARSE matrix, may coo_v be a device/managed pointer? Memtype-aware contract, and from which version?</div><div><br>4) Vec type inference. If Iset only mat_type aijcusparse but leave the Vecs VECMPI, does KSP bounce the vectors each iteration, or promote them? Must I set vec_type cuda explicitly?<br><br></div><div>Happy to share the configure line and a minimal reproducer. </div><div><br></div><div>Mega Thanks!</div></div>