Skip to content

Instantly share code, notes, and snippets.

struct node {
int value;
node* next;
};
__kernel void vector_add(__global node **a, __global node **b, __global node **c) {
// Get the index of the current element
int i = get_global_id(0);
// Do the operation
@fltermare
fltermare / svm.c
Last active August 29, 2015 13:57
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#define MAX_SOURCE_SIZE (0x100000)
@fltermare
fltermare / cl.c
Created February 23, 2014 20:49 — forked from xatier/cl.c
void * clSVMAlloc (cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment) {
// flgs <- flags (some trnasform)
return clCreateBuffer (context, flags, size, NULL, NULL);
}
// ?
void clSVMFree (cl_context context, void * svm_pointer);
// ?