POV-Ray : Newsgroups : povray.off-topic : Suggestion: OpenCL : Re: Suggestion: OpenCL Server Time
5 Sep 2024 15:28:22 EDT (-0400)
  Re: Suggestion: OpenCL  
From: scott
Date: 18 Aug 2009 09:51:32
Message: <4a8ab1e4$1@news.povray.org>
> Indeed. And on the GPU, you can say "for all these thirty pixels you're 
> processing, multiply each one by the corresponding texture pixel". For 
> example. One instruction, executed on 30 different pairs of data values. 
> SIMD.

If you've ever done a array processing with eg MatLab you will be familiar 
with how to restructure algorithms to work in this sort of environment.

Things like doing "OUTPUT = A * B + (1-A) * C" is a single instruction that 
can operate on every value of the array, but essentially lets you choose 
output B or C based on the value of A.  This is often very useful and fast 
for converting typical one-value-at-a-time algorithms.

Reminds me of a built-in MatLab function to convert an RGB image to HSV. 
The function was actually looping through every pixel and calling the 
convert function (which had several if's in it).  I rewrote the conversion 
function to work on whole arrays at a time and it was orders of magnitude 
faster.  That's what you need to do for GPU programming too.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.