Question

in many cublas or cusparse function calls, they use scalar variables which we can pass in either host pointer or device pointer, such as the alpha and beta variable here http://docs.nvidia.com/cuda/cublas/#cublas-lt-t-gt-gemm

How is this actually implemented? If the data is in host, I assume it would need to allocate memory on device and then call cudaMemcpyAsync to copy the data. However, doing cudaMalloc would make the function call synchronous. How can we solve this problem?

Was it helpful?

Solution

If its a host resident scalar it can be passed by value as a kernel parameter. If it's device resident then a pointer to it can be passed as a kernel parameter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top