For years I’ve been getting VTK errors while running pvbatch via mpiexec. The errors don’t seem to have any impact as I am able to read in my OpenFOAM cases and generate all the desired images/videos.
But, the VTK output really pollutes stdErr. It’s difficult to see real errors detected in my scripts vs. the verbose output from vtk.
Is there anyway to silence this? I can’t just direct stderr to /dev/null, because inside my scripts there are real error checks (inside python script) that I need to log. I just want to get rid of the vtk stuff. Any ideas on how to do that?
So far I have tried this, but it had no impact:
> import vtk
> a = vtk.vtkOutputWindow()
> a.GlobalWarningDisplayOff()
Below is an example of this vtk output, it repeats once for each core, so for CFD cases with 500 cores, these logs become really hard to parse.
> ERROR: In /home/buildslave/dashboards/buildbot/paraview-pvbinsdash-linux-shared-release_superbuild/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, line 408
> vtkShaderProgram (0x8220580): 1: #version 150
> 2: #ifdef GL_ES
> 3: #if __VERSION__ == 300
> 4: #define attribute in
> 5: #define varying out
> 6: #endif // 300
> 7: #else // GL_ES
> 8: #define highp
> 9: #define mediump
> 10: #define lowp
> 11: #if __VERSION__ == 150
> 12: #define attribute in
> 13: #define varying out
> 14: #endif
> 15: #endif // GL_ES
> 16:
> 17:
> 18: /*=========================================================================
> 19:
> 20: Program: Visualization Toolkit
> 21: Module: vtkPolyDataVS.glsl
> 22:
> 23: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
> 24: All rights reserved.
> 25: See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
> 26:
> 27: This software is distributed WITHOUT ANY WARRANTY; without even
> 28: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> 29: PURPOSE. See the above copyright notice for more information.
> 30:
> 31: =========================================================================*/
> 32:
> 33: attribute vec4 vertexMC;
> 34:
> 35: // frag position in VC
> 36: //VTK::PositionVC::Dec
> 37:
> 38: // optional normal declaration
> 39: //VTK::Normal::Dec
> 40:
> 41: // extra lighting parameters
> 42: //VTK::Light::Dec
> 43:
> 44: // Texture coordinates
> 45: attribute vec3 vecsMC;
> 46: varying vec3 tcoordVCVSOutput;
> 47:
> 48:
> 49: // material property values
> 50: attribute vec4 scalarColor;
> 51: varying vec4 vertexColorVSOutput;
> 52:
> 53: // clipping plane vars
> 54: //VTK::Clip::Dec
> 55:
> 56: // camera and actor matrix values
> 57: uniform mat4 MCDCMatrix;
> 58:
> 59: // Apple Bug
> 60: //VTK::PrimID::Dec
> 61:
> 62: // Value raster
> 63: //VTK::ValuePass::Dec
> 64:
> 65: void main()
> 66: {
> 67: vertexColorVSOutput = scalarColor;
> 68:
> 69: //VTK::Normal::Impl
> 70:
> 71: tcoordVCVSOutput = vecsMC;
> 72:
> 73: //VTK::Clip::Impl
> 74:
> 75: //VTK::PrimID::Impl
> 76:
> 77: gl_Position = MCDCMatrix * vertexMC;
> 78:
> 79:
> 80: //VTK::ValuePass::Impl
> 81:
> 82: //VTK::Light::Impl
> 83: }
> 84:
>
>
> ERROR: In /home/buildslave/dashboards/buildbot/paraview-pvbinsdash-linux-shared-release_superbuild/build/superbuild/paraview/src/VTK/Rendering/OpenGL2/vtkShaderProgram.cxx, line 409
> vtkShaderProgram (0x8220580):
So I know your question was about suppressing errors (I have no clue how to do that, @utkarsh.ayachit might know) But looking at the error I’m thinking you are using LIC on something that is not lighted. Not lighted could be data that doesn’t have point normals in it AND contains some points or lines. When the points or lines are rendered without normals the shader code for LIC fails as it needs a normal for it’s computations and there isn’t one. It is a bug in the LIC code (feel free to add an issue to VTK) but you could maybe work around it by not trying to LIC on points and lines. Maybe there is a filter in PV to extract just the 2D elements you could use.
With ParaView 5.8, you can add the following to your script to turn off all messages:
from vtkmodules.vtkCommonCore import vtkLogger
vtkLogger.SetStderrVerbosity(vtkLogger.VERBOSITY_OFF)
This should work in pvpython, but it has limitations in pvbatch since it needs to be executed on each rank while pvbatch only executes the Python code on the root node. For that, you’ll need to put this in a dummy programmable source as follows:
# create a new 'Programmable Source'
programmableSource1 = ProgrammableSource()
programmableSource1.Script = """
from vtkmodules.vtkCommonCore import vtkLogger
vtkLogger.SetStderrVerbosity(vtkLogger.VERBOSITY_OFF)"""
programmableSource1.UpdatePipeline()
Delete(programmableSource1)
del programmableSource1
With ParaView 5.9, you can simply use the --verbosity=OFF command line argument as follows: