Programming/web 관련2011. 3. 9. 09:58
예전에 대충 본적은 있지만, 써본건 첨이라 대충 정리


Chrome
크롬은 우클릭 메뉴에서 "요소 검사" 를 누른다.

그리고는 하단의 돋보기를 클릭하고

원하는 지점을 선택하여 클릭하면 아래에 HTML 소스가 나타난다.



Internet Explorer 8
IE는 도구 - 개발자 도구 를 누르거나 F12를 누르면 된다.
(버그인지 가끔 연결이 안되는데 그럴때는 IE를 재시작해야 한다 -_-)


개발자 도구의 "클릭으로 요소 선택" 이라는 커서 아이콘을 누르면

아래와 같이 특정 영역이 박스로 쳐지면서 클릭시, 개발자 도구에 소스가 나타난다.

개인적으로는 CSS 속성을 껐다 켰다 할 수 있는 IE8 쪽을 추천하고 싶다.

'Programming > web 관련' 카테고리의 다른 글

wan 에서 mac address 얻기  (0) 2013.07.09
축약주소 만들기 서비스  (0) 2013.07.08
php-mobile-detect  (0) 2013.02.23
php if/else/echo  (0) 2012.11.30
TD 태그 - Chrome 과 IE 차이?  (0) 2011.05.30
Posted by 구차니
Programming/openGL2011. 3. 7. 09:57
문서를 찾아봐도 딱히 연관관계에 관한 내용이 없어서 대충 끄적끄적 정리 -_-


openGL은 렌더링에 관련된 라이브러리로 내부에 정해진 쉐이더가 존재한다.(라고 하는데 알리가 없잖아 -_-)
이러한 쉐이더를 제어할 수 있는 녀석이 GLSL(Graphic Library Shader Language)이고
이를 편하게 하기 위해 만들어 진것이 GLEW(GL extension Wrangler Library) 이다.

그리고 openGL에 그리거나 조작을 할 수 있는 함수가
GLU(GL Utility library) 이고, GLU/GL에는 키보드나 마우스 등의 입력에 관한 처리가 없으므로
이를 처리해서 통합적으로 관리해주는 것이 GLUT(GL Utility Toolkit) 이다.

아무튼 GLUT의 경우에는 OS에 따른 플랫폼을 포함하므로 openGL과 GLUT사이에는
GLX(GL extension for unix/Linux Xwindow) 혹은 WGL(GL extension for Microsoft Windows)가 존재할 듯?
XGL은 GLX를 지원하는 Xserver라고 한다.



'Programming > openGL' 카테고리의 다른 글

GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
openGL tutorial  (0) 2011.03.12
openGL - GLUT  (0) 2010.08.26
glBegin() / glEnd()  (3) 2010.08.23
openGL 문서들  (0) 2010.08.22
Posted by 구차니
Programming/openCL & CUDA2011. 3. 2. 18:23
3.2도 못해봤는데 4.0이라니 언제따라가?!?!?! ㅠ.ㅠ

Release Highlights

Easier Application Porting

  • Share GPUs across multiple threads
  • Use all GPUs in the system concurrently from a single host thread
  • No-copy pinning of system memory, a faster alternative to cudaMallocHost()
  • C++ new/delete and support for virtual functions
  • Support for inline PTX assembly
  • Thrust library of templated performance primitives such as sort, reduce, etc.
  • NVIDIA Performance Primitives (NPP) library for image/video processing
  • Layered Textures for working with same size/format textures at larger sizes and higher performance

Faster Multi-GPU Programming

  • Unified Virtual Addressing
  • GPUDirect v2.0 support for Peer-to-Peer Communication

New & Improved Developer Tools

  • Automated Performance Analysis in Visual Profiler
  • C++ debugging in cuda-gdb
  • GPU binary disassembler for Fermi architecture (cuobjdump)

Please refer to the Release Notes and Getting Started Guides for more information.


