3 ms·
Additionally: I needed to make a program to join two tables by a common subset of their columns. It's desirable in CUDA, to enhance caching locality, to work wi
by hughw 10y ago
Additionally: I needed to make a program to join two tables by a common subset of their columns. It's desirable in CUDA, to enhance caching locality, to work with structs of arrays rather than arrays of structs. So a pattern in Thrust is to work with tuples. You zip up your columns and then you can use them in transformations. That's nice enough. The trouble arises when you need to write code to join (and transform) table A having NA columns, by table B having NB columns, sharing some number of shared columns NC. To manipulate the tuples you end up specializing cases and you build some awful large switch statements. That is, if you're a naive rookie, like me. Then you back off, and try to learn a little meta programming. You actually can dynamically treat tuples, sort of like lists, a little bit. But finally I decided that too is a kind of madness, and I'm on my third try, this time using a custom iterator over good old-fashioned dynamic vectors of arrays, so I can sidestep tuples altogether, and still use the structure of arrays idiom.