Skip to content

This repository will be used to implement SVD algorithm on a GPU Architecture.

Notifications You must be signed in to change notification settings

devjoshi9031/EE217_Final_Project

Repository files navigation

EE217_Final_Project

This repository will be used to implement SVD algorithm on a GPU Architecture.

Purpose of the different files used in the project:

  1. 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.

  1. 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.

  2. 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.

DIRECTORIES:

  1. images/ -> Actual images for the CPU version of SVD to operate upon.
  2. images_converted/ -> Used by the jpg_to_bmp.py file to store the bmp files generated from .jpg files.
  3. images_from_c_file/ -> Used by the read_images.c file to store the bmp files.
  4. final_output_images/ -> list of the final 256 images taken to test the SVD on CPU and GPU code.

Flow of executing files to get the final output:

Flow to run the SVD algorithm on pyCUDA(GPU) and CPU together.

  1. Please download the data set from this link:
  2. Extract it and name the output directory jpg/
  3. 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.
  4. 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
  5. 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!!

About

This repository will be used to implement SVD algorithm on a GPU Architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published