Arguing first that it defines the geometry of networks of thread blocks, and the second argument that defines the geometry of thread blocks itself.
Nets may be up to two dimensions, and thread blocks until the three dimensions.
Block nets and use the specific type of data to determine their dim3, as shown in the following lines:
// configuration block
dim3 block (block_x, block_y, block_z);
// network configuration
dim3 grid (grid_x, grid_y);
By the host, the values of the components of the network and the block are accessible through grid.X (X = x, y) and block.X (X = x, y, z). Similarly, CUDA threads require this information using variables and blockDim gridDim. To identify a CUDA thread within his block, or even a specific thread within the thread blocks network, and blockIdx threadIdx variables are used.
With this information, CUDA`s thread it can be assigned a unique thread ID which can be used to access some data objects within a vector, matrix or field. To provide data objects in graphics cards, or event to get the date from them, the host must be able to access some of the layers of graphics card memory. Since the graphics card is unable to ACT autonomously, is the host to allocate and release memory graphics. For dynamically allocated graphics memory used cudaMalloc ((void **) & date, size) where cudaMalloc () makes that data record to the address of a byte sized field, located in the main memory to the graphics card. To free memory dynamically graphics used cudaFree (date).
If you use type qualifiers CUDA specific variables (see Table 3.2), graphics memory can be allocated in static mode. For example, the first two rows
__device__ int intArray[128];
__constant__ int constIntArray[128];
__shared__ int *sharedPtr;
allocate two vector integer variables, each with size 128 first vector (intArray) is located in the main memory to the graphics card, and the second vector (constIntArray) is located in a common memory during execution
Qualifier of function type writable by readable by
__device__host, graphics card host graphics card
__shared__ graphics card graphics card
__constant__ host host graphics card
Table 3.2 .: Qualifiers type of CUDA variables.
To exchange data between the host and the graphics card (again all transfers must be initiated by the host), use the copying functions optimized for different data types are used. All these functions have two markers, with one address data in the graphics card memory, and the memory address another main host system.
It also required information on the amount of data to be transferred, for example:
cudaMemcpy(dstPointer,srcPointer,size,copyDirection);
transfers a byte size of memory space, marked by srcPointer, to a memory space from dstPointer marked where copyDirection is one of:
cudaMemcpyDeviceToHost,
cudaMemcpyHostToDevice,
cudaMemcpyHostToHost,
cudaMemcpyDeviceToDevice.
We should note also that the main memory of the graphics card and the host main memory are not part of the same physical address space. This leads to duplication of data, since all the variables used by the CPU and GPU should be allocated and managed twice.
To make these aspects a little clearer, we will illustrate them according to the Gaussian Blur and Sobel Edge Detection algorithms in the following part.
3.2 Gaussian Blur
Image smoothing is considered a king of convolution which is mainly applied to reduce the image noise and also the detail. Commonly this is realized by applying the image from the beginning to end a low pass filter. The use of this filter makes possible to keep lower frequency values while reducing the high frequency values. In this way the image is smotheed by decreasing the deferences between pixels to their neighbors.
An important role of image smoothing, it is considered like a preprocessor for different images calculations. It is necessary for an image to be smoothed in order to reduce the noise after that an edge detection algorithm can be applicated. Smoothing is allowed to be used on the same image as much as you want until you get the effect that you desired.
An easy manner to obtain smoothing is by using a mean filter. The clue is instead of every pixel, we to put the average value of all neighbor pixels also by including itself. From that we get the biggest advantage which is speed and simplicity. But also it has a big disadvantage, where the pixels which occurs very far from the interested pixel make a wrong presentation of the right mean of the neighbor. There exist other ways to smooth an image where one of them is by using Gaussian Blur [24]. The Gaussian Blur is an advanced image smoothing method since it decreases the value of high frequencies proportional to their frequencies. So, it function like this ,by giving the smallest weight to the pixels which are far away from the center of the window. The function of Gaussian Blur consists in :
Essay: Information technology essay
Essay details and download:
- Subject area(s): Information technology essays
- Reading time: 3 minutes
- Price: Free download
- Published: 22 September 2015*
- Last Modified: 18 September 2024
- File format: Text
- Words: 805 (approx)
- Number of pages: 4 (approx)
Text preview of this essay:
This page of the essay has 805 words.
About this essay:
If you use part of this page in your own work, you need to provide a citation, as follows:
Essay Sauce, Information technology essay. Available from:<https://www.essaysauce.com/information-technology-essays/essay-information-technology-essay/> [Accessed 19-11-24].
These Information technology essays have been submitted to us by students in order to help you with your studies.
* This essay may have been previously published on EssaySauce.com and/or Essay.uk.com at an earlier date than indicated.