Skip to content

Instantly share code, notes, and snippets.

@ek-nath
Created November 28, 2016 19:52
Show Gist options
  • Save ek-nath/809ae48e59f918fe74261a67e3ce9a2e to your computer and use it in GitHub Desktop.
Save ek-nath/809ae48e59f918fe74261a67e3ce9a2e to your computer and use it in GitHub Desktop.
#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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment