Hi Perry I expect that the problem is that with parallel programming many threads execute exactly the same line of code at once.
The insertion sort is dependant on all the elements of v from 0 to i-1 already being sorted i.e. it relies on being run by a single thread.
with parallel programming if several threads all have a value that should be inserted at v[99] then they will overwrite each others values.
As the classic insertion sort relies on being run by a single thread it can only be used when each thread works in its own array, for parallel programming there are other sorts that work.
Hi Perry I expect that the problem is that with parallel programming many threads execute exactly the same line of code at once.
The insertion sort is dependant on all the elements of v from 0 to i-1 already being sorted i.e. it relies on being run by a single thread.
with parallel programming if several threads all have a value that should be inserted at v[99] then they will overwrite each others values.
As the classic insertion sort relies on being run by a single thread it can only be used when each thread works in its own array, for parallel programming there are other sorts that work.