AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-280062

Indesejavel Coisa's questions

Martin Hope
Indesejavel Coisa
Asked: 2018-03-12 03:30:58 +0800 CST

Debian 9 上的 CUDA - 工具包在哪里?

  • 0

我已经遵循了一些关于如何在 Debian 9 中安装 CUDA 的教程。

到目前为止,让我使用的最好nvcc的一个是您可以在此链接中找到的那个。

现在的问题是,我找不到工具包。我已经尝试使用find命令等,但没有。有人知道工具包在哪里吗?

因为,每当我运行nvcc使用 CUDA 编译一个简单的“Hello World”程序时,它都会出错,因为它找不到库。当我尝试安装示例时,它会询问工具包路径,但我找不到它。

添加:

我使用以下方法安装了所有东西:

apt-get install nvidia-cuda-dev nvidia-cuda-toolkit  nvidia-driver 

在此之后,我跑了:

nvcc -V

要检查是否安装了 nvcc,输出如下:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016

我下载了 ubuntu 16.04 和 CUDA 8.0 的 .run 文件:

cuda_8.0.61_375.26_linux-运行

我跳过了驱动程序的安装和工具包的安装,直接跳转到示例安装

Do you accept the previously read EULA?
accept/decline/quit: accept

You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?
(y)es/(n)o/(q)uit: n

Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: n

Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /root ]: /home/sergiobranco/cuda_samples

Enter Toolkit Location
 [ default is /usr/local/cuda-8.0 ]: 

Error: cannot find Toolkit in /usr/local/cuda-8.0
Enter Toolkit Location
 [ default is /usr/local/cuda-8.0 ]: ??????????

问题是它要求工具包的位置,而我不知道。我按回车键,然后尝试安装示例,但这是错误:

Error: unsupported compiler: 6.3.0. Use --override to override this check.
Missing recommended library: libXmu.so

Error: cannot find Toolkit in /usr/local/cuda-8.0

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installation Failed. Using unsupported Compiler.
Samples:  Cannot find Toolkit in /usr/local/cuda-8.0


Logfile is /tmp/cuda_install_3212.log

我已经使用了 --override 参数,但它失败了。

在此之后,我尝试至少编译 cuda 给出的“第一个程序”之一:

#include <stdio.h>

__global__
void saxpy(int n, float a, float *x, float *y)
{
  int i = blockIdx.x*blockDim.x + threadIdx.x;
  if (i < n) y[i] = a*x[i] + y[i];
}

int main(void)
{
  int N = 1<<20;
  float *x, *y, *d_x, *d_y;
  x = (float*)malloc(N*sizeof(float));
  y = (float*)malloc(N*sizeof(float));

  cudaMalloc(&d_x, N*sizeof(float)); 
  cudaMalloc(&d_y, N*sizeof(float));

  for (int i = 0; i < N; i++) {
    x[i] = 1.0f;
    y[i] = 2.0f;
  }

  cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
  cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);

  // Perform SAXPY on 1M elements
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);

  cudaMemcpy(y, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);

  float maxError = 0.0f;
  for (int i = 0; i < N; i++)
    maxError = max(maxError, abs(y[i]-4.0f));
  printf("Max error: %f\n", maxError);

  cudaFree(d_x);
  cudaFree(d_y);
  free(x);
  free(y);
}

但这是输出:

nvcc -ccbin clang-3.8 hello.c 
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
hello.c:3:1: error: unknown type name '__global__'
__global__
^
hello.c:4:1: error: expected identifier or '('
void saxpy(int n, float a, float *x, float *y)
^
hello.c:14:15: warning: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Wimplicit-function-declaration]
  x = (float*)malloc(N*sizeof(float));
              ^
hello.c:14:15: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
hello.c:17:3: warning: implicit declaration of function 'cudaMalloc' is invalid in C99 [-Wimplicit-function-declaration]
  cudaMalloc(&d_x, N*sizeof(float)); 
  ^
hello.c:25:3: warning: implicit declaration of function 'cudaMemcpy' is invalid in C99 [-Wimplicit-function-declaration]
  cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
  ^
hello.c:25:39: error: use of undeclared identifier 'cudaMemcpyHostToDevice'
  cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
                                      ^
hello.c:26:39: error: use of undeclared identifier 'cudaMemcpyHostToDevice'
  cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);
                                      ^
hello.c:29:3: error: use of undeclared identifier 'saxpy'
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
  ^
hello.c:29:10: error: expected expression
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
         ^
hello.c:29:29: error: expected expression
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
                            ^
hello.c:29:31: warning: expression result unused [-Wunused-value]
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
                              ^
hello.c:29:34: warning: expression result unused [-Wunused-value]
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
                                 ^~~~
hello.c:29:40: warning: expression result unused [-Wunused-value]
  saxpy<<<(N+255)/256, 256>>>(N, 2.0f, d_x, d_y);
                                       ^~~
hello.c:31:39: error: use of undeclared identifier 'cudaMemcpyDeviceToHost'
  cudaMemcpy(y, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);
                                      ^
hello.c:35:16: warning: implicit declaration of function 'max' is invalid in C99 [-Wimplicit-function-declaration]
    maxError = max(maxError, abs(y[i]-4.0f));
               ^
hello.c:35:30: warning: implicitly declaring library function 'abs' with type 'int (int)' [-Wimplicit-function-declaration]
    maxError = max(maxError, abs(y[i]-4.0f));
                             ^
hello.c:35:30: note: include the header <stdlib.h> or explicitly provide a declaration for 'abs'
hello.c:35:30: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
    maxError = max(maxError, abs(y[i]-4.0f));
                             ^
hello.c:35:30: note: use function 'fabsf' instead
    maxError = max(maxError, abs(y[i]-4.0f));
                             ^~~
                             fabsf
hello.c:35:30: note: include the header <math.h> or explicitly provide a declaration for 'fabsf'
hello.c:38:3: warning: implicit declaration of function 'cudaFree' is invalid in C99 [-Wimplicit-function-declaration]
  cudaFree(d_x);
  ^
hello.c:40:3: warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
  free(x);
  ^
11 warnings and 8 errors generated.
nvidia
  • 1 个回答
  • 7132 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve