Download FARGO3D User Guide
Transcript
FARGO3D User Guide, Release 1.1 Before starting a (M)HD time step on the GPU, we need to upload the data to it. This is done by a “host to device” communication (H2D) which occurs through the PCI bus: The run can start on the GPU. Only the data on board the GPU is then up to date, while the data on the CPU is left untouched and corresponds to the initial condition: At some point we need to get the data back on the CPU (for instance to dump it to an output file, or because we have written a new routine that uses it and which we have not developed to run on the GPU). We need to perform a communication through the PCI bus from the device to the host (D2H), this time: A simple example could be: Suppose we are in the first time step of a run, and we want to compute the pressure field on the GPU (𝑃 = 𝑐2𝑠 𝜌), but we have set the initial conditions on the CPU. We need to upload the sound speed and density fields. We do not upload all fields. This would be extremely time consuming. We only upload what is needed and nothing else. In order for that to be achieved semi-automatically, we have defined two macrocommands that are called INPUT and OUTPUT. What these macrocommands do is that they update the “color” (red or green) of a field on the GPU or CPU, so that we know whether it is up to date or not, and they transfer the data to the place where the calculation is going to proceed, if it turns out to be out of date at the beginning of a routine. For instance consider the following piece of code: 68 Chapter 13. Communications