Previous | Next --- Slide 7 of 60
Back to Lecture Thumbnails
rmjones

Two examples of a declarative style of programming that we have seen previously in the class are ISPC foreach and cilk_spawn. Both are leveraged by the programmer to mark a set of tasks as independent, but there is otherwise no enforcement of how those independent tasks will be executed. If the user were to instead directly spawn new threads in their code or utilize vector intrinsics to make use of SIMD execution units, then this would be a form of imperative programming.

jle

Reviewing this slide, it’s nice seeing these definitions can connect back all the way back to our first assignments and early on in the class! For example, the Programming Assignment 1 had the extra credit question about the difference between the thread abstraction and the ISPC task abstraction. We can answer that better now. s rmjones pointed out, the ISPC takes is a declarative abstraction and style where us the programmer defined the work for each task. On the other hand, we can think of the thread abstraction from assignment 1 as an imperative style where we statically told each thread which work it should execute.

Please log in to leave a comment.