Here is a quick and dirty example:
struct test_device {
int *arr;
};
class test {
int *arr;
int *arr_device;
public:
typedef test_device device_type;
typedef test host_type;
test() {
arr = new int[100];
arr_device = 0;
}
~test() {
delete[] arr;
cupp::free (arr_device);
}
device_type transform(const cupp::device &d) {
arr_device = cupp::malloc<int>(100);
cupp::copy_host_to_device(arr_device, arr, 100);
test_device a;
a.arr = arr_device;
return a;
}
};
Write your kernel to expect the device type:
__global__ void global_function (test_device a)
and than just pass test object to the cupp::kernel call.
-Jens