Skip to content

Instantly share code, notes, and snippets.

@fltermare
Last active August 29, 2015 13:57
Show Gist options
  • Save fltermare/9449819 to your computer and use it in GitHub Desktop.
Save fltermare/9449819 to your computer and use it in GitHub Desktop.
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
for(int j = 0; j < 3; ++j) {
c[i]->value = a[i]->value + b[i]->value;
//a[i]->value
//*(a + sizeof(struct)*1) -> value;
c[i] = c[i]->next;
a[i] = a[i]->next;
b[i] = b[i]->next;
}
}
__kernel int lookup() {
addr = table [....]
}
__kernel void foo(__global node *A, __global int idx, table) {
idx = idx + get_global_id(0);
while (lookup(A[idx]->next, table)) {
A[idx]->value;
}
}
@xatier
Copy link

xatier commented Mar 10, 2014

blah = a->value;
a = a->next;
blah = a->value (a->next->value)

blah = buf [100];
20 = buf[50]
blah = buf[100]

// host
a = clSVMalloc(1);
a->next = clSVMalloc(1);
a->value = 1;
a->next->value = 2;
// ----
__kernel int foo(__global *a) {
  a  = a->next;
}
//-- 
a->value => 2;


while (lookup(A[idx]->next, table)) {
      A[idx] = A[idx]->next;
        A[idx]->value;
    }

@fltermare
Copy link
Author

Problem: LIST_SIZE (line 11)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment