Hi.

I’ve to pass to the kernel of my OpenCL program a big, sparse graph. I’ve to implement it as an adjacency list, not a square adjacency matrix due to memory limits.

I’ve red that it’s not possible to pass to kernel structures that contain pointers, my argument should be like this:

0 -> {(3,4), (2,5), (4,2)}

1 -> {(5,6), (6,4)}

…

V -> {(2,6), (3,7), (4,12), (15,9)}

where V is the number of nodes of the graph and e.g. 0->{(3,4) …} means that there is an edge (0,3) of weight 4.

The length of the arrays pointed by the first array is not always the same, as an adjacency list.

The kernel should be something like:

__kernel void kernel_bellman_ford(__global (struct edge) **g, …other arguments)

and

struct edge {

int node;

int weight;

};

Actually there are no struct containing pointers but there’s still a multi-dimension array.

Is there a way to use this graph array successfully as a kernel argument?

Is it possible to write it in another way?

Thanks in advance.