sudo apt install nvidia-cuda-toolkit 注意: 本文方法是唯一成功的方法,如果采用和物理机ubuntu一样的在nvidia官网下载cuda版本,然后手动安装,那么在编译好.cu文件后运行则会报错,报错信息为无法检测到显卡/显卡驱动。 测试代码: x.cu #include <stdio.h> #include <stdlib.h> #include <cuda_runtime.h> //...
Open the WSL container and start the Docker daemon there. You should see the dockerd service output. 这是再打开WSL,启动一个Docker daemon,就可以看到dockerd serverce output了 sudo dockerd 测试cuda-sample 在另外一个WSL中,下载N-body simulation container。 docker run --gpus all nvcr.io/nvidia/k...
printf("Hello GPU! CUDA has been initialized.\n");//exit(argc ? EXIT_SUCCESS : EXIT_FAILURE);return0;//返回系统} y.cu #include <iostream>#include<math.h>#include<cuda_runtime.h>usingnamespacestd;intmain() {intcount =0; cudaGetDeviceCount(&count); cout<<"当前计算机包含GPU数为"<< c...