<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> When run with -log_view_gpu_time each event has two times: the time of kernel on the GPU (computed directly on the GPU using GPU timers) and the time of the CPU clock. The time on the CPU for the event always encloses the entire kernel (hence its time is always at least as large as the time of the kernel). Basically the CPU time in an event where all the action happens on the GPU is the time of kernel launch plus the time to run the kernel and confirm it is finished. So the GPU flop is the flop rate actually achieved on the GPU while the CPU flop rate is the effective flop rate the user is getting on the application.<div><br></div><div> <br><div><br><blockquote type="cite"><div>On Jan 26, 2024, at 6:48 AM, Anthony Jourdon <jourdon.anthon@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr"><div>Hello,</div><div><br></div><div>Thank you for your answers.<br></div><div>I am working with Dave May on this topic.<br></div><div><br></div><div>Still running
src/ksp/ksp/tutorials/ex34 with the same options reported by Dave, I added the option
-log_view_gpu_time.</div><div>Now the log provides gpu flop/s instead of nans.</div><div>However, I have trouble understanding the numbers reported in the log (file attached).<br></div><div><ol><li>The numbers reported for Total
Mflop/s
and
GPU Mflop/s are different even when 100% of the work is supposed to be done on the GPU.<br></li><li>The numbers reported for GPU Mflop/s are always higher than the numbers reported for Total
Mflop/s.</li></ol>As I understand, the Total Mflop/s should be the sum of both GPU and CPU flop/s, but if the gpu does 100% of the work, why are there different numbers reported by the GPU and Total flop/s columns and why the GPU flop/s are always higher than the Total flop/s ?</div><div>Or am I missing something?<br></div><div><br></div><div>Thank you for your attention.</div><div>Anthony Jourdon<br></div><div><br>
</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 20 janv. 2024 à 02:25, Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Nans indicate we do not have valid computational times for these operations; think of them as Not Available. Providing valid times for the "inner" operations listed with Nans requires inaccurate times (higher) for the outer operations, since extra synchronization between the CPU and GPU must be done to get valid times for the inner options. We opted to have the best valid times for the outer operations since those times reflect the time of the application.<br>
<br>
<br>
<br>
<br>
<br>
> On Jan 19, 2024, at 12:35 PM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>> wrote:<br>
> <br>
> Hi all,<br>
> <br>
> I am trying to understand the logging information associated with the %flops-performed-on-the-gpu reported by -log_view when running <br>
> src/ksp/ksp/tutorials/ex34<br>
> with the following options<br>
> -da_grid_x 192<br>
> -da_grid_y 192<br>
> -da_grid_z 192<br>
> -dm_mat_type seqaijhipsparse<br>
> -dm_vec_type seqhip<br>
> -ksp_max_it 10<br>
> -ksp_monitor<br>
> -ksp_type richardson<br>
> -ksp_view<br>
> -log_view<br>
> -mg_coarse_ksp_max_it 2<br>
> -mg_coarse_ksp_type richardson<br>
> -mg_coarse_pc_type none<br>
> -mg_levels_ksp_type richardson<br>
> -mg_levels_pc_type none<br>
> -options_left<br>
> -pc_mg_levels 3<br>
> -pc_mg_log<br>
> -pc_type mg<br>
> <br>
> This config is not intended to actually solve the problem, rather it is a stripped down set of options designed to understand what parts of the smoothers are being executed on the GPU.<br>
> <br>
> With respect to the log file attached, my first set of questions related to the data reported under "Event Stage 2: MG Apply".<br>
> <br>
> [1] Why is the log littered with nan's?<br>
> * I don't understand how and why "GPU Mflop/s" should be reported as nan when a value is given for "GPU %F" (see MatMult for example).<br>
> <br>
> * For events executed on the GPU, I assume the column "Time (sec)" relates to "CPU execute time", this would explain why we see a nan in "Time (sec)" for MatMult.<br>
> If my assumption is correct, how should I interpret the column "Flop (Max)" which is showing 1.92e+09? <br>
> I would assume of "Time (sec)" relates to the CPU then "Flop (Max)" should also relate to CPU and GPU flops would be logged in "GPU Mflop/s"<br>
> <br>
> [2] More curious is that within "Event Stage 2: MG Apply" KSPSolve, MGSmooth Level 0, MGSmooth Level 1, MGSmooth Level 2 all report "GPU %F" as 93. I believe this value should be 100 as the smoother (and coarse grid solver) are configured as richardson(2)+none and thus should run entirely on the GPU. <br>
> Furthermore, when one inspects all events listed under "Event Stage 2: MG Apply" those events which do flops correctly report "GPU %F" as 100. <br>
> And the events showing "GPU %F" = 0 such as <br>
> MatHIPSPARSCopyTo, VecCopy, VecSet, PCApply, DCtxSync<br>
> don't do any flops (on the CPU or GPU) - which is also correct (although non GPU events should show nan??)<br>
> <br>
> Hence I am wondering what is the explanation for the missing 7% from "GPU %F" for KSPSolve and MGSmooth {0,1,2}??<br>
> <br>
> Does anyone understand this -log_view, or can explain to me how to interpret it?<br>
> <br>
> It could simply be that:<br>
> a) something is messed up with -pc_mg_log<br>
> b) something is messed up with the PETSc build<br>
> c) I am putting too much faith in -log_view and should profile the code differently.<br>
> <br>
> Either way I'd really like to understand what is going on.<br>
> <br>
> <br>
> Cheers,<br>
> Dave<br>
> <br>
> <br>
> <br>
> <ex34_192_mg_seqhip_richardson_pcnone.o5748667><br>
<br>
</blockquote></div>
<span id="cid:f_lrukn4a70"><ex34_192_mg_seqhip_richardson_pcnone_gpulog.out></span></div></blockquote></div><br></div></body></html>