cuParamSetv does this take array in host?


I programming guide 2.0, there’s example about how to use cuParamSetx x=i, f, v.

char data[32];
cuParamSetv(cuFunction, offset, (void*)data, sizeof(data));
offset += sizeof(data);

This works fine.

But I think the data should be defined in device memory because in other case
ParamSeti, ParamSetf, they all take either cuDeviceptr type which is an address of device
memory.: in fact, matrixMul program shows the example.

I tried to use cudaMalloc(), cudaMemcpy() then cuParamSetv() evenif it’s not possible to mix up
to different api’s. It’s fine in compilation but had runtime error.

If data is okey to be defined in host memory, could you show me some example?

Or, inside cuParamSetv(), does it copy HtoD and register what is newly defined in device into
launch function’s argument list?

Thank you.


I tested in depth to figure it out how we can use cuParamSetv, I think it’s only useful for delivering
an array of light values, for example, parameter values.

On contrary, if we deliver heavy amount of data through cuParamSetv, then the Launching function

How it works?, it looks like to copy the host values into device. This looks have more overhead
than using cuMemcpy, or cudaMemcpyHtoD. then calls launching function.

But I don’t know how it receive the result back to host. It looks like we need to deliver h_pC(storage
on host for result) as one of argument too.