I was wondering when we should use x and y coordinates for threads in CUDA? I've seen some codes when they have nested loops, they use x and y coordinates. Is there any general rules for that?Thanks
Related Questions in CUDA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
Related Questions in GPU
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
Related Questions in GPGPU
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
Related Questions in NESTED-LOOPS
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The answer to the question in the title is simple: Never. You never really need the 2D coordinates.
However, there are several reasons why they are actually present. One of the main reason is that it simplifies the modelling of certain problems. Particularly, of problems that GPUs are "good at", or that they have been used for, for "historical" reasons. I'm thinking about things like image processing or matrix operations here. Writing an image processing or matrix multiplication CUDA kernel is far more intuitive when you can clearly say:
and from that on only deal with the simple pixel coordinates. How much this actually simplifies the index hassle becomes even more obvious when shared memory is involved, for example, during a matrix multiplication, and you want to slice-and-dice a set of rows+columns out of a larger matrix, to copy it to local memory. If you only had 1D indices and had to fiddle around with offsets and strides, this would be error prone.
The fact that CUDA actually does not only support 2D, but also 3D kernels might stem from the fact that 3D textures are frequently used for things like Volume Rendering, which is also something that can be greatly accelerated with GPUs (Websearches including keywords like "volume ray casting" will lead you to some nice demos here).
(Side note: In OpenCL, this idea has even been generalized. While CUDA only supports 1D, 2D and 3D kernels, in OpenCL, you only have ND kernels, where the N is explicitly given as the
work_dim
parameter)(Another side note: I'm pretty sure that there also are more low-level, technical reasons, that are related to hardware achitectures of GPUs or the caching of video memory, where the localities of 2D kernels may easily be exploited and be beneficial for the overall performance - but I'm not familiar with that, so this is only a guess until now)