Skip to content

Instantly share code, notes, and snippets.

@ek-nath
Created November 28, 2016 19:52
Show Gist options
  • Select an option

  • Save ek-nath/809ae48e59f918fe74261a67e3ce9a2e to your computer and use it in GitHub Desktop.

Select an option

Save ek-nath/809ae48e59f918fe74261a67e3ce9a2e to your computer and use it in GitHub Desktop.

Revisions

  1. Eknath created this gist Nov 28, 2016.
    19 changes: 19 additions & 0 deletions moderncpu_hello.cu
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #include <moderngpu/transform.hxx>

    using namespace mgpu;

    int main(int argc, char** argv) {
    // The context encapsulates things like an allocator and a stream.
    // By default it prints device info to the console.
    standard_context_t context;

    // Launch five threads to greet us.
    transform([]MGPU_DEVICE(int index) {
    printf("Hello GPU from thread %d\n", index);
    }, 5, context);

    // Synchronize on the context's stream to send the output to the console.
    context.synchronize();

    return 0;
    }