0

I am working on a compiler optimisation routine for GPUs that optimises nested loops which has unpredictable number of iterations. To test my routine I need some real-life algorithms that include this kind of loop construct.

For example, there is a queue A with an arbitrary number of elements of type a each of which contains some arbitrary number of elements of type b. The elements of A should be processed in sequential order. There is no way to know beforehand how many elements of type a should be processed (i.e. elements could be added to A during it's processing), or how many b elements the next a would contain.

Such is the case of literals/clauses queue in DPLL SAT solving algorithm (that was the initial reason for developing the optimisation).

Could someone name some other algorithms that include such nested loops construct?

Vader B
  • 101
  • There are infinitely many such algorithms. Which ones do you prefer and why? – Raphael Nov 08 '16 at 16:58
  • 1
    Welcome to Computer Science! We don't have a strict policy for list questions, but there is a general dislike. Please note also this and this discussion; you might want to improve your question as to avoid the problems explained there. If you are not sure how to improve your question maybe we can help you in [chat]? – Raphael Nov 08 '16 at 16:59
  • For extreme cases, see here. – Raphael Nov 08 '16 at 16:59
  • Thanks for suggestion, but Collatz Conjecture does not fully suit my problem since it is not some "practical" algorithm used to solve some real-life problems. For now I use a synthetic "algorithm" with two nested loops shifting LFSRs to generate a pseudo-random stop condition. It's handy, but I need to prove my optimisation on some algorithms that solve real-life problems. For example DPLL fits because of it's usage in SAT solvers. – Vader B Nov 08 '16 at 17:38
  • It is very easy to find an algorithm on the Internet by it's purpose or features, but it still requires a human expert answer to find an algorithm by description of it's high-level implementation. – Vader B Nov 08 '16 at 17:41
  • Is simple sorting algorithm (designed for CPU of course) a good direction? – Evil Nov 08 '16 at 18:34
  • I looked into some sorting algorithms (quicksort, heapsort, sorting networks). They don't fit because there either is only one loop or the iteration count is fixed. – Vader B Nov 09 '16 at 06:24
  • Insertion sort. – j_random_hacker Nov 09 '16 at 13:30
  • Insertion sort seems to fit. Thanks for suggestion. – Vader B Nov 10 '16 at 10:33
  • You're welcome :) BTW, you need to write @j_random_hacker (or whatever username) if you want to make sure that user gets notified of your comment. – j_random_hacker Nov 12 '16 at 13:13
  • @j_random_hacker )) – Vader B Nov 12 '16 at 17:39

0 Answers0