[Sidefx-houdini-list] HDK : fastest way to update lots of points ?

Vincent Houzé vince.houze at gmail.com
Thu Apr 28 04:57:16 EDT 2011


Hi Edward,

I haven't done any serious profiling yet, but if I commented out the
for loop and kept the cudamemcopy, it was running much faster.
It's on my todo list to check the timings more precisely though.

Thanks for the explanation and suggestion.
Vincent

2011/4/27 Edward Lam <edward at sidefx.com>:
> Hi Vincent,
>
> Have you looked at separate timings for your call to cudaMemcpy() vs the
> FOR_ALL_GPOINTS() loop? I would expect that the cudaMemcpy() call would
> dominate the FOR_ALL_GPOINTS() loop.
>
> Currently, point position objects (ie. GEO_Point) are not necessarily
> arranged in a contiguous fashion in memory so copying from a contiguous
> array of point positions will necessarily be slower than optimal. The best
> you can do right now is probably be something like:
>
>    ppt->setPos(
>        particlesSystem->host_pos[i*3+0],
>        particlesSystem->host_pos[i*3+1],
>        particlesSystem->host_pos[i*3+2]);
>
> The performance difference will likely be negligible though because the
> compiler will probably optimize away the UT_Vector4 construction anyhow. I
> recommend using GEO_Point::setPos() regardless though since the HDK usage
> for modifying points using getPos() will be removed in the next major
> release of Houdini.
>
> Regards,
> -Edward
>
> On 4/26/2011 7:29 PM, Vincent Houzé wrote:
>>
>> Hi,
>>
>> I'm making a particles system plugin with cuda.
>> Example vids : http://www.vimeo.com/22916953
>>
>> As long as everything stays on the GPU, it's really fast as expected,
>> but copying the points positions to Houdini points slow things quite a
>> bit. Right now I'm doing
>>
>> cu::cudaMemcpy( particlesSystem->host_pos, particlesSystem->dev_pos,
>>        particlesSystem->nParts*sizeof(cu::float3),
>> cu::cudaMemcpyDeviceToHost );
>>
>> GEO_Point* ppt;
>> int i = 0;
>> UT_Vector4              p;
>>
>> FOR_ALL_GPOINTS(gdp, ppt) {
>> ppt->getPos() =
>>
>> UT_Vector4(particlesSystem->host_pos[i*3],particlesSystem->host_pos[i*3+1],
>> particlesSystem->host_pos[i*3+2], 1);
>> i++;
>> }
>>
>> and the for loop is taking a lot of time for a few millions particles.
>>
>> In the help, for attributes, there is mention of:
>>
>> set<T>(const GB_AttributeRef&h, const T *array, int count)
>> Set an array of data all at once
>> Examples:
>>         float   life[2];
>>         ppt->set<float>(life_id, life, 2);
>>
>> but I couldn't find anything similar for points positions.
>>
>> Thanks a lot for any help,
>> Vincent
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list