Linear Algebra
Friday, January 22, 2010
Tuesday, January 19, 2010
Setting up CUDA projects with Visual Studio 2008
1. Download the latest CDUA Tookit and CUDA SDK from here and install them.
2. Set System Environment Variables $(CUDA_INC_PATH), $(CUDA_LIB_PATH), $(NVSDKCUDA_ROOT)
3. Create an empty project in Visual Studio 2008, right click the name of the project and from the pop menu, choose "Custom Build Rules...". Then import "Cuda.Rules" from $(NVSDKCUDA_ROOT)/C/common and check "CUDA Build Rule".
4. Set up the properties of the project.
Set the configuration to 'All configurations' then
C/C++ -> General -> Additional Included Directories:
$(CUDA_INC_PATH);$(NVSDKCUDA_ROOT)/common/inc
Linker -> General -> Additional Library Directories:
$(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib
Linker -> Input -> Additional Dependecy:
cudart.lib cutil32.lib
5. Create two new configurations, EmuDebug and EmuRelease. Right click the name of solution and select "Configuration Manager...".
In the popped up dialog, create 'EmuDebug' by copying the 'Debug' configuration and 'EmuRelease' configuration by copying 'Release' configuration.
6. set Debug configuration,
C/C++ -> General -> Debug Information Format: Program Database (/Zi)
C/C++ -> Code Generation -> Runtime Library: Multi-threaded Debug (/MTd)
7. set EmuDebug configuration,
CUDA Build Rule -> General -> Generate Debug Information: Yes(-D_DEBUG)
CUDA Build Rule -> General -> Emulation Mode: Yes(-deviceemu -D_DEVICEEMU)
CUDA Build Rule -> General -> Optimization: Disabled(/Od)
8. Some .cu files can be Excluded from Build.
2. Set System Environment Variables $(CUDA_INC_PATH), $(CUDA_LIB_PATH), $(NVSDKCUDA_ROOT)
3. Create an empty project in Visual Studio 2008, right click the name of the project and from the pop menu, choose "Custom Build Rules...". Then import "Cuda.Rules" from $(NVSDKCUDA_ROOT)/C/common and check "CUDA Build Rule".
4. Set up the properties of the project.
Set the configuration to 'All configurations' then
C/C++ -> General -> Additional Included Directories:
$(CUDA_INC_PATH);$(NVSDKCUDA_ROOT)/common/inc
Linker -> General -> Additional Library Directories:
$(CUDA_LIB_PATH);$(NVSDKCUDA_ROOT)\common\lib
Linker -> Input -> Additional Dependecy:
cudart.lib cutil32.lib
5. Create two new configurations, EmuDebug and EmuRelease. Right click the name of solution and select "Configuration Manager...".
In the popped up dialog, create 'EmuDebug' by copying the 'Debug' configuration and 'EmuRelease' configuration by copying 'Release' configuration.
6. set Debug configuration,
C/C++ -> General -> Debug Information Format: Program Database (/Zi)
C/C++ -> Code Generation -> Runtime Library: Multi-threaded Debug (/MTd)
7. set EmuDebug configuration,
CUDA Build Rule -> General -> Generate Debug Information: Yes(-D_DEBUG)
CUDA Build Rule -> General -> Emulation Mode: Yes(-deviceemu -D_DEVICEEMU)
CUDA Build Rule -> General -> Optimization: Disabled(/Od)
8. Some .cu files can be Excluded from Build.
Saturday, August 8, 2009
Friday, July 31, 2009
Discrete Cosine Transform(DCT)
- What is DCT?
DCT can be regarded as axis rotation because it is one of a family of distance preserving transforms. For example, when a image is processed by DCT, the total energy of the values remains constant but only the energy distribution has been changed into a few coefficients.
- How to calculate DCT's coefficients?
The equation is evaluated 64 times, once for each DCT coefficient of the block. Each evaluation uses every one intensity value of pixel of the block, f(x,y).
- Basis Functions
The basis function is the pixel pattern that results when that particular DCT coefficient is set to its maximum value, and all the other coefficients are set to zero.
As a simple example, if F(0,0) is set to 256, and all the others are set to zero, every pixel in the block evaluates to 32. F(0,0) is also called DC coefficient, or a scaled average value of the block.
The basis functions represent 64 different arrays of pixel values. Given a set of DCT coefficients, the inverse transform operation consists of multiplying each basis function by its corresponding coefficient, the summing of the 64 sets of pixel values. The pixel values of the basis functions, and the different distribution of the values, mean that with an appropriate set of coefficients we can generate any pattern of pixel values.
If we take this inverse approach, the forward transform is the process of finding the set of 64 coefficients that, when multiplied by the 64 coefficients, yields the original 64 pixel values.
Subscribe to:
Posts (Atom)