Question

I have a powershell script, Find/replace string with carriage return and line feed in PowerShell, that I often run. It parses many files and naturally, it utilizes a majority of the CPU (2 cores).

Is there a way to utilize GPU acceleration in powershell?

Was it helpful?

Solution

The script you have there is likely not CPU-bound. It definitely cannot use more than one of your cores, i.e. 50 %. I'm fairly confident that the slowest part of that is reading and writing the files.

There are a few tasks that can be done very efficiently by the GPU, but for that the data already has to be in memory. That is, the slowest part (reading the files and writing them afterwards) still remains.

Then there is the case that the GPU is well-suited for doing the same or similar operations on large amounts of data, but text replacement (regexes even less so) is a different beast. Keep in mind that GPUs are very efficient at shuffling around large arrays of floating-point numbers. Characters are anything but that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top