[pvpython] Optimizing for performance

Hi,

Heads-up: I am fairly new to Paraview.

I have been running pvpython (ParaView version 5.6.0) on a HPC cluster with many cores and lots of memory available, but the scripts seem to run very slowly, no matter the resources I allocate. I’m calculating gradients of scalar fields in a 2D domain and then save the fields along an isoconour as CSV files. My code to compute the gradients looks something like

gradientOfUnstructuredDataSet1 = GradientOfUnstructuredDataSet(registrationName='GradientOfUnstructuredDataSet1', Input=infilenek5000)
gradientOfUnstructuredDataSet1.ScalarArray = ['POINTS', 'temperature']

# rename source object
RenameSource('grad_T', gradientOfUnstructuredDataSet1)

# Properties modified on gradientOfUnstructuredDataSet1
gradientOfUnstructuredDataSet1.ResultArrayName = 'grad_T'


# create a new 'Gradient Of Unstructured DataSet'
gradientOfUnstructuredDataSet1_1 = GradientOfUnstructuredDataSet(registrationName='GradientOfUnstructuredDataSet1', Input=gradientOfUnstructuredDataSet1)
gradientOfUnstructuredDataSet1_1.ScalarArray = ['POINTS', 'grad_T']

# rename source object
RenameSource('grad_grad_T', gradientOfUnstructuredDataSet1_1)

# Properties modified on gradientOfUnstructuredDataSet1_1
gradientOfUnstructuredDataSet1_1.ResultArrayName = 'grad_grad_T'

and for saving the fields:

contour1 = Contour(registrationName='Contour1', Input=gradientOfUnstructuredDataSet1_7)
contour1.ContourBy = ['POINTS', 'temperature']
contour1.Isosurfaces = [3.8]
contour1.PointMergeMethod = 'Uniform Binning'


# save data
SaveData(outdir + '/out.csv', 
	     proxy=contour1, 
	     WriteTimeSteps=1)

I’m not sure how to optimize for performance, so I have a few questions:
(a) Does pvpython run in parallel?
(b) Can increasing the available RAM reduce runtime? What is reasonable here?
(c) Are there more general strategies to speed up calculating gradients and extracting the fields? Is there a way to restrict the operations to an area of the domain?

Any help would be very much appreciated!

Cheers,
Lukas

(a) Does pvpython run in parallel?

No, use pvbatch

(b) Can increasing the available RAM reduce runtime? What is reasonable here?

No, unless you are swapping. Never use swap for computation anyway.

(c) Are there more general strategies to speed up calculating gradients and extracting the fields?

  • Reduce the size of the data you are working with.
  • Work in parallel
  • Increase number of cores

Is there a way to restrict the operations to an area of the domain?

ExtractSelection ?

1 Like

Beautiful, thank you sir. I was unaware of pvbatch.