Microsoft MVP성태의 닷넷 이야기
VC++: 80. 내 컴퓨터에서 C++ AMP 코드가 실행이 될까요? [링크 복사], [링크+제목 복사],
조회: 24511
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

내 컴퓨터에서 C++ AMP 코드가 실행이 될까요?

공식 홈페이지를 보면,

C++ AMP Overview
; https://docs.microsoft.com/en-us/cpp/parallel/amp/cpp-amp-overview

시스템 요구 사항이 다음과 같이 나옵니다.

  • Windows 7, Windows 8, Windows Server 2008 R2, or Windows Server 2012
  • DirectX 11 Feature Level 11.0 or later hardware
  • For debugging on the software emulator, Windows 8 or Windows Server 2012 is required. For debugging on the hardware, you must install the drivers for your graphics card.

이런 거 보고 바로 알 수 있으면 좋겠지만 역시나 그냥 프로그램 돌려서 되냐 안되냐를 알 수 있는 것이 속편합니다. ^^ 이에 대해서는 다음의 글에 나오는 "VerifyAmpDevices" 유틸리티를 쓰시면 됩니다.

Can I Run C++ AMP on My Device?
; http://blogs.msdn.com/b/nativeconcurrency/archive/2011/09/22/can-i-run-c-amp-on-my-device.aspx

VerifyAmpDevices 유틸리티는 아래의 글에 포함된 list_all_accelerators() 함수를 이용해 쉽게 만들 수 있습니다.

Using accelerator and accelerator_view Objects
; https://docs.microsoft.com/en-us/cpp/parallel/amp/using-accelerator-and-accelerator-view-objects

뭐 대충 이런 식입니다.

#include "stdafx.h"

#include <amp.h>
#include <vector>
#include <amprt.h>

#include <iostream>

using namespace Concurrency;

// https://docs.microsoft.com/en-us/cpp/parallel/amp/using-accelerator-and-accelerator-view-objects
void list_all_accelerators();

int _tmain(int argc, _TCHAR* argv[])
{
    list_all_accelerators();

    return 0;
}

void list_all_accelerators()
{
    std::vector<accelerator> accs = accelerator::get_all();

    for (int i = 0; i < accs.size(); i++) {
        std::wcout << accs[i].device_path << ", desc = ";
        std::wcout << accs[i].description << ", has_display = ";
        std::wcout << accs[i].get_has_display() << ", is_emulated = ";
        std::wcout << accs[i].is_emulated << "\n";

        //std::wcout << accs[i].dedicated_memory << "\n";
        //std::wcout << (accs[i].supports_cpu_shared_memory ?
        //  "CPU shared memory: true" : "CPU shared memory: false") << "\n";
        //std::wcout << (accs[i].supports_double_precision ?
        //  "double precision: true" : "double precision: false") << "\n";
        //std::wcout << (accs[i].supports_limited_double_precision ?
        //  "limited double precision: true" : "limited double precision: false") << "\n\n";
    }
}

제 컴퓨터에서 위의 코드를 실행하면 다음과 같은 출력 결과가 나옵니다.

PCI\...[장치경로]..., desc = NVIDIA GeForce GTX 660  , has_display = 1, is_emulated = 0
direct3d\warp, desc = Microsoft Basic Render Driver, has_display = 0, is_emulated = 1
direct3d\ref, desc = Software Adapter, has_display = 1, is_emulated = 1
cpu, desc = CPU accelerator, has_display = 0, is_emulated = 1

당연히 is_emulated = 0인 값의 장치가 가장 성능이 우수할 것입니다. 또한 has_display는 현재 모니터 장치와 연결된 것을 의미한다고 하는데, direct3d\ref가 has_display = 1을 갖는 의미가 뭔지는 해석이 안되는군요. ^^

참고로, 중간의 warp와 ref에 대해서는 다음의 글에 약간의 설명이 나옵니다.

concurrency::accelerator 
; http://www.danielmoth.com/Blog/concurrencyaccelerator.aspx

  • accelerator::direct3d_ref represents the reference rasterizer emulator that simulates a direct3d device on the CPU (in a very slow manner). This emulator is available on systems with Visual Studio installed and is useful for debugging. More on debugging in general in future posts. Example: accelerator acc(accelerator::direct3d_ref);
  • accelerator::direct3d_warp represents WARP which is the current CPU fallback. Example: accelerator acc(accelerator::direct3d_warp);

