프로그램 사용/autocad2014. 1. 17. 22:45
오토캐드는 기본적으로 명령어로 제어가 가능하고
아이콘이 생긴 신규버전이라고 하더라도 되도록이면 명령어로 쓰는게 좋다고 한다.
(그러면 역으로 구버전도 사용이 가능하니)


학원에서는 2010 버전을 쓰는데 이넘은.. 파일로 제공하더니만.
2011은 autodesk 사의 홈페이지로 바로 연결이 된다. -_-

[링크 : http://docs.autodesk.com/ACD/2011/ENU/landing.html]
  [링크 : http://docs.autodesk.com/ACD/2011/ENU/filesACR/WSfacf1429558a55de6d0beb1006696e53b-619b.htm] 명령어
  [링크 : http://docs.autodesk.com/ACD/2011/ENU/pdfs/acad_acr.pdf] 명령어 pdf 버전
  [링크 : http://docs.autodesk.com/ACD/2011/ENU/filesACR/WSfacf1429558a55de6d0beb1006696e53b-6076.htm] 변수

'프로그램 사용 > autocad' 카테고리의 다른 글

원 채우기  (0) 2018.05.01
캐드 명령어 이것저것  (0) 2018.01.09
autocad 명령어  (0) 2018.01.08
autolisp  (0) 2014.03.17
Autocad 학원 수강 3일차  (0) 2014.01.17
Posted by 구차니
프로그램 사용/autocad2014. 1. 17. 22:36
끙끙대면서 거의 40분에 걸쳐 그린 도면 ㅠㅠ
이래서 ATC 2급 딸 수 있으려나? ㅠㅠ


'프로그램 사용 > autocad' 카테고리의 다른 글

원 채우기  (0) 2018.05.01
캐드 명령어 이것저것  (0) 2018.01.09
autocad 명령어  (0) 2018.01.08
autolisp  (0) 2014.03.17
AutoCad 2011 도움말 - 명령어  (0) 2014.01.17
Posted by 구차니
Programming/openCL & CUDA2014. 1. 17. 19:41
어제 했던 소스에서 대충 openmp 적용해봄
2014/01/16 - [Programming/openCL / CUDA] - cuda 1차원 데이터, 2차원 처리 예제

CUDA Runtime API - Host - Extra C++ Options 에서 /openmp 를 추가하면 된다.

[링크 : https://devtalk.nvidia.com/.../vs2010-cuda4rc2-howto-compile-openmp-host-code...]

물론 #inclued <omp.h>를 추가하지 않으면
컴파일 시에는 문제가 없으나 실행시에 이런 문제가 발생한다.

[링크 : http://blog.naver.com/changfull7/70110120004]

openmp 적용
cpu Time : 0.048000
gpu Time : 0.001000 

openmp 미적용
cpu Time : 0.131000
gpu Time : 0.001000  


#include < stdio.h >
#include < stdlib.h >
#include < time.h >
#include < omp.h > #include "cuda_runtime.h" #define BLOCK_WID 128 #define THREAD_WID 32 #define ARRAY_SIZE (THREAD_WID * THREAD_WID * BLOCK_WID * BLOCK_WID) __global__ void kernel_test(int *a, int *b, int *c) { int idx = threadIdx.x +blockIdx.x * blockDim.x + (gridDim.x * blockDim.x) * (blockIdx.y * blockDim.y + threadIdx.y); c[idx] = a[idx] + b[idx]; } void main() { clock_t start_time, end_time; int *a, *b, *c, *res; int *dev_a,*dev_b,*dev_c; int idx = 0; dim3 block(BLOCK_WID,BLOCK_WID); dim3 thread(THREAD_WID,THREAD_WID); a = (int *)malloc(ARRAY_SIZE * sizeof(int)); b = (int *)malloc(ARRAY_SIZE * sizeof(int)); c = (int *)malloc(ARRAY_SIZE * sizeof(int)); res = (int *)malloc(ARRAY_SIZE * sizeof(int)); // initialize srand (time(NULL));
#pragma omp parallel for for(idx = 0;idx < ARRAY_SIZE ; idx++) { a[idx] = rand() & 0xFFFF; b[idx] = rand() & 0xFFFF; c[idx] = 0; } start_time = clock();
#pragma omp parallel for for(idx = 0;idx < ARRAY_SIZE ; idx++) { res[idx] = a[idx] + b[idx]; } end_time = clock(); printf("cpu Time : %f\n", ((double)(end_time-start_time)) / CLOCKS_PER_SEC); cudaMalloc(&dev_a, ARRAY_SIZE * sizeof(int)); cudaMalloc(&dev_b, ARRAY_SIZE * sizeof(int)); cudaMalloc(&dev_c, ARRAY_SIZE * sizeof(int)); cudaMemcpy(dev_a, a, ARRAY_SIZE * sizeof(int), cudaMemcpyHostToDevice); cudaMemcpy(dev_b, b, ARRAY_SIZE * sizeof(int), cudaMemcpyHostToDevice); start_time = clock(); kernel_test<<<block,thread>>>(dev_a,dev_b,dev_c); end_time = clock(); printf("gpu Time : %f\n", ((double)(end_time-start_time)) / CLOCKS_PER_SEC); cudaMemcpy(c, dev_c, ARRAY_SIZE * sizeof(int), cudaMemcpyDeviceToHost); for(idx = 0;idx < ARRAY_SIZE ; idx++) { if(res[idx] != c[idx]) { printf("%5d a:%5d b:%5d c:%5d", idx, a[idx], b[idx], c[idx]); if(res[idx] != c[idx]) printf(" != "); else printf(" == "); printf("r:%5d\n",res[idx]); break; } } cudaFree(dev_a); cudaFree(dev_b); cudaFree(dev_c); free(a); free(b); free(c); free(res); }

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

cuda 6.0 rc  (0) 2014.02.15
cuda + openmp 프로젝트 생성은....  (0) 2014.01.17
cuda 1차원 데이터, 2차원 처리 예제  (4) 2014.01.16
CUDA 쓰레드 계산  (0) 2014.01.15
visual studio 2008 nsight 실행..된거 맞나?  (0) 2014.01.15
Posted by 구차니
Programming/openCL & CUDA2014. 1. 17. 11:44
사용자 지정 빌드규칙을 추가하면 된다는데 빌드는 아직 안해봤고


문제는 cuda 프로젝트로 생성시


프로젝트에 디버깅 아래 C/C++이 존재하지 않는다.


아무튼.. C/C++ 의 언어에 OpenMP가 있으므로
CUDA와 OpenMP를 동시에 사용하려면 일반프로젝트 생성 + CUDA 사용자 룰 추가 이런식으로 해야 할 듯 하다.


결론 : 일단은.. openMP + CUDA는 생각하지 말자.. 귀차나 ㅠㅠ

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

cuda 6.0 rc  (0) 2014.02.15
cuda + openmp 적용 예제  (0) 2014.01.17
cuda 1차원 데이터, 2차원 처리 예제  (4) 2014.01.16
CUDA 쓰레드 계산  (0) 2014.01.15
visual studio 2008 nsight 실행..된거 맞나?  (0) 2014.01.15
Posted by 구차니
다른건 그리 안끌리는데 Strike Suit Zero 라는거에 삘 꽃혀서 질러버렸다 ㅠㅠ
Surgeon Simulator 2013는 이미 있는데 해보지 않았고.. 지인에게나 줘버려야지 ㅋㅋㅋ



'게임 > 오리진&스팀&유플레이' 카테고리의 다른 글

MDK 할인!  (0) 2014.03.19
몰라 걍 질러  (0) 2014.03.10
간만에 게임 목록  (0) 2013.12.29
스팀 연말 할인 시작!!  (0) 2013.12.22
리눅스 스팀 설치!  (0) 2013.12.17
Posted by 구차니
개소리 왈왈2014. 1. 16. 23:19
아침에는 수영
오후에는 학원 
그리고 간간히 고용센터 방문


왜이리 힘들고 피곤할까 ㅠㅠ
백수인게 원래 더 바쁘고 힘들다지만 ㅠㅠ 
Posted by 구차니
Programming/openCL & CUDA2014. 1. 16. 00:03
Phenum2 945(3.0Ghz) / GTX650

cpu Time : 0.131000
gpu Time : 0.001000

일단.. 싱글 코어로 돌려서 130msec 정도 
GPU로 돌려서 동일 연산이 1msec 미만으로 걸린다.. ㄷㄷㄷ

일단 32*32*128*128*4 로
총 1024개의 쓰레드를 동시에 돌리고
16,384 개의 블럭으로 연산을 한다.
67,108,864 byte 대략 64MB + 64MB = 64MB 용량의 연산을 하는 소스이다.

#include < stdio.h >
#include < stdlib.h >
#include < time.h >

#include "cuda_runtime.h"

#define BLOCK_WID	128
#define THREAD_WID	32
#define ARRAY_SIZE	 (THREAD_WID * THREAD_WID * BLOCK_WID * BLOCK_WID)

__global__ void kernel_test(int *a, int *b, int *c)
{
	int idx = threadIdx.x +blockIdx.x * blockDim.x + (gridDim.x * blockDim.x) * (blockIdx.y * blockDim.y + threadIdx.y);
	c[idx] = a[idx] + b[idx];
}

void main()
{
	clock_t start_time, end_time;
	int *a, *b, *c, *res;
	int *dev_a,*dev_b,*dev_c;
	unsigned int idx = 0;
	dim3 block(BLOCK_WID,BLOCK_WID);
	dim3 thread(THREAD_WID,THREAD_WID);

	a = (int *)malloc(ARRAY_SIZE * sizeof(int));
	b = (int *)malloc(ARRAY_SIZE * sizeof(int));
	c = (int *)malloc(ARRAY_SIZE * sizeof(int));
	res = (int *)malloc(ARRAY_SIZE * sizeof(int));

	// initialize
	srand (time(NULL));
	for(idx = 0;idx < ARRAY_SIZE ; idx++)
	{
		a[idx] = rand() & 0xFFFF;
		b[idx] = rand() & 0xFFFF;
		c[idx] = 0;
	}

	start_time = clock();
	for(idx = 0;idx < ARRAY_SIZE ; idx++)
	{
		res[idx] = a[idx] + b[idx];
	}
	end_time = clock();
	printf("cpu Time : %f\n", ((double)(end_time-start_time)) / CLOCKS_PER_SEC); 

	cudaMalloc(&dev_a, ARRAY_SIZE * sizeof(int));
	cudaMalloc(&dev_b, ARRAY_SIZE * sizeof(int));
	cudaMalloc(&dev_c, ARRAY_SIZE * sizeof(int));

	cudaMemcpy(dev_a, a, ARRAY_SIZE * sizeof(int), cudaMemcpyHostToDevice);
	cudaMemcpy(dev_b, b, ARRAY_SIZE * sizeof(int), cudaMemcpyHostToDevice);

	start_time = clock();
	kernel_test<<<block,thread>>>(dev_a,dev_b,dev_c);
	end_time = clock();
	printf("gpu Time : %f\n", ((double)(end_time-start_time)) / CLOCKS_PER_SEC); 

	cudaMemcpy(c, dev_c, ARRAY_SIZE * sizeof(int), cudaMemcpyDeviceToHost);

	for(idx = 0;idx < ARRAY_SIZE ; idx++)
	{
		if(res[idx] != c[idx])
		{
			printf("%5d a:%5d b:%5d c:%5d", idx, a[idx], b[idx], c[idx]);
			if(res[idx] != c[idx])
					printf(" != ");
			else	printf(" == ");
			printf("r:%5d\n",res[idx]);
			break;
		}
	}

	cudaFree(dev_a);
	cudaFree(dev_b);
	cudaFree(dev_c);

	free(a);
	free(b);
	free(c);
	free(res);
}

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

cuda + openmp 적용 예제  (0) 2014.01.17
cuda + openmp 프로젝트 생성은....  (0) 2014.01.17
CUDA 쓰레드 계산  (0) 2014.01.15
visual studio 2008 nsight 실행..된거 맞나?  (0) 2014.01.15
nsight 설치... -_-  (0) 2014.01.15
Posted by 구차니
Programming/openCL & CUDA2014. 1. 15. 21:58
머리를 데굴데굴 굴려봐도 깔끔한 계산식이 안나온다..
걍 2차원 배열로 하는수 밖에 없으려나?

일단 1차원으로 할당한 녀석을 2차원 block/thread 로 구성시에 대한 수식이다.

threadIdx.x +blockIdx.x * blockDim.x
+ (gridDim.x * blockDim.x) * (blockIdx.y * blockDim.y + threadIdx.y);

근데.. 걍.. 데이터를 2차원 으로 해서 하는게 속 편할지도 모르겠네...


뻘짓 끝에 디버거로 돌려보니..
blockIdx 에는 thread block의 dimension이 들어간다....

다시 글들을 보니..
block에 대한 카운트와 인덱스는 gridDim blockIdx에서
thread에 대한 카운트와 인덱스는 blockDim threadIdx 에서 내장변수로 제공한다.

---
끄아아.. 벌써 세번째 글이었구나 ㅠㅠ

2011/01/16 - [Programming/openCL / CUDA] - CUDA 내장변수 - built in variable
2012/04/30 - [Programming/openCL / CUDA] - cuda 내장변수 
Posted by 구차니
Programming/openCL & CUDA2014. 1. 15. 11:29
Visual Studio 2008 SP1설치후
CUDA 5.5 재설치 - Nsight Visual Studio Edition
음.. 그런데 이녀석.. CUDA SDK에 포함되어서 굳이 Nvidia에서 가입/등록하고 안해도 되네?
물론.. SDK를 통채로 다운받아서 갈아 엎어야 하는 귀차니즘이 있긴 하겠지만..


Installed에 똭! 추가!


기본 값은 Launcher debugging enabled False이므로


True로 바꾸어 주고(위에것도 해야하려나?)


VS2008의 디버거를 사용하지 말고 그냥
Start CUDA Debugging을 누르면 지가 알아서 실행되고 프로파일링 한다.


머하다가 이게 떴더라..?


막 누르다 보니.. 정신없는데..
Application Control에 Launch를 누르면 프로그램이 실행되면서
Nsight에서 녹화하고 그 데이터를 기반으로 디버깅 정보를 출력한다.


Summary Report 아직 보는 법은 모르겠고


nsight를 설치해서인지 VS2008 자체 디버거로 실행시 kernel에서 내장 변수들이 출력된다.
근데.. 막 건너뛰는 기분..(마스터 쓰레드만 하나 출력되려나?)


Posted by 구차니
Programming/openCL & CUDA2014. 1. 15. 10:41
Nsight는 VS2008일 경우 SP1 이상을 요구한다

Requirement not met: Service Pack 1 for Microsoft Visual Studio 2008 was not found.


하지만 문제는 Nsight 샘플 프로젝트가 없다는 것!!!


분위기로 봐서는.. CUDA 5.5 설치시에
VS2008 SP1이 없어서 Nsight for Visual Studio 2008이 설치 되지 않으면서 생긴 문제로 생각되니..
이래저래 CUDA 5.5도 전부 다시 재설치.. 끄아아 ㅠㅠ


[링크 : https://developer.nvidia.com/install-nsight-visual-studio-edition]
Posted by 구차니