[링크 : http://developer.nvidia.com/object/cuda_4_0_RC_downloads.html]


Posted by 구차니
Programming/openCL & CUDA2011. 2. 5. 23:42
CUDA Driver API나 Runtime API는 원칙적으로 하나의 GPU를 사용하여
하나의 GPU내의 멀티쓰레드를 사용하도록 설계되어 있다. 이러한 제어의 관리를 컨텍스트 라고 지칭해도 될 지 모르겠지만
이러한 기본 컨텍스트는 1번 GPU를 사용하도록 되어있고,
Runtime API 쪽에서는 cudaSetDevice (int device) 라는 함수로 특정 GPU를 사용하도록 제한할 수 있다.

하지만 Driver API에는 이러한 함수가 존재하지 않으므로
직접 Handle을 이용하여 openMP 나 thread 등을 이용하여 직접 여러개의 CPU 쓰레드를 이용하여
GPU를 여러개 동시에 가동시키는 방법을 사용하는 것으로 보여진다.

8.2  Multi-GPU Programming 

 In order to issue work to a GPU, a context is established between a CPU thread and the GPU.  Only one context can be active on GPU at a time.  Similarly, a CPU thread can have one active context at a time.  A context is established during the program’s first call to a function that changes state (such as cudaMalloc(), etc.), so one can force the creation of a context by calling cudaFree(0).  Note that a context is created on GPU 0 by default, unless another GPU is selected explicitly prior to context creation with a cudaSetDevice() call.  Context is destroyed either with a cudaThreadExit() call, or when the controlling CPU thread exits.

 CUDA driver API allows a single CPU thread to manage multiple contexts (and therefore multiple GPUs) by pushing/popping contexts.  In the remainder of the document we will focus on CUDA runtime API, which currently allows strictly one context per CPU thread. 

 In order to issue work to p GPUs concurrently, a program needs p CPU threads, each with its own context. Threads can be lightweight (pthreads, OpenMP, etc.) or heavyweight (MPI).  Note that any CPU multi-threading or message-passing API or library can be used, as CPU thread management is completely orthogonal to CUDA.  
For example, one can add GPU processing to an existing MPI application by porting the compute-intensive portions of the code without changing the communication structure. 

 Even though a GPU can execute calls from one context at a time, it can belong to multiple contexts.  For example, it is possible for several CPU threads to establish contexts with the same GPU.  This allows developing multi-GPU applications on a single GPU.  GPU driver manages GPU switching between the contexts, as well as 
partitioning memory among the contexts (GPU memory allocated in one context cannot be accessed from another context). 

[출처 : CUDA_C_Best_Practices_Guide.pdf / Chapter 8]

CUDA Toolkit SDK의 예제는 threadMigration를 참조하면 될 듯
/******************************************************************************
*
*   Module: threadMigration.cpp
*
*   Description:
*     Simple sample demonstrating multi-GPU/multithread functionality using 
*     the CUDA Context Management API.  This API allows the a CUDA context to be
*     associated with a CPU process.  CUDA Contexts have a one-to-one correspondence 
*     with host threads.  A host thread may have only one device context current 
*     at a time.
*
*    Refer to the CUDA programming guide 4.5.3.3 on Context Management
*
******************************************************************************/


MonteCarloMultiGPU 예제에도 cutil 을 이용한 예제가 존재하는 것으로 보인다.
       //Start CPU thread for each GPU
        for(gpuIndex = 0; gpuIndex < GPU_N; gpuIndex++)
            threadID[gpuIndex] = cutStartThread((CUT_THREADROUTINE)solverThread, &optionSolver[gpuIndex]);

    printf("main(): waiting for GPU results...\n");
        cutWaitForThreads(threadID, GPU_N);

cutStartThread는 multithreading.h 에 포함되어 있는 녀석이다.
#if _WIN32
    //Create thread
    CUTThread cutStartThread(CUT_THREADROUTINE func, void *data){
        return CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, data, 0, NULL);
    }
#endif
그리고 이런식으로 해당 OS의 Thread로 연결되어 있다.

'Programming > openCL & CUDA' 카테고리의 다른 글

