<div dir="ltr"><div dir="ltr">On Thu, Jan 20, 2022 at 6:44 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com">fdkong.jd@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 dir="ltr"><div>Thanks, Jed</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 20, 2022 at 4:34 PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.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">You can't create CUDA or Kokkos Vecs if you're running on a node without a GPU. </blockquote><div><br>I am running the code on compute nodes that do have GPUs.<br></div></div></div></blockquote><div><br></div><div>If you are actually running on GPUs, why would you need lazy initialization? It would not break with GPUs present.</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 dir="ltr"><div class="gmail_quote"><div>With PETSc-3.16.1, I got good speedup by running GAMG on GPUs. That might be a bug of PETSc-main.<br><br>Thanks,<br><br>Fande<br><br><br><br>KSPSetUp 13 1.0 6.4400e-01 1.0 2.02e+09 1.0 0.0e+00 0.0e+00 0.0e+00 0 5 0 0 0 0 5 0 0 0 3140 64630 15 1.05e+02 5 3.49e+01 100<br>KSPSolve 1 1.0 1.0109e+00 1.0 3.49e+10 1.0 0.0e+00 0.0e+00 0.0e+00 0 87 0 0 0 0 87 0 0 0 34522 69556 4 4.35e-03 1 2.38e-03 100<br>KSPGMRESOrthog 142 1.0 1.2674e-01 1.0 1.06e+10 1.0 0.0e+00 0.0e+00 0.0e+00 0 27 0 0 0 0 27 0 0 0 83755 87801 0 0.00e+00 0 0.00e+00 100<br>SNESSolve 1 1.0 4.4402e+01 1.0 4.00e+10 1.0 0.0e+00 0.0e+00 0.0e+00 21100 0 0 0 21100 0 0 0 901 51365 57 1.10e+03 52 8.78e+02 100<br>SNESSetUp 1 1.0 3.9101e-05 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br>SNESFunctionEval 2 1.0 1.7097e+01 1.0 1.60e+07 1.0 0.0e+00 0.0e+00 0.0e+00 8 0 0 0 0 8 0 0 0 0 1 0 0 0.00e+00 6 1.92e+02 0<br>SNESJacobianEval 1 1.0 1.6213e+01 1.0 2.80e+07 1.0 0.0e+00 0.0e+00 0.0e+00 8 0 0 0 0 8 0 0 0 0 2 0 0 0.00e+00 1 3.20e+01 0<br>SNESLineSearch 1 1.0 8.5582e+00 1.0 1.24e+08 1.0 0.0e+00 0.0e+00 0.0e+00 4 0 0 0 0 4 0 0 0 0 14 64153 1 3.20e+01 3 9.61e+01 94<br>PCGAMGGraph_AGG 5 1.0 3.0509e+00 1.0 8.19e+07 1.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 27 0 5 3.49e+01 9 7.43e+01 0<br>PCGAMGCoarse_AGG 5 1.0 3.8711e+00 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 2 0 0 0 0 2 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br>PCGAMGProl_AGG 5 1.0 7.0748e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br>PCGAMGPOpt_AGG 5 1.0 1.2904e+00 1.0 2.14e+09 1.0 0.0e+00 0.0e+00 0.0e+00 1 5 0 0 0 1 5 0 0 0 1661 29807 26 7.15e+02 20 2.90e+02 99<br>GAMG: createProl 5 1.0 8.9489e+00 1.0 2.22e+09 1.0 0.0e+00 0.0e+00 0.0e+00 4 6 0 0 0 4 6 0 0 0 249 29666 31 7.50e+02 29 3.64e+02 96<br> Graph 10 1.0 3.0478e+00 1.0 8.19e+07 1.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 27 0 5 3.49e+01 9 7.43e+01 0<br> MIS/Agg 5 1.0 4.1290e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br> SA: col data 5 1.0 1.9127e-02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br> SA: frmProl0 5 1.0 6.2662e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br> SA: smooth 5 1.0 4.9595e-01 1.0 1.21e+08 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 244 2709 15 1.97e+02 15 2.55e+02 90<br>GAMG: partLevel 5 1.0 4.7330e-01 1.0 6.98e+08 1.0 0.0e+00 0.0e+00 0.0e+00 0 2 0 0 0 0 2 0 0 0 1475 4120 5 1.78e+02 10 2.55e+02 100<br>PCGAMG Squ l00 1 1.0 2.6027e+00 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 1 0 0 0 0 1 0 0 0 0 0 0 0 0.00e+00 0 0.00e+00 0<br>PCGAMG Gal l00 1 1.0 3.8406e-01 1.0 5.48e+08 1.0 0.0e+00 0.0e+00 0.0e+00 0 1 0 0 0 0 1 0 0 0 1426 4270 1 1.48e+02 2 2.11e+02 100<br>PCGAMG Opt l00 1 1.0 2.4932e-01 1.0 7.20e+07 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 289 2653 1 6.41e+01 1 1.13e+02 100<br>PCGAMG Gal l01 1 1.0 6.6279e-02 1.0 1.09e+08 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 1645 3851 1 2.40e+01 2 3.64e+01 100<br>PCGAMG Opt l01 1 1.0 2.9544e-02 1.0 7.15e+06 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 242 1671 1 4.84e+00 1 1.23e+01 100<br>PCGAMG Gal l02 1 1.0 1.8874e-02 1.0 3.72e+07 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 1974 3636 1 5.04e+00 2 6.58e+00 100<br>PCGAMG Opt l02 1 1.0 7.4353e-03 1.0 2.40e+06 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 323 1457 1 7.71e-01 1 2.30e+00 100<br>PCGAMG Gal l03 1 1.0 2.8479e-03 1.0 4.10e+06 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 1440 2266 1 4.44e-01 2 5.51e-01 100<br>PCGAMG Opt l03 1 1.0 8.2684e-04 1.0 2.80e+05 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 339 1667 1 6.72e-02 1 2.03e-01 100<br>PCGAMG Gal l04 1 1.0 1.2238e-03 1.0 2.09e+05 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 170 244 1 2.05e-02 2 2.53e-02 100<br>PCGAMG Opt l04 1 1.0 4.1008e-04 1.0 1.77e+04 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 43 165 1 4.49e-03 1 1.19e-02 100<br>PCSetUp 2 1.0 9.9632e+00 1.0 4.95e+09 1.0 0.0e+00 0.0e+00 0.0e+00 5 12 0 0 0 5 12 0 0 0 496 17826 55 1.03e+03 45 6.54e+02 98<br>PCSetUpOnBlocks 44 1.0 9.9087e-04 1.0 2.88e+03 1.0<br><br>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><br></p><br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The point of lazy initialization is to make it possible to run a solve that doesn't use a GPU in PETSC_ARCH that supports GPUs, regardless of whether a GPU is actually present.<br>
<br>
Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> writes:<br>
<br>
> I spoke too soon. It seems that we have trouble creating cuda/kokkos vecs<br>
> now. Got Segmentation fault.<br>
><br>
> Thanks,<br>
><br>
> Fande<br>
><br>
> Program received signal SIGSEGV, Segmentation fault.<br>
> 0x00002aaab5558b11 in<br>
> Petsc::CUPMDevice<(Petsc::CUPMDeviceType)0>::CUPMDeviceInternal::initialize<br>
> (this=0x1) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/impls/cupm/cupmdevice.cxx:54<br>
> 54 PetscErrorCode CUPMDevice<T>::CUPMDeviceInternal::initialize() noexcept<br>
> Missing separate debuginfos, use: debuginfo-install<br>
> bzip2-libs-1.0.6-13.el7.x86_64 elfutils-libelf-0.176-5.el7.x86_64<br>
> elfutils-libs-0.176-5.el7.x86_64 glibc-2.17-325.el7_9.x86_64<br>
> libX11-1.6.7-4.el7_9.x86_64 libXau-1.0.8-2.1.el7.x86_64<br>
> libattr-2.4.46-13.el7.x86_64 libcap-2.22-11.el7.x86_64<br>
> libibmad-5.4.0.MLNX20190423.1d917ae-0.1.49224.x86_64<br>
> libibumad-43.1.1.MLNX20200211.078947f-0.1.49224.x86_64<br>
> libibverbs-41mlnx1-OFED.4.9.0.0.7.49224.x86_64<br>
> libmlx4-41mlnx1-OFED.4.7.3.0.3.49224.x86_64<br>
> libmlx5-41mlnx1-OFED.4.9.0.1.2.49224.x86_64 libnl3-3.2.28-4.el7.x86_64<br>
> librdmacm-41mlnx1-OFED.4.7.3.0.6.49224.x86_64<br>
> librxe-41mlnx1-OFED.4.4.2.4.6.49224.x86_64 libxcb-1.13-1.el7.x86_64<br>
> libxml2-2.9.1-6.el7_9.6.x86_64 numactl-libs-2.0.12-5.el7.x86_64<br>
> systemd-libs-219-78.el7_9.3.x86_64 xz-libs-5.2.2-1.el7.x86_64<br>
> zlib-1.2.7-19.el7_9.x86_64<br>
> (gdb) bt<br>
> #0 0x00002aaab5558b11 in<br>
> Petsc::CUPMDevice<(Petsc::CUPMDeviceType)0>::CUPMDeviceInternal::initialize<br>
> (this=0x1) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/impls/cupm/cupmdevice.cxx:54<br>
> #1 0x00002aaab5558db7 in<br>
> Petsc::CUPMDevice<(Petsc::CUPMDeviceType)0>::getDevice<br>
> (this=this@entry=0x2aaab7f37b70<br>
> <CUDADevice>, device=0x115da00, id=-35, id@entry=-1) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/impls/cupm/cupmdevice.cxx:344<br>
> #2 0x00002aaab55577de in PetscDeviceCreate (type=type@entry=PETSC_DEVICE_CUDA,<br>
> devid=devid@entry=-1, device=device@entry=0x2aaab7f37b48<br>
> <defaultDevices+8>) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/interface/device.cxx:107<br>
> #3 0x00002aaab5557b3a in PetscDeviceInitializeDefaultDevice_Internal<br>
> (type=type@entry=PETSC_DEVICE_CUDA, defaultDeviceId=defaultDeviceId@entry=-1)<br>
> at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/interface/device.cxx:273<br>
> #4 0x00002aaab5557bf6 in PetscDeviceInitialize<br>
> (type=type@entry=PETSC_DEVICE_CUDA)<br>
> at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/sys/objects/device/interface/device.cxx:234<br>
> #5 0x00002aaab5661fcd in VecCreate_SeqCUDA (V=0x115d150) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/impls/seq/seqcuda/veccuda.c:244<br>
> #6 0x00002aaab5649b40 in VecSetType (vec=vec@entry=0x115d150,<br>
> method=method@entry=0x2aaab70b45b8 "seqcuda") at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/interface/vecreg.c:93<br>
> #7 0x00002aaab579c33f in VecCreate_CUDA (v=0x115d150) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/impls/mpi/mpicuda/<br>
> <a href="http://mpicuda.cu:214" rel="noreferrer" target="_blank">mpicuda.cu:214</a><br>
> #8 0x00002aaab5649b40 in VecSetType (vec=vec@entry=0x115d150,<br>
> method=method@entry=0x7fffffff9260 "cuda") at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/interface/vecreg.c:93<br>
> #9 0x00002aaab5648bf1 in VecSetTypeFromOptions_Private (vec=0x115d150,<br>
> PetscOptionsObject=0x7fffffff9210) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/interface/vector.c:1263<br>
> #10 VecSetFromOptions (vec=0x115d150) at<br>
> /home/kongf/workhome/sawtooth/moosegpu/petsc/src/vec/vec/interface/vector.c:1297<br>
> #11 0x00002aaab02ef227 in libMesh::PetscVector<double>::init<br>
> (this=0x11cd1a0, n=441, n_local=441, fast=false, ptype=libMesh::PARALLEL)<br>
> at<br>
> /home/kongf/workhome/sawtooth/moosegpu/scripts/../libmesh/installed/include/libmesh/petsc_vector.h:693<br>
><br>
> On Thu, Jan 20, 2022 at 1:09 PM Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> wrote:<br>
><br>
>> Thanks, Jed,<br>
>><br>
>> This worked!<br>
>><br>
>> Fande<br>
>><br>
>> On Wed, Jan 19, 2022 at 11:03 PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br>
>><br>
>>> Fande Kong <<a href="mailto:fdkong.jd@gmail.com" target="_blank">fdkong.jd@gmail.com</a>> writes:<br>
>>><br>
>>> > On Wed, Jan 19, 2022 at 11:39 AM Jacob Faibussowitsch <<br>
>>> <a href="mailto:jacob.fai@gmail.com" target="_blank">jacob.fai@gmail.com</a>><br>
>>> > wrote:<br>
>>> ><br>
>>> >> Are you running on login nodes or compute nodes (I can’t seem to tell<br>
>>> from<br>
>>> >> the configure.log)?<br>
>>> >><br>
>>> ><br>
>>> > I was compiling codes on login nodes, and running codes on compute<br>
>>> nodes.<br>
>>> > Login nodes do not have GPUs, but compute nodes do have GPUs.<br>
>>> ><br>
>>> > Just to be clear, the same thing (code, machine) with PETSc-3.16.1<br>
>>> worked<br>
>>> > perfectly. I have this trouble with PETSc-main.<br>
>>><br>
>>> I assume you can<br>
>>><br>
>>> export PETSC_OPTIONS='-device_enable lazy'<br>
>>><br>
>>> and it'll work.<br>
>>><br>
>>> I think this should be the default. The main complaint is that timing the<br>
>>> first GPU-using event isn't accurate if it includes initialization, but I<br>
>>> think this is mostly hypothetical because you can't trust any timing that<br>
>>> doesn't preload in some form and the first GPU-using event will almost<br>
>>> always be something uninteresting so I think it will rarely lead to<br>
>>> confusion. Meanwhile, eager initialization is viscerally disruptive for<br>
>>> lots of people.<br>
>>><br>
>><br>
</blockquote></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>