i want to fill my arrays on GPU side:
in order to do that :
First i created arrays for host side and device side:
int *d_A = NULL;
int *h_A = NULL;
then i allocate memory for host array:
h_A = (int *)malloc(numOfData*sizeof(int));
and then i allocate for device array:
cudaMalloc((void **) &d_A, numOfData * sizeof(int));
and then i pass the d_A to the gpu side
cudaMemcpy(d_A, h_A, numOfData, cudaMemcpyHostToDevice);
and call function
generateVector<<<1,2>>>(d_A,numOfData);
generate function is below:
_global__ void generateVector(int * d_Data,int count) {
for (int i = 0; i < count; i++) {
d_Data[i] = rand_from_0_to_100_gen();
}
}
I know GPU side does now allow me to use rand function to fill my array. What can i do then? What is the possible solution?