Thank you for a detailed reply that was very helpful.
I'm still not clear on a few things (after going through the getting started guide in more detail)
- Code: Select all
// Create array from host memory
array a(2, 3, host_ptr); // f32 matrix of size 2-by-3 from host data
This method works if I'm allocating the array with the host_ptr but what if my array is already created?
Could I do something like:
- Code: Select all
// in myClass.h
af::array* af_signal;
- Code: Select all
// in myClass.cpp constructor
af_signal = new af::array(1,signalSize,af::c64);
// in a GetDataFunction
memcpy(h_signal,dataArray,signalLength);// copy from a file buffer to the host buffer
checkCudaErrors(cudaMemcpy(af_signal,h_signal,signalLength,cudaMemcpyHostToDevice)); // this doesn't seem right -
//should I use af_signal(span) = h_signal? - this also doesn't seem correct
I haven't found a place in the documentation or examples that provides a good walkthrough of this process in particular.
I understand how the data copy works if I am generating the array (like you posted above) but not how to update the array, from the host, once the array has been generated ...