 # Way to covert pointer (*d_A) to array (*d_Array [])

Hi, I am reviewing the example of bached Cholesky factorization. The function constructed as follows:

``````cusolverStatus_t
cusolverDnSpotrfBatched(
cusolverDnHandle_t handle,
cublasFillMode_t uplo,
int n,
float *Aarray[],
int lda,
int *infoArray,
int batchSize);
``````

In my code, I use a device pointer *d_A as a 3 by 3 by batchSize matrix like
d_A[0~18]={1.0, 2.0, 3.0, 2.0, 5.0, 5.0, 3.0, 5.0, 12.0, 1.0, 2.0, 3.0, 2.0, 4.0, 5.0, 3.0, 5.0, 12.0 } when the batchSize equals 2.

I wonder if there is a way to convert such device pointer *d_A to *Aarray so that it can be passed to the bached Cholesky factorization function.

Very appreciated if you could advise.

``````float *h_Aarray;
h_Aarray = d_A;
h_Aarray = d_A+9;

float **d_Aarray;
cudaMalloc(&d_Aarray, 2*sizeof(float*));
cudaMemcpy(d_Aarray, h_Aarray, 2*sizeof(float*), cudaMemcpyHostToDevice);
``````

Then how to get the computed *d_Aarray back to *d_A?

Thank you!

They will just be there. Perhaps you should try it and see if it works.
Its not clear you to me that you understand how pointers work.

I see. The pointer *d_A and array *d_Aarray are bond together. Memory operations made to *d_Aarray are equivalent to operations to *d_A.

Thanks!