How to read an input file in CUDA program ?

Hi everyone,

I am trying to give input from a file (xxx.csv) for matrix addition in cuda ? how can i read the file and assign to an array ? please help me…

thanks in advance,
sriram

You would do it exactly the same way as in a program that doesn’t use CUDA. Once you have it read in and assigned to a data array, you can then transfer that data array to the CUDA device (if you wish) using ordinary CUDA methods.

thanks alot…and one more question…i have 2800*64 matrix i want to transfer the whole array from host memory to device memory …hw can i do this ???

thanks in adv
sriram

using cudaMemcpy

hello,

i did using cudamemcpy and now i neeed to calculate the differences between each and every row…i mean if i am having a matrix of size of 3*4. I need the like row1-row2, row1-row3,row1-row4, row2-row3,row2-row4,row3-row4…is this possible ?

thanks in adv