태그 보관물: xcode

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

저장공간 문제로 XCode 재 설치가 실패 할 때

XCode를 재설치 할 때 가능한 저장공간이 25GB이상 있음에도 저장공간이 부족해서 설치할 수 없다는 에러가 나온다면 제대로 삭제되지 않은 이전의 정보 때문일 수도 있다.

Uninstall xcode 10에 있는 내용을 참고해서 ~/Library/안에 있는 관련한 파일들을 삭제해주고 나니 저장공간에 대한 에러메세지 없이 잘 설치 되었다. /System/Library/안에 있는 파일들은 SIP 관련으로 그냥 삭제할 수 없고 복구모드로 부팅해서 csrutil을 실행해 주어야 한다는데 그냥 안해도 문제 없이 잘 되었다.

다음의 파일을 지우고 한번 시도해보자.

/Applications/Xcode.app 
~/Library/Caches/com.apple.dt.Xcode
~/Library/Developer
~/Library/MobileDevice
~/Library/Preferences/com.apple.dt.Xcode.plist
/Library/Preferences/com.apple.dt.Xcode.plist