Skip to main content

PAR Class 17, Thurs 2021-03-25

1 Student talks

  1. Connor. cloud-based/docker-base parallel computing.

  2. Isaac. Aerospace.

  3. Jack. Nvidia's autonomous machines.

2 Several forms of C++ functions

  1. Traditional top level function

    auto add(int a, int b) { return a+b;}

    You can pass this to a function. This really passes a pointer to the function. It doesn't optimize across the call.

  2. Overload operator() in a new class

    Each different variable of the class is a different function. The function can use the variable's value. This is a closure.

    This is local to the containing block.

    This form optimizes well.

  3. Lambda, or anon function.

    auto add = [](int a, int b) { return a+b;};

    This is local to the containing block.

    This form optimizes well.

  4. Placeholder notation.

    As an argument in, e.g., transform, you can do this:

    transform(..., _1+_2);

    This is nice and short.

    As this is implemented by overloading the operators, the syntax of the expression is limited to what was overloaded.

3 Thrust

  1. Thrust is an API that looks like STL. Its backend can be GPU-CUDA, OpenMP, TBB, or sequential host-based code.

  2. Functional-programming philosophy.

  3. Easier programming, once you get used to it.

  4. Code is efficient.

  5. Uses some unusual C++ techniques, like overloading operator().

  6. Since the Stanford slides were created, Thrust has adopted unified addressing, so that pointers know whether they are host or device.

  7. Stanford's parallel course notes.

We'll start lecture 8, which has a lot of content. Today we did up thru slide 24.