# How to pass variable in device memory into CUBLAS function

**URL:** <https://forums.developer.nvidia.com/t/how-to-pass-variable-in-device-memory-into-cublas-function/16717>\
**Category:** CUDA Programming and Performance\
**Created:** [May 20, 2010, 3:11pm UTC](https://forums.developer.nvidia.com/t/how-to-pass-variable-in-device-memory-into-cublas-function/16717 "2010-05-20T15:11:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shu\_Heng](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Shu\_Heng](https://forums.developer.nvidia.com/u/Shu_Heng)\
**Post date:** [May 20, 2010, 3:11pm UTC](https://forums.developer.nvidia.com/t/how-to-pass-variable-in-device-memory-into-cublas-function/16717/1 "2010-05-20T15:11:31Z")

</div>

I have allocated a matrix, du, in the device, and would like to obtain an array consists of sum of each column.  
To do this I allocate another array, dcolumsum in the device memory.

I call the CUBLAS function in the host:  
for(i=0;i\<n;i++)  
dcolumnsum[i]=cublasSasum (n, du, 1);

and had a compilation error.

May i know what would be the correct way to pass device memory variable into cublas, and had the output in device memory as well?
