2013년 10월 4일 금요일

opencl helloworld


I made sample opencl program under VS2010
It just do squre float values.

I refered "opencl programming guide" sample for reading cl source from file.
It is more simple and easier to beginner.

dwonload vs2010 project here

2013년 8월 26일 월요일

openCL VS2010 Project


1. Add CUDA include directory
Project properties > General > C/C++ > General > Additional Include Directory > Edit
then add
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include

2. Add OpenCL Libs
Project properties > linker > input > addtional dependency
then add
OpenCL.lib

3. 4. Add OpenCL Lib Path
Project properties > linker > general > additional library directory
then add
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\lib\Win32

In CUDA toolkit, opecCL path is same with CUDA path
When you write include header in source, add just CL path
For example

#include <CL/cl.h>

2013년 8월 25일 일요일

CUDA VS2010 project setup


After new VS 2010 project ,
It needs to add CUDA related enviroment setup

1. ADD CUTA in specifying custom build tools
 Right Click project file then select "specifying custom build tools"
Check CUDA 5.0 , Press OK














2. Add CUDA include directory
Project properties > General > C/C++ > General > Additional Include Directory > Edit
then add
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include

3. Add CUDA Libs
Project properties > linker > input > addtional dependency
then add
cuda.lib;cudart.lib

4. Add CUDA Lib Path
Project properties > linker > general > additional library directory
then add
$(CudaToolkitLibDir)

Now We can write down basic CUDA API in program.

2013년 7월 7일 일요일

install opencv on windows


------------------------------------------------------
opencv officail home
------------------------------------------------------
http://opencv.org/

------------------------------------------------------
download
------------------------------------------------------
http://opencv.org/downloads.html

1. extract donwload opencv package where do you want to install
-  I used opencv 2.4.6
-  My installation DIR is C:\opencv_2.4.6
- I test it under VC10

2. set opencv enviroment variable and add path
- open console then enter below command
 $ setx -m OPENCV_DIR C:\opencv_2.4.6\build\x86\vc10
- add path
%OPENCV_DIR%\bin

3. create sample project in VS







4. select property manager(?) tab and right click Debug | Win32 then add new project propery





















5. Type the name then create

















 6. right click the create property sheet, then select propery












7. move c/c++  then add additional include directory C:\opencv_2.4.6\build\include
















8. move link, then add additional library directory C:\opencv_2.4.6\build\x86\vc10\lib

















8. move link, input directory then add additional dependency and add below libs
 
opencv_core246d.lib
opencv_imgproc246d.lib
opencv_highgui246d.lib
opencv_ml246d.lib
opencv_video246d.lib
opencv_features2d246d.lib
opencv_calib3d246d.lib
opencv_objdetect246d.lib
opencv_contrib246d.lib
opencv_legacy246d.lib
opencv_flann246d.lib
















9 .make main functin as like below
 
#include "stdafx.h"
#include <opencv\cv.h>
#include <opencv\highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
 IplImage * image = cvLoadImage("C:\\Hydrangeas.jpg", 1);
 cvShowImage("test image", image);
 cvWaitKey(0);
 cvReleaseImage(&image);
 return 0;
}
 
then build and run

















 

2013년 6월 9일 일요일

opencl test under LG optimus G

I run clinfo application under LG Optimus G


setup opencl develop enviroment on Android


I used sample source code of aopencl clinfo sample under ubutu 10.04 LTS

Download aopencl

hg clone http://code.google.com/p/aopencl


before download source code of aopencl , install mercurial

JDK download and install

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Download android sdk

http://developer.android.com/sdk/index.html

download ADT bundle, it includes the essential Android SDK components

NDK download

http://developer.android.com/tools/sdk/ndk/index.html

Install adn 1.8 in your PC

$ sudo apt-get install ant1.8

Setup build path

- add platform tools and sdk tools to PATH
$ export PATH=/opt/adt/adt-bundle-linux-x86_64-20130522/sdk/platform-tools/:/opt/adt/adt-bundle-linux-x86_64-20130522/sdk/tools/:/opt/ndk/android-ndk-r8e:$PATH

- export ndk path
$ export NDK=/opt/ndk/android-ndk-r8e

- build ndk lib
move to clinfo directory then ndk-build






- update project as you want for example
$ android update project -p . -n clinfo -t 2












- make package
$ ant debug












then you can find clinfo-debug.apk in clino/bin

- download your android phone then install and run
it can works on nexus 4 or over



-



2013년 5월 18일 토요일

opencl sample makefile


Here is the skeleton of my Makefiles for opencl
It almost same as normal unix application Makefile
Add just opencl libs and opencl include directory
It is based on AMD Streaming SDK



Here is the result... I used helloworld sample of opencl programming guide