This repository will be used to implement SVD algorithm on a GPU Architecture.
- cpu_test.py: This file performs SVD on CPU with the images that are stored in "images/" directory. OUTPUT of the file is just how much time taken to perform SVD on the images and to reconstruct all the images. This file has been merged into @cpu_and_gpu_final_svd.py, so this file has less significance now.
It is very hard to read jpg file in a .c program, because of the lossy compression. Hence, all the images needs to be converted in bmp file, which is comparatively easy to read in .c file.
-
jpg_to_bmp.py: This file converts all the .jpg files in .bmp files and also convert them in grayscale for the .c file to read and operate on the data. It will store the output images in images_converted folder.
-
read_image.c: This is a C file that reads a bmp image and also stores the same image in another directory named "images_from_c_files/". This is just an experiment for the CUDA program to use SVD can be put in between reading and writing the image file to get suitable output. Unfortunately, we were getting negative infinity and Nans if we took images as input so the final CUDA version of SVD is done by using matrices generated by random numbers.
- images/ -> Actual images for the CPU version of SVD to operate upon.
- images_converted/ -> Used by the jpg_to_bmp.py file to store the bmp files generated from .jpg files.
- images_from_c_file/ -> Used by the read_images.c file to store the bmp files.
- final_output_images/ -> list of the final 256 images taken to test the SVD on CPU and GPU code.
- Please download the data set from this link:
- Extract it and name the output directory jpg/
- Make a directory named final_output_images and run the script get_images_for_svd.py(Just do python3 get_images_for_svd.py). This step will give you 256 images that has size of 500x750 to run SVD algorithm on.
- Run the script cpu_and_gpu_final_svd.py (python3 cpu_and_gpu_final_svd.py) and this will output a table in the following format. CPU_TIME GPU_TIME Image_size CPU_Error CPU_Error_rate GPU_Error GPU_Error_rate
- Finally to the run the code using profiling tool from Nvidia type nvprof python3 cpu_and_gpu_final_svd.py. And this will output the profiling statistics of the program.
We have also attached run.sh file that you can run and everything that is discussed above will be done automatically.
Thank you so much!!