6.4 Using parallel processing with non-parallelizable code

If you cannot parallelize your code, it might still be possible to use parallel processing. The fact that the code cannot be parallelized only means that a specific implementation cannot be parallelized. It does not mean that the problem cannot be solved in a parallel way.

Most code is written to run on application processors that run sequentially. The code uses serial algorithms and non-concurrent data structures. Parallelizing this sort of code can be difficult or impossible.
Investigate the following approaches:
Use parallel versions of your data structures and algorithms
Many common data structures and algorithms that use them are non-concurrent. This prevents you from parallelizing the code.
There are parallel versions of many common data structures and algorithms. You might be able to use these in place of the originals to parallelize the code.
Solve the problem in a different way
Analyze what problem the code solves.
Look at the problem and investigate alternative ways of solving it. There might be alternative solutions that use algorithms and data structures that are parallelizable.
To do this, think in terms of the purpose of the code and data structures.
Typically, the aim of code is to process or transform data. It takes a certain input and produces a certain output.
Consider if the following possibilities are true:
  • The data you want to process can be divided into small data elements.
  • The data elements can be placed into a concurrent data structure.
  • The data elements can be processed independently.
If all three possibilities are true, then you can probably solve your problem with OpenCL.
Related concepts
6.5.2 Use concurrent data structures
Non-ConfidentialPDF file icon PDF versionARM 100614_0300_00_en
Copyright © 2012, 2013, 2015, 2016 ARM. All rights reserved.