Adapted by: Szymon Baczyński (Warsaw University of Technology)
Date: 24.10.2019
The program is briefly carried out in the following steps (paper):
- Creation of a two-dimensional array with BMP-defined dimensions (the array is a slide through which light will propagate).
- Enter the table created in step 1 to X (usually twice) as large a table (smaller table placed in the center of a larger one).
- The newly created table (now called the input table) is copied to the graphics card (GPU).
- The Fast Fourier Transform (FFT) of the input table is counted on the GPU.
- CPU calculates a two-dimensional impulse response table (h(z) - depending on the propagation distance z) and sends it to the GPU.
- GPU calculate the FFT of the impulse response and then multiply the input table transform with the impulse response transform.
- The result of multiplication is subjected to the Inverse Fourier Transform. After performing the IFFT, its result is copied from the GPU to the host.
- The resulting data table is subjected to the ROLL operation - quadrant swapping for the correct result.
- The final result is saved to a file (BMP - Grayscale) in the form of an amplitude.
- Import TXT file with "HOLE" as 0-255 Grayscale
- Perform calculation on CPU and GPU (CUDA)
- Export TXT file after calculations
- Import BMP (take only Green channel)
- Export BMP (as Grayscale)
- Check CUDA compatible devices
- Clean Code
- Slice STL files
Code for calculations of Light Propagation is in: cudaOpenMP.cu
Makefile for compilation (from CUDA example): Makefile
/usr/local/cuda/bin/nvcc -ccbin g++ -I../../common/inc -m64 -Xcompiler -fopenmp -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o cudaOpenMP -c cudaOpenMP.cu -lgomp -lcufft
BMP_in - BMP file as "HOLE"
Multi - Multiplier for temporary array (usually =2) (int)
Z_in - Propagation Distance in milimeters [mm] (double)
Lambda - Wavelength in nanometers [nm] (double)
Sampling - Space between each pixels in micrometers [microm] (double)
Template for Output file: z_%.3lf-m_lam_%.1lf-nm_samp_%.1lf-micro.BMP
Example output file: z_0.500-m_lam_450.0-nm_samp_10.0-micro.BMP