Previous | Next --- Slide 15 of 48
Back to Lecture Thumbnails
paracon

The difference between the two programs in that, in the left side implementation, the programmer is able to manager the work distribution using programCount and programIndex. On the other hand, in the foreach version, it depends on the underlying ISPC implementation.

emt

On the left, the programmer is deciding how to assign the work decomposition and explicitly assigning work to the program instances. On the right, the foreach loop is a construct provided by ISPC to automatically split up program instances based on the ISPC gang size. Thus, the programmer lets ISPC decided how to split up the work instead of explicitly assigning it.

eourcs

To reiterate, the program on the right only specifies behavior. Its sole specification is that each iteration of the loop from 0 to N will be computed. Implementation details are left to the compiler. The program on the left specifies implementation in addition to behavior. It has the same specification as in the other program, but with the additional constraint that iterations are assigned in an interleaved fashion.

yyc

I understand that the two programs have different underlying semantics. However, since we know that ISPC does interleaved assignment by default, will those two programs have any difference during execution?

pk267

The advantage of the code on right code over left code is that it is portable across different machines.