[go: up one dir, main page]

Skip to content
Parsa Amini edited this page May 7, 2021 · 1 revision

A new test has been implemented during EuroHack 2019. Its purpose is to give the developer real-time testing to its GPU kernels.

How to use the testing unit?

Before changing the code, the developer should run the command: unitiger -C. This will output binary files having correct U, Q, F values:

U - hydro::state_type, holds the physical quantities of the grid. Dimensions of (Number of physical fields) X (Number of cells in the subgrid).

Q - hydro::recon_type, holds the interface's values of the grid after reconstruction. Dimensions of (Number of physical fields) X (Number of cells in the subgrid) X (Number of interfaces for each cell [1 in 1D, 8 in 2D, and 27 in 3D]).

F - hydro::flux_type, holds the flux values of the grid. Dimensions of (Number of dimensions) X (Number of physical fields) X (Number of fluxes = [Number of cells in the subgrid]^[Number of dimensions]).

After the GPU kernels were modified, running Uni-Tiger will compare the new U, Q, F values to the stored correct U, Q, F values in each time step and will notify if any differences exist between them.

The comparison criterion is as follows: if abs(Q_new - Q_old) / (1e-12 + Q_new + Q_old) > 1e-12 then the comparison failed, a message specifies where this difference occurred is printed, and the comparison stops and returns 0.

When no differences found between the new and old values (the criterion was false for every item in the array) the comparison succeeded. The comparison returns 1 and a proper message is printed.


Note 1: You can change the variable printEachTimeStep (in src/unitiger/main.cpp) to false to turn off the testing for every time step. The test at the end of the simulation will still remain.

Note 2: The output files have the format of "Test-Problem-Name_(U/Q/F)_test_step-number.data". If you change the dimensionality or the number of cells for the problem you run, the comparison may fail. You should create new output files for the new dimensionality or new number of cells beforehand.

Note 3: I made output files for general problems that can be used. This might save you time. The output files are for: 2D-KH with 50X50 cells, 2D-CONTACT with 64X64 cells, 3D-SOD with 8X8X8 cells, and 2D-BLAST with 50X50 cells. Let me know if you need them (I still need to think of a good way of how to share these files).