CUDA processor roadmap / CUDA SDK 4.0  (1) 2011.07.03
CUDA 4.0 RC  (4) 2011.03.02
CUDA driver API / runtime API  (0) 2011.01.26
SLI에 대한 CUDA의 제한(과거에는 그랬다더라~)  (0) 2011.01.26
cuBLAS / BLAS Level 1,2,3  (0) 2011.01.24
Posted by 구차니
Programming/openMP2011. 2. 5. 22:58
CUDA를 보다가 context 관련 해서 나온 또 다른(?) open계열 API

대충 보니까, CPP(C Pre-Processor/매크로 프로세서)의 도움을 받아
#pragma 형식으로 확장을 하여 Multi Processor를 지원하는 것으로 보인다.



'Programming > openMP' 카테고리의 다른 글

openMP 문서들  (0) 2012.06.18
openmp for문 나누기  (0) 2012.06.18
libgomp 공식 사이트 / 문서  (0) 2012.06.10
우분투에서 openMP 예제  (0) 2012.06.09
openMP / gcc -fopenmp  (0) 2012.06.09
Posted by 구차니
Programming/openCL & CUDA2011. 1. 26. 22:59
SDK 예제를 보다보니 drv 라는 접미가 붙은 샘플이 있어서
내용을 보다보니, Driver API를 이용한 것이라고 기술되어 있다.

아무튼 CUDA는 Runtime API와 Driver API로 구분이 되는데
접두가 cuda(RT)와 cu(driver)로 나뉜다.

