|Home > Converting existing code to OpenCL > 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:
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.
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:
If all three possibilities are true, then you can probably solve your problem with OpenCL.