Overview
The tests are designed to compare the images generated by the CUDA implementation and the Python implementation of the RadioImagerGPU project.
Test Structure
- Input Data: Located in
tests/data
(e.g., xyz_coordinates.csv, directions.csv).
- Output Directories:
- CUDA output:
tests/output/cuda
- Python output:
tests/output/python
- Difference images:
tests/output/differences
Running the Tests
To run the tests, execute the following script from the root of the project:
python3 tests/compare_images.py
What the Tests Do
- Run CUDA Implementation:
- Executes the CUDA program to generate images (./build/RadioImager).
- Saves the images as CSV and PNG files in
tests/output/cuda/images_gpu
.
- Run Python Implementation:
- Executes the Python script to generate images.
- Saves the images as CSV and PNG files in
tests/output/python/images
.
- Compare Outputs:
- Compares the images generated by CUDA and Python implementations.
- Saves the difference images as PNG files in
tests/output/differences
.
- Prints the maximum difference for each image pair and indicates if they are similar (max difference < 0.05).
Examination
After running the test, you can examine the output in the following directories:
- CUDA Images: Located in
tests/output/cuda/images_gpu
. Examine these images to verify the output of the CUDA implementation.
- Python Images: Located in
tests/output/python/images
. Examine these images to verify the output of the Python implementation.
- Difference Images: Located in
tests/output/differences
. Examine these images to identify differences between CUDA and Python outputs. The script will output the maximum difference for each image pair and indicate if they are similar. For example:
UVW computation complete. Execution time: 87 ms
Imaging complete. Execution time: 85 ms
Progress: 10% (1/10 images saved)
Progress: 100% (10/10 images saved)
image_data_gpu_ Image 0 saved as PNG.
....
UVW computation complete. Execution time: 4.25 ms
UVW coordinates saved successfully.
Imaging complete. Execution time: 28.85 ms
Images saved successfully.
Difference Image 0 saved. Max difference: 0.0275
Image 0 is similar.
...