2
$\begingroup$

I am new in the GPUs world, I used them in Matlab ambient so I didn't need to appreciate the subtleties of these devices.

I know that a GPU can be divided into multiprocessors (also called Streaming Multiprocessors) whose single processors share a cache memory. I don't understand if the host is required for the communication between multiprocessors. In order to center my question I am going to give an example.

Let us take a fluid dynamics simulation in which I perform a discretization of my domain into $N$ cells. After that I assign to each multiprocessor $M$ cells. In this ultra-generic simulation I have some continuity equations, between one cell and the neighbors, which must be updated for each time step. If the cells belong to the same multiprocessor it is ok since they can share memory using the common cache. On the contrary, the situation is different for those cells whose (part of their) neighbors cells belong to a different multiprocessor. My question is:

How can cells belonging to different multiprocessors communicate for each time step?

I could use the memory transfer to the CPU but I think it would not be efficient.

In my opinion, this is the central point of the computational aspect of Lattice Boltzmann Methods.

Help me to understand that.

$\endgroup$
2
  • $\begingroup$ Depending on the numerical scheme perhaps you could get away with computing the overlaps in each procesor? (I was going to ask the same question yesterday actually :')) $\endgroup$
    – Emil
    Sep 13, 2020 at 9:09
  • $\begingroup$ @Emil yes of course it depends on the numerical scheme.But my question was focused on data transfer between the whole SM and the global memory. $\endgroup$
    – Siderius
    Sep 13, 2020 at 13:44

1 Answer 1

1
$\begingroup$

The GPU consists of several streaming multiprocessors.

Each SM has 64-96kB of shared memory that can be accessed by up to 1024-2048 threads. This shared memory allows these threads to communicate.

To communicate between SMs you must write to and read from the GPU's global memory, which is 4-32GB in size.

But it is best to think of your problem as consisting of a large number of 1D or 2D chunks which may be assigned to arbitrary SMs and the "communication" as storage of intermediate results. That is, the SM may "communicate" with itself.

Thus, because the GPU's memory is used for storing these intermediates, communication with the host in the middle of a calculation is not necessary.

$\endgroup$
3
  • $\begingroup$ So you are saying that we define an array on the global memory and we assing several components to each SM. In this way for each time step, SMs access to the global memory and update that array. Is it for this point that the debate about the structure of arrays vs array of structures and the coalescence optimization arise? $\endgroup$
    – Siderius
    Sep 12, 2020 at 15:33
  • $\begingroup$ If your computation overlaps you'd need to write to a second array to avoid mutating your input. The SoA Vs AoS isn't a debate so much as a difficult design choice. $\endgroup$
    – Richard
    Sep 12, 2020 at 15:48
  • 1
    $\begingroup$ I think in compute shaders modifiers groupshared (or shared?) needs to be used or type RWStructuredBuffer to share between threads. (Surprisingly hard to find answers about this in documentation) $\endgroup$
    – Emil
    Sep 13, 2020 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.