Is there a difference with the output format of the CPU version ?
There are two main differences:
the hydrodynamics fields, that are written in raw format, are now written in single precision rather than double precision. They occupy half the disk space that they would occupy with the CPU version. Under
IDL, they should be read in arrays defined with
fltarr, rather than
The azimuthal velocity (written to the files
gasvtheta*.dat) is now the residual velocity with respect to
whereas in the CPU version the following azimuthal velocity is output:
The reason for that is that the residual azimuthal velocity is stored internally by the code, essentially for numerical accuracy reasons that arise when working with single precision data.
I want to implement a new functionnalilty, but I don’t know CUDA. What should I do ?
You can still plugin your own CPU modules (e.g., accretion), at the expense of speed (in most cases the GPU/CPU ratio should remain large). For doing so,
you need to download the arrays from the video RAM (where they are up to date) to the CPU RAM, prior to calling your module. There is a handy function in GFARGO that allows to do that straightforwardly :
D2H() (which stands for device to host). For instance, before calling say the accretion
module, you need to have on the CPU, as in the normal version of FARGO, an
up to date array of the density and velocities (radial and azimuthal).
Edit the file
loop.c, which contains the main loop of the program. You can see that there the line:
is commented out. If you want to use this function, you notice that you
need to have, on the CPU, the arrays
uncomment this line and before it, add the three following lines:
After your call to
AccreteOntoPlanets, the arrays have been modified on the CPU RAM. You need to upload these new arrays to the video RAM. This is done very easily by adding, after the call to
AccreteOntoPlanets, the three following lines:
Note that only the hydrodynamics data is on the video RAM, and that only hydrodynamics calculations are deported on the graphics card. Everything else remains on the CPU and is performed on the CPU (e.g., positions and velocities of the planets, and integration of their movements).