ref는 Visual Studio가 설치된 경우에 있으며 디버깅이 쉽다는 장점이 있다고 하니, 그렇다면 일반적인 컴퓨터라면 GPU 하나와 direct3d\ref, cpu 정도만 AMP 장치로 검색될 것입니다.

아래의 글도 읽어보면 좋을 듯 싶군요. ^^

Server environments and C++ AMP
; http://blogs.msdn.com/b/nativeconcurrency/archive/2012/06/21/server-environments-and-c-amp.aspx





[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/17/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 



2022-05-04 04시52분
VS2022부터 C++ AMP 공식 지원중단
; https://blog.naver.com/drvoss/222653027219
정성태

... 121  122  123  124  125  [126]  127  128  129  130  131  132  133  134  135  ...
NoWriterDateCnt.TitleFile(s)
2904정성태4/27/201527066DDK: 6. ZwTerminateProcess로 프로세스를 종료하는 Device Driver 프로그램 [2]파일 다운로드1
2903정성태4/20/201520547Windows: 110. (무료) 마이크로소프트 온라인 강좌 소개 - Azure에서 제공하는 계정 관리 서비스
2902정성태4/16/201526511Windows: 109. (무료) 마이크로소프트 온라인 강좌 소개 - Active Directory 이해
2901정성태4/15/201523108Windows: 108. (무료) 마이크로소프트 온라인 강좌 소개 - Windows Server 2012 R2 주요 기술 (Hyper-V 관점)
2900정성태3/24/201522162오류 유형: 279. robocopy 오류 - The file cannot be accessed by the system [4]
2899정성태3/24/201530246개발 환경 구성: 264. Visual Studio 2013 솔루션을 2015로 마이그레이션
2898정성태3/24/201520846개발 환경 구성: 263. SharePoint 2013을 Windows Server 2012 R2에 설치
2897정성태3/18/201519511오류 유형: 278. LoadLibrary("...") failed - Invalid access to memory location.
2896정성태3/18/201519659VC++: 90. Visual Studio 2013에서 Visual Basic 6용 ATL Control 제작
2895정성태3/18/201522719VC++: 89. Visual Studio 2015 - auto 반환 타입 및 thread_local 예약어 지원(C++ 11 표준) [2]
2894정성태3/18/201520979.NET Framework: 509. ELEMENT_TYPE_MODIFIER의 조합
2893정성태3/18/201521061오류 유형: 277. command line error MIDL1004: cannot execute C preprocessor cl.exe
2892정성태3/17/201525940오류 유형: 276. robocopy - Logon failure: unknown user name or bad password.
2891정성태3/17/201542079개발 환경 구성: 262. Visual Basic 6 (Enterprise Edition)을 Windows 7 x86에 설치하는 방법 [1]
2890정성태3/17/201524430오류 유형: 275. Internet Explorer - This page can't be displayed
2889정성태3/17/201525082Windows: 107. (2015-03-12) 업데이트 이후 작업 표시줄 또는 탐색기의 반응이 느려지는 문제 [1]
2888정성태3/17/201523126.NET Framework: 508. Visual Studio 빌드 - fatal error C1033: cannot open program database ''
2887정성태3/13/201520349.NET Framework: 507. CoreFx 빌드하는 방법
2886정성태3/13/201522115오류 유형: 274. CoreFx, CoreCLR 빌드 시 "error CS0518: Predefined type 'System.Object' is not defined or imported" 오류 해결 방법
2885정성태3/13/201533439VS.NET IDE: 99. Visual Studio는 2019는 32비트, 2022부터 64비트 버전입니다. [2]
2884정성태3/12/201526735.NET Framework: 506. .NETCore = CoreFX + CoreCLR [5]
2883정성태3/10/201523870.NET Framework: 505. OpenCover 소스 코드 분석을 Visual Studio 2013에서 하는 방법 [1]
2882정성태3/10/201522760.NET Framework: 504. OpenCover 코드 커버리지 도구의 동작 방식을 통해 살펴보는 Calli IL 코드 사용법
2881정성태3/9/201523277개발 환경 구성: 261. OpenCover 오픈 소스를 이용한 .NET 코드 커버리지(Code coverage)
2880정성태3/7/201521539개발 환경 구성: 260. C# Code Coverage 도구 - Semantic Designs 소개
2879정성태3/3/201526538개발 환경 구성: 259. Visual Studio 없이 Visual C++ 컴파일하는 방법
... 121  122  123  124  125  [126]  127  128  129  130  131  132  133  134  135  ...