Search code examples
imagematlabgpudata-acquisition

How use the function "getdata" (imaqtool) to transfer data directly on GPU


I am currently using the function "getdata" from the imaqtool library to get my camera data, and make some postprocessing on my GPU.

Hence, I would like to get the data directly transfer from the buffer CPU memory to my GPU memory.

It is my understanding that "getdata" move data from CPU memory (buffer) to CPU memory. Hence, it should be trivial to transfer these data to my GPU directly.

However, I cannot find anything about it.

Any help is appreciated.


Solution

  • In short: MATLAB is not the right tool for your desires. MATLAB provides quite an easy interface, but that means you dont have full control on some things, and the main one is memory allocation and management. This is generally a good thing, as it is non-trivial to handle memory, but in your case, this is what you are asking for.

    If you want to make a fast acquisition system where the memory is fully controlled by you, you will need to use low level languages such as C++/CUDA, and play with asynchronous operations and threads.

    In MATLAB, the most flexibility you can get is using gpuArray(captured_data) once is on CPU.