Allocation of class


I’m new in the field of GPU programming and I have a question about allocation of class. You’ll find below a small code that present my issue. how to send the class array, initialized with 100 int, to the device ?

#include <iostream>

class array
    int* m_a;
    void init(int i)
      m_a = new int[i];

int main()
  array a;

// how to send the class a (of size 100) to the device ?

  return 0;

Thank you.

Ideally you’d use something like this:

#include <thrust/device_vector.h>
#include <thrust/host_vector.h>

int main(void)
  thrust::device_vector<int> vals{128, -1};
  // do some GPU code here

  // copy back
  thrust::host_vector<int> h_vals{vals};

  return 0;