Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++;硬件上的放大器崩溃(GeForce GTX 660) 我写一些C++ AMP代码遇到了问题。我已经包括了一个样品。 它在模拟加速器上运行良好,但在我的硬件(windows 7、NVIDIA GeForce GTX 660、最新的驱动程序)上崩溃了显示驱动程序,但我看不出我的代码有任何错误_C++_Visual C++_C++11_C++ Amp - Fatal编程技术网

C++;硬件上的放大器崩溃(GeForce GTX 660) 我写一些C++ AMP代码遇到了问题。我已经包括了一个样品。 它在模拟加速器上运行良好,但在我的硬件(windows 7、NVIDIA GeForce GTX 660、最新的驱动程序)上崩溃了显示驱动程序,但我看不出我的代码有任何错误

C++;硬件上的放大器崩溃(GeForce GTX 660) 我写一些C++ AMP代码遇到了问题。我已经包括了一个样品。 它在模拟加速器上运行良好,但在我的硬件(windows 7、NVIDIA GeForce GTX 660、最新的驱动程序)上崩溃了显示驱动程序,但我看不出我的代码有任何错误,c++,visual-c++,c++11,c++-amp,C++,Visual C++,C++11,C++ Amp,我的代码是否有问题,或者这是硬件/驱动程序/编译器问题 #include "stdafx.h" #include <vector> #include <iostream> #include <amp.h> int _tmain(int argc, _TCHAR* argv[]) { // Prints "NVIDIA GeForce GTX 660" concurrency::accelerator_view target_view = c

我的代码是否有问题,或者这是硬件/驱动程序/编译器问题

#include "stdafx.h"

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

int _tmain(int argc, _TCHAR* argv[])
{
    // Prints "NVIDIA GeForce GTX 660"
    concurrency::accelerator_view target_view = concurrency::accelerator().create_view();
    std::wcout << target_view.accelerator.description << std::endl;

    // lower numbers do not cause the issue
    const int x = 2000;
    const int y = 30000;

    // 1d array for storing result
    std::vector<unsigned int> resultVector(y);
    Concurrency::array_view<unsigned int, 1> resultsArrayView(resultVector.size(), resultVector);

    // 2d array for data for processing 
    std::vector<unsigned int> dataVector(x * y);
    concurrency::array_view<unsigned int, 2> dataArrayView(y, x, dataVector);
    parallel_for_each(
        // Define the compute domain, which is the set of threads that are created.
        resultsArrayView.extent,
        // Define the code to run on each thread on the accelerator.
        [=](concurrency::index<1> idx) restrict(amp)
    {
        concurrency::array_view<unsigned int, 1> buffer = dataArrayView[idx[0]];
        unsigned int bufferSize = buffer.get_extent().size();

        // needs both loops to cause crash
        for (unsigned int outer = 0; outer < bufferSize; outer++)
        {
            for (unsigned int i = 0; i < bufferSize; i++)
            {
                // works without this line, also if I change to buffer[0] it works?
                dataArrayView[idx[0]][0] = 0;
            }
        }
        // works without this line
        resultsArrayView[0] = 0;
    });

    std::cout << "chash on next line" << std::endl; 
    resultsArrayView.synchronize();
    std::cout << "will never reach me" << std::endl; 

    system("PAUSE");
    return 0;
}
#包括“stdafx.h”
#包括
#包括
#包括
int _tmain(int argc,_TCHAR*argv[]
{
//打印“NVIDIA GeForce GTX 660”
并发::加速器\视图目标\视图=并发::加速器()。创建\视图();

std::wcout您的计算很可能超过允许的量子时间(默认值为2秒)。在这之后,操作系统进入并强制重新启动GPU,这就是所谓的。软件适配器(参考设备)没有启用TDR,这就是为什么计算可以超过允许的量子时间

你的计算真的需要3000个线程(变量x),每个线程执行2000×3000(x*y)循环迭代吗?你可以计算你的计算,这样每个块需要少于2秒的时间来计算。你也可以考虑禁用TDR或者超过允许的量子时间来满足你的需要。 我强烈推荐阅读一篇关于如何处理C++中的TDRs的博客文章,它详细地解释了TDR:

此外,以下是关于如何在Windows 8上禁用TDR的单独日志:

非常感谢,我开始对这个问题失去理智。我从来都不知道这个TDR存在。我已经更新了它,现在它可以工作了。谢谢你令人惊讶的回答!