I have list of xml files in database. I need to read, parse and sort xml files and perform xml comparison. In python, I used different libraries for xml parsing and convert that to dict. How can I achieve the same using Cuda Python? Also, the ask is to parallelize this scenarios for over 5 millions files in 5 mins.
Just like data compression, parsing of individual files is not an embarrassingly parallel problem and it does not map well to the GPU architecture. Assuming that each GPU thread gets to parse one XML file, you will have terrible thread divergence as each file is different. And your memory access patterns are going to be scattered all over the place.
A many core CPU (such as Xeon Phi or a Xeon Scalable Gold or Platinum) is likely going to excel at this job (much bigger caches, truly independent CPU cores). A GPU … likely not so much.
Keep in mind that you also have to transfer the XML data to the GPU first, and the resulting XML DOM back to the CPU. This overhead alone may take longer than a fast XML parser on the CPU would require as total run time (e.g. RapidXML’s in situ parsing claims to approach the speed of a strlen() function issued over the same data)
But I’d love to see this disproven. Maybe the Volta/Turing GPUs are somewhat better at this problem due to their improved thread scheduling behavior (warps are no longer necessarily executed in lockstep)