태그 보관물: opencl

XCode에서 OpenCL 개발환경 설정과 간단한 디바이스 정보 출력 예제

  1. XCode에서 새로운 프로젝트를 생성하고 macOS의 Command Line Tool을 선택한다.
  2. Project를 선택하고 ‘Build Phases’ -> ‘Link Binary With Libraries’에서 더하기(+)를 선택한 후 OpenCL framework을 선택한다.

아래의 예제 코드는 OpenCL programming by example의 2장에 나오는 내용을 약간 변경한 것으로 AMD 라데온 Pro 455와 Intel HD graphics 530두 개의 GPU가 달린 2016년 맥북프로에서 실행하면 다음과 같은 결과가 출력된다.

Number of platforms: 1
3 devices found in platform0
	Name: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
	Type: 2
	Image support: 1
	Vendor: Intel
	Driver ver.: 1.1
	Device ver.: OpenCL 1.2 
	Compute units: 8
	Max clock: 2700 MHz
		Denorms: 1
		INF and quiet NaNs: 1
		Round to nearest: 1
		Round to zero: 1
		Round to INF: 1
		FMA: 1

	Name: Intel(R) HD Graphics 530
	Type: 4
	Image support: 1
	Vendor: Intel Inc.
	Driver ver.: 1.2(Aug 31 2020 22:26:30)
	Device ver.: OpenCL 1.2 
	Compute units: 24
	Max clock: 1050 MHz
		Denorms: 1
		INF and quiet NaNs: 1
		Round to nearest: 1
		Round to zero: 1
		Round to INF: 1
		FMA: 1

	Name: AMD Radeon Pro 455 Compute Engine
	Type: 4
	Image support: 1
	Vendor: AMD
	Driver ver.: 1.2 (Sep 11 2020 22:04:49)
	Device ver.: OpenCL 1.2 
	Compute units: 12
	Max clock: 855 MHz
		Denorms: 1
		INF and quiet NaNs: 1
		Round to nearest: 1
		Round to zero: 1
		Round to INF: 1
		FMA: 1

Program ended with exit code: 0