[petsc-dev] Log_summary truncation behavior for long function names

Barry Smith bsmith at mcs.anl.gov
Tue Aug 4 17:15:00 CDT 2015


  Patrick,

   Yeah, Karl doesn't know there is a tight limit on the length of the strings one can pass in to register so he passed in strings that are too long.

   Perhaps Karl could shorten from ViennaCL to VCL? 

  Barry

  Of course the code should tell Karl that he passed in too long a string with a very helpful error message



> On Aug 3, 2015, at 6:40 AM, Patrick Sanan <patrick.sanan at gmail.com> wrote:
> 
> If long function names (here some related to ViennaCL) are included in the log summary output, the behavior seems wrong, in that the name of the function is truncated, but not to the approriate width (16 characters) .
> 
> VecAXPBYCZ            10 1.0 4.1723e-05 1.0 5.00e+02 1.0 0.0e+00 0.0e+00 0.0e+00  0 12  0  0  0   0 12  0  0  0    12
> VecMAXPY              11 1.0 4.6968e-05 1.0 1.30e+03 1.0 0.0e+00 0.0e+00 0.0e+00  0 32  0  0  0   0 32  0  0  0    28
> VecNormalize          11 1.0 1.6165e-04 1.0 2.89e+02 1.0 0.0e+00 0.0e+00 0.0e+00  0  7  0  0  0   0  7  0  0  0     2
> VecViennaCLCopyTo      21 1.0 9.5387e-03 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 11  0  0  0  0  11  0  0  0  0     0
> VecViennaCLCopyFrom      21 1.0 3.7766e-04 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
> MatMult               21 1.0 1.4230e-02 1.0 5.88e+02 1.0 0.0e+00 0.0e+00 0.0e+00 16 14  0  0  0  16 14  0  0  0     0
> MatAssemblyBegin       1 1.0 9.5367e-07 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
> MatAssemblyEnd         1 1.0 7.1199e-02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 79  0  0  0  0  79  0  0  0  0     0
> MatView                1 1.0 1.0228e-04 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
> MatViennaCLCopyTo       1 1.0 7.1182e-02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 79  0  0  0  0  79  0  0  0  0     0
> KSPGMRESOrthog        10 1.0 1.5831e-04 1.0 2.14e+03 1.0 0.0e+00 0.0e+00 0.0e+00  0 52  0  0  0   0 52  0  0  0    14
> KSPSetUp               2 1.0 1.3590e-04 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
> 
> I hacked my local copy to just truncate the names when outputting, as below, but perhaps there is a more elegant way to fix this related to the names of the Log events themselves (I don't know where in the code the names are truncated to begin with).
> 
> 
> --- a/src/sys/logging/plog.c
> +++ b/src/sys/logging/plog.c
> @@ -1473,7 +1473,7 @@ PetscErrorCode  PetscLogView_Default(PetscViewer viewer)
>        if (numMessages   != 0.0) avgMessLen     = messLen/numMessages;    else avgMessLen     = 0.0;
>        if (messageLength != 0.0) fracLength     = messLen/messageLength;  else fracLength     = 0.0;
>        if (numReductions != 0.0) fracReductions = red/numReductions;      else fracReductions = 0.0;
> -      ierr = PetscFPrintf(comm, fd, "%2d: %15s: %6.4e %5.1f%%  %6.4e %5.1f%%  %5.3e %5.1f%%  %5.3e      %5.1f%%  %5.3e %5.1f%% \n",
> +      ierr = PetscFPrintf(comm, fd, "%2d: %15.15s: %6.4e %5.1f%%  %6.4e %5.1f%%  %5.3e %5.1f%%  %5.3e      %5.1f%%  %5.3e %5.1f%% \n",
>                            stage, name, stageTime/size, 100.0*fracTime, flops, 100.0*fracFlops,
>                            mess, 100.0*fracMessages, avgMessLen, 100.0*fracLength, red, 100.0*fracReductions);CHKERRQ(ierr);
>      }
> @@ -1619,7 +1619,7 @@ PetscErrorCode  PetscLogView_Default(PetscViewer viewer)
>          if (maxt          != 0.0) flopr            = totf/maxt;                  else flopr            = 0.0;
>          if (fracStageTime > 1.00)  ierr = PetscFPrintf(comm, fd,"Warning -- total time of even greater than time of entire stage -- something is wro
>          ierr = PetscFPrintf(comm, fd,
> -          "%-16s %7d%4.1f %5.4e%4.1f %3.2e%4.1f %2.1e %2.1e %2.1e%3.0f%3.0f%3.0f%3.0f%3.0f %3.0f%3.0f%3.0f%3.0f%3.0f %5.0f\n",
> +          "%-16.16s %7d%4.1f %5.4e%4.1f %3.2e%4.1f %2.1e %2.1e %2.1e%3.0f%3.0f%3.0f%3.0f%3.0f %3.0f%3.0f%3.0f%3.0f%3.0f %5.0f\n",
>                              name, maxCt, ratCt, maxt, ratt, maxf, ratf, totm, totml, totr,
>                              100.0*fracTime, 100.0*fracFlops, 100.0*fracMess, 100.0*fracMessLen, 100.0*fracRed,
>                              100.0*fracStageTime, 100.0*fracStageFlops, 100.0*fracStageMess, 100.0*fracStageMessLen, 100.0*fracStageRed,
> 




More information about the petsc-dev mailing list