Open main menu

CDOT Wiki β

Changes

Savy Cat

1,328 bytes added, 21:14, 10 April 2018
Assignment 3
[[File:Summary-5.png]]
 
==== Shared Memory ====
I could not think of how to utilize shared memory for this application. No calculations are being performed. Copying to shared memory would be an additional operation, as one write to global memory is required either way. By copying a small chunk of the source image to shared memory to improve read time, the indexing logic would no longer work.
 
==== Constant Memory ====
Utilizing constant memory for the source image was something I wanted to try. The largest unsigned char file of 91.4 MB seemed affordable, and we do not write to it.
 
Since it's required to use a constant value when declaring the size of the host variable, I needed to define the size of the largest file and use that for all files:
 
<nowiki>#define SRC_MAX_SIZE 95883264
 
__constant__ PX_TYPE d_src[SRC_MAX_SIZE];</nowiki>
 
Copy the actual number of elements over:
 
<nowiki>// Copy h_src to d_src
std::cout << "Copying source image to device ..." << std::endl;
cudaMemcpyToSymbol(d_src, h_src, w * h * sizeof(PX_TYPE) * 3);</nowiki>
 
Compiling gave an error saying 91MB is too much memory to use:
 
<nowiki>CUDACOMPILE : ptxas error : File uses too much global constant data (0x5b71000 bytes, 0x10000 max)</nowiki>
 
The only example file that fit and compiled was Tiny_Shay.jpg, which there is no point in improving.
93
edits