c++ - 你如何枚举 C++ AMP 中的所有加速器?

标签 c++ c++-amp

在 C++ AMP 中,如何检测和枚举所有 C++ AMP 加速器?

Don McCrady 分发了一个应用程序 here枚举非模拟加速器。虽然我有一张 DX11 卡 (GTX 260),但我没有看到任何可用的加速器。丹尼尔·莫斯 (Daniel Moth) 展示 here如何查询单个加速器,但我找不到如何使用 C++ AMP 调用枚举所有(模拟和非)加速器。

最佳答案

看起来很简单:concurrency::get_accelerators(); Daniel Moth comments :

in the VS 11 Developer Preview bits, you simply call concurrency::get_accelerators();. We are working to make that more discoverable for the Beta, whenever that is.

这是我的代码:

#include <iostream>
#include "stdafx.h"
#include "amp.h"

using namespace std;
using namespace concurrency;

void inspect_accelerators()
{
    auto accelerators = accelerator::get_all();
    for_each(begin(accelerators), end(accelerators),[=](accelerator acc){ 
        wcout << "New accelerator: " << acc.description << endl;
        wcout << "is_debug = " << acc.is_debug << endl;
        wcout << "is_emulated = " << acc.is_emulated <<endl;
        wcout << "dedicated_memory = " << acc.dedicated_memory << endl;
        wcout << "device_path = " << acc.device_path << endl;
        wcout << "has_display = " << acc.has_display << endl;                
        wcout << "version = " << (acc.version >> 16) << '.' << (acc.version & 0xFFFF) << endl;
    });
}

更新 1:

从 VS 11 Beta 开始,这现在是 accelerator::get_all();

关于c++ - 你如何枚举 C++ AMP 中的所有加速器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7533792/

相关文章:

c++ - Unicode 支持的 isdigit 和 isspace 函数

c++ - 在 C++Amp 中并行的几个算术运算

c++ - 改进并行计算的内存布局

c++ - C++ AMP的现状是什么

c++ - 在C++ AMP阵列中,数据被复制了多少次?

c++ - 范围 View 大小不编译

C++在类中设置字符串属性值抛出 "Access violation reading location"

c++ - ReadDirectoryChangesW 不做任何事情 c++

c++ - boost::multi_index_container 与 random_access 和 ordered_unique