Accelerating VTK processing

The following code loads a .vtk file, does some processing, and exports the output as a .vtp file:

# Read VTK
reader = vtkStructuredGridReader()
reader.SetFileName(filename + ".vtk")

# Extract surface
surface_filter = vtkDataSetSurfaceFilter()

clean_filter = vtkCleanPolyData()

# Save output to a VTP file
writer = vtkXMLPolyDataWriter()
writer.SetFileName(filename + ".vtp")

While this code works perfectly, I have to run this for about 50 VTK files, so the conversion can take a while. Is there a way to somehow accelerate this by running this for multiple files in parallel? Any other ideas?

You can use make -j$(nproc) to do this:

outputs := $(patsubst %.vtk,%.vtp,$(wildcard *.vtk))

.PHONY: all
all: $(outputs)

%.vtp: %.vtk
	vtkpython $<

though this will pass foo.vtk as the argument, not foo