[링크 : http://developer.download.nvidia.com/.../group__CUMEM.html]                  Driver - Memory 




음.. 이거 이미지 하나로 설명 끝?
Runtime은 결국 Driver API를 감싼것이고, 결국에는 Driver API보다는 성능의 저하는 감수할 수 밖에 없을듯.

'Programming > openCL & CUDA' 카테고리의 다른 글

CUDA 4.0 RC  (4) 2011.03.02
CUDA - Multi GPU 프로그래밍  (1) 2011.02.05
SLI에 대한 CUDA의 제한(과거에는 그랬다더라~)  (0) 2011.01.26
cuBLAS / BLAS Level 1,2,3  (0) 2011.01.24
CUDA 관련 해외글  (0) 2011.01.22
Posted by 구차니
Programming/openCL & CUDA2011. 1. 26. 20:21
과거에는 CUDA 드라이버가 SLI 사용시에는 첫 GPU만 보이도록 제한되어 있었는데 이제는 그러한 제한이 풀렸다.
라는 이야기 -_-
일단 공식 내용은 발견못했으니 카더라 통신으로 일단 만족.

 In the past, the CUDA driver had a limitation and would only show you the first GPU if you had SLI enabled. That restriction has been removed, and now you will see both devices even if SLI is turned on. SLI is only beneficial to 3D rendering. 

[링크 : http://forums.nvidia.com/index.php?showtopic=186498]

'Programming > openCL & CUDA' 카테고리의 다른 글

CUDA - Multi GPU 프로그래밍  (1) 2011.02.05
CUDA driver API / runtime API  (0) 2011.01.26
cuBLAS / BLAS Level 1,2,3  (0) 2011.01.24
CUDA 관련 해외글  (0) 2011.01.22
CUDA에서 grid 와 thread 의 갯수에 대한 짧은생각  (2) 2011.01.18
Posted by 구차니
Programming/openCL & CUDA2011. 1. 24. 23:05
cuda kernel만 보다가 머리가 아파서 잠시 BLAS로 외도 
FFT도 잠시 보다가 외계어에서 좌절 OTL

CUBLAS_Library_3.1.pdf 을 읽다 보니, BLAS에도 레벨이 있다고 한다.
Level 1 Basic Linear Algebra Subprograms (BLAS1)
             are functions that perform scalar, vector, and vector‐vector operations. 

The Level 2 Basic Linear Algebra Subprograms (BLAS2) are functions that perform matrix‐vector operations.

Level 3 Basic Linear Algebra Subprograms (BLAS3) perform matrix‐matrix operations.


혹시나 해서 CUDA에서만 적용되는 건가 해서 찾아 봤더니 원래 BLAS에 있는 개념이다.
Posted by 구차니
Programming/openCL & CUDA2011. 1. 22. 00:11
CUDA를 보면서 헷갈리는 것은
nvidia의 문서라고 해도 버전에 따라서 용어가 혼용이 되어있기 때문이다.

현재로서 가장 혼동을 일으키는 용어는 바로 grid / block / thread 이다.
DeiveQurey 프로그램에서 주는 값들 중, 위의 녀석들의 Dimension(차수)이 바로 범인인데..
여러가지 프리젠테이션들과 문서들을 조합할수록 불일치가 발생을 해서 머리를 아프게 한다.

아무튼 Grid는 Block들로 구성되므로, Grid의 최대 차수는
Block의 차수를 의미하고, Block은 2차원 내지는 1차원으로만 구성이 된다.
그리고 Block은 65535x65535x1 개 까지 구성이 가능하다.

개별 Block은 thread로 구성이 되며, 블럭은 개별 MultiProcessor에 제한된다.
8800GT의 경우 1개의 MP에 512개의 Thread 들이 존재하며,
그런 이유로 3차원으로 구성을 한다고 해도 x*y*z의 곱은 512를 넘을수 없다.
(물론 상위 버전은 768까지 제한이 조금 커진다)

다시 정리하자면
Maximum number of threads per block:           512
Maximum sizes of each dimension of a block:    512 x 512 x 64
위의 값은, 블럭의 최대 차수는 3차원으로 512*512*64 이지만
세 차수의 곱이 512를 넘을수는 없다라는 의미이다.

Maximum sizes of each dimension of a grid:     65535 x 65535 x 1
block은 2차원으로 65535x65535를 넘을 수 없다는 의미이다.

Posted by 구차니
Programming/openCL & CUDA2011. 1. 18. 22:29
DeviceQuery 프로그램을 실행하면 다음과 같은 내용이 나온다.
  Maximum sizes of each dimension of a block:    512 x 512 x 64
  Maximum sizes of each dimension of a grid:     65535 x 65535 x 1

블럭의 차원은 512x512x64 3차원으로 구성이 가능하고
그리드의 차원은 65535x65535x1 2차원으로 구성이 가능하다.

여전히 그리드와 블럭 쓰레드, 이러한 연관관계가 확실히 정립된게 아니라 헷갈리지만
kernel<<<block,thread>>>(agrs) 에서
그리드의 차원은 block 이고 
블럭의 차원은 thread 인거 같은데(아무래도 차수가 제한된게 같으니까)

실제로 존재하는 쓰레드의 갯수라던가, 멀티프로세서의 갯수를 감안하면 절대 불가능한 수치이다.
8800GT의 경우
14개의 멀티프로세서와 개당 8개씩의 코어(쓰레드 블럭)이 존재함으로
총 112개의 쓰레드 블럭이 존재하기 때문에
물리적으로는 블럭의 차원은 14x8x1 정도가 한계라고 볼 수 있다.


하지만, 논리적으로는 한번의 처리단위가 14x8x1 이므로
X/Y/Z 차원으로 n번씩 반복하게 되면 돌릴수 있게 되고 이럴경우
X차원으로는 37번
Y차원으로 64번
Z차원으로 64번 이런식으로 더 반복하게 하면 무리없이 가능하다.


내부적으로 BlockIdx 라는 변수만 thread block 에서 값만 바꾸어서 넘겨주면 되니까 말이다.




결론 : 위에서 명시되는 최대차원은 논리적으로 제한을 둔 값으로 생각된다.

'Programming > openCL & CUDA' 카테고리의 다른 글

cuBLAS / BLAS Level 1,2,3  (0) 2011.01.24
CUDA 관련 해외글  (0) 2011.01.22
CUDA 3.1과 3.2의 devicequery 결과 차이점  (0) 2011.01.18
vectorAdd 를 이용한 CUDA 연습  (0) 2011.01.18
CUDA 메모리별 범위(scope)  (0) 2011.01.17
Posted by 구차니