在Windows 10下的CUDA 7.0中失去统一内存支持

时间:2015-05-15 10:32:10

标签: cuda

最近我从CUDA 6.0更新到CUDA 7.0,我的统一内存分配的CUDA程序停止工作(其他没有统一内存的程序仍然有效,Visual Studio 2013中的CUDA 7.0模板仍然有效)。在What is the canonical way to check for errors using the CUDA runtime API?之后,我发现cudaMallocManaged()返回“不支持操作”错误。此行为仅在更新后才开始发生。

我的显卡是GeForce GTX 780M,具有3.0的计算能力。我的程序是使用面向64位平台的Visual Studio 2013编译的,其中arch / code对为compute_30,sm_30。我正在使用Windows 10 Pro内幕预览评估版本10074.我的GeForce驱动程序版本是349.90。

CUDA 7.0 UnifiedMemoryStreams示例输出:

GPU Device 0: "GeForce GTX 780M" with compute capability 3.0

Unified Memory not supported on this device

CUDA 7.0 deviceQuery示例输出:

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 780M"
  CUDA Driver Version / Runtime Version          7.0 / 7.0
  CUDA Capability Major/Minor version number:    3.0
  Total amount of global memory:                 4096 MBytes (4294967296 bytes)
  ( 8) Multiprocessors, (192) CUDA Cores/MP:     1536 CUDA Cores
  GPU Max Clock rate:                            797 MHz (0.80 GHz)
  Memory Clock rate:                             2500 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 524288 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     No
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  CUDA Device Driver Mode (TCC or WDDM):         WDDM (Windows Display Driver Model)
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.0, CUDA Runtime Version = 7.0, NumDevs = 1, Device0 = GeForce GTX 780M
Result = PASS

这是输出“不支持操作”的最小样本:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>

#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
inline void gpuAssert(cudaError_t code, char *file, int line, bool abort = true)
{
    if (code != cudaSuccess)
    {
        fprintf(stderr, "GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
        if (abort) exit(code);
    }
}

int main()
{
    int N = 2048;
    int *a;
    gpuErrchk(cudaMallocManaged(&a, N * sizeof(int)));
    a[0] = 0;

    cudaFree(a);
    cudaDeviceReset();
}

更新

我已经从Windows 10降级到Windows 8.1,所有其他因素都保持不变,现在cudaMallocManaged()完美运行(UnifiedMemoryStreams输出):

GPU Device 0: "GeForce GTX 780M" with compute capability 3.0

Executing tasks on host / device
Task [0], thread [0] executing on device (512)
Task [1], thread [0] executing on device (207)
...
Task [38], thread [0] executing on device (417)
Task [39], thread [0] executing on device (563)
All Done!

在GeForce驱动程序版本上测试了347.62和350.12。 所以,如果您使用CUDA 7.0进行开发,请暂时停止Windows升级...

2 个答案:

答案 0 :(得分:2)

目前,Windows 10不是CUDA支持的平台。切换到a supported platform,您的统一内存操作应该重新开始工作。

答案 1 :(得分:1)

最后,您可以在Windows 10上使用统一内存。驱动程序355.98实现它。