[EM] Almost-realtime Yee diagrams on the GPU

Kristofer Munsterhjelm km_elmet at lavabit.com
Tue Nov 29 04:50:07 PST 2011


A few days ago, I fiddled with GLSL after being pleasantly surprised by 
GPUs' power at particular types of problems. In my tinkering, I wrote a 
script for three-candidate Plurality and IRV Yee diagram rendering. The 
Plurality one can probably be generalized, but the IRV one would be harder.

As I thought it might be of list interest, I've attached these scripts 
to this mail. On my GTX 460, The Plurality one runs at 50 fps and the 
IRV one at 20. You'll need GeeXLab to run them, and that program can be 
found at http://www.geeks3d.com/geexlab/ . I also think the GPU has to 
suppord Shader Model 4, but I'm not sure of this, and I have not tested 
the scripts on anything but Intel onboard and nVidia GPUs.

Unfortunately, they're still a little too fuzzy to be both usable and
realtime at once. I have two ideas for how to improve them, but I'm not
good enough at GLSL yet.
First: one may make the fragment shaders or texture somehow store
information about prior results so that if the renderer does 100
iterations a frame at 60 fps, it will have a Yee diagram of 6000 samples 
after a second.
Second: it might be possible to precalculate the n Gaussian points then
just use the same ones for every Yee point. That will reduce the
randomness, but if a lookup is faster than a log and two trig functions,
it will be quicker. I don't yet know if that is the case, because memory
access is quite slow on the GPU. (In the ideal case, instead of
calculating 100 Gaussians randoms for 640x640 pixels, one'd calculate
640x640x100 Gaussian randoms once and use them for all the pixels.)

So if anyone who does know GLSL reads this, feel free to improve further :-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Yee_maps_GPU.zip
Type: application/zip
Size: 16953 bytes
Desc: not available
URL: <http://lists.electorama.com/pipermail/election-methods-electorama.com/attachments/20111129/7c524c31/attachment-0003.zip>


More information about the Election-Methods mailing list