AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 429549
Accepted
Indesejavel Coisa
Indesejavel Coisa
Asked: 2018-03-12 03:30:58 +0800 CST2018-03-12 03:30:58 +0800 CST 2018-03-12 03:30:58 +0800 CST

CUDA no Debian 9 - Onde está o kit de ferramentas?

  • 772

Já segui algum tutorial de como instalar o CUDA no Debian 9.

O melhor até agora, que me deixou usar, nvccfoi o que você pode encontrar neste link .

Agora o problema é que não consigo encontrar o kit de ferramentas. Já tentei usar findcomando, etc, mas nada. Alguém tem alguma ideia de onde está o kit de ferramentas?

Pois, sempre que corro nvccpara compilar um simples programa "Hello World" usando CUDA, ele dá erros porque não consegue encontrar as bibliotecas. E quando tento instalar as amostras, ele pede o caminho do kit de ferramentas e não consigo encontrá-lo.

ADICIONADO:

Eu instalei tudo usando:

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

Depois disso, eu corri:

nvcc -V

Para verificar se o nvcc foi instalado, a saída foi esta:

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

Baixei o arquivo .run para ubuntu 16.04 e CUDA 8.0:

cuda_8.0.61_375.26_linux-run

Ignoro a instalação de drivers e a instalação do kit de ferramentas e vou direto para Instalação de amostras

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 ]: ??????????

O problema é que ele pede a localização do kit de ferramentas e eu não sei. Eu pressiono enter e tento instalar as amostras, mas este é o erro:

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

Eu já usei o argumento --override, mas ele falhou.

Depois disso tentei pelo menos compilar um dos "primeiros programas" dados por 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);
}

Mas esta é a saída:

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 1 respostas
  • 7132 Views

1 respostas

  • Voted
  1. Best Answer
    Indesejavel Coisa
    2018-03-25T02:35:57+08:002018-03-25T02:35:57+08:00

    Bom, finalmente consegui instalar tudo e está funcionando corretamente. Vou postar aqui um tutorial completo de como fiz para o debian 9:

    1º Passo:

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

    Para executar o comando acima, você deve verificar este link para obter uma visão geral melhor de como fazê-lo corretamente para sua placa.

    Dito isso, baixo o seguinte arquivo de execução CUDA 8.0

    Eu também tive que instalar estes:

    apt-get install libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev
    

    Então eu tive que incluir o kit de ferramentas no meu $PATH para fazê-lo funcionar:

    export PATH=$PATH:/usr/lib/nvidia-cuda-toolkit
    

    Então você deve fazer isso:

    sh /home/username/Downloads/cuda_8.0.61_375.26_linux.run --tar mxvf
    cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base/
    export $PERL5LIB
    

    E agora você pode instalar as amostras:

    sh /home/username/Downloads/cuda_8.0.61_375.26_linux.run
    

    Quando ele pedir o caminho do kit de ferramentas você deve colocar:

    /usr/lib/nvidia-cuda-toolkit
    

    Estas foram as minhas respostas:

    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 ]: /somewher
    
    Enter Toolkit Location
     [ default is /usr/local/cuda-8.0 ]: /usr/lib/nvidia-cuda-toolkit
    

    Agora deve instalar as amostras sem nenhum problema. Então você pode ir para a pasta dentro de onde você os instalou e executar:

    nvcc -ccbin clang++-3.8 somefile.cu -o somename
    

    E aí está. . .

    Se você deseja instalar o pycuda, você só precisa fazer isso:

    apt-get install build-essential python-dev python-setuptools libboost-python-dev libboost-thread-dev -y
    apt-get install python-pycuda
    
    • 2

relate perguntas

  • É possível instalar e trabalhar no CUDA Toolkit no ElementaryOS ou Deepin?

  • Depois de instalar os drivers da nvidia, o computador congela após o bloqueio, nem consegue acessar o tty

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    ssh Não é possível negociar: "nenhuma cifra correspondente encontrada", está rejeitando o cbc

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    Como descarregar o módulo do kernel 'nvidia-drm'?

    • 13 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Wong Jia Hau ssh-add retorna com: "Erro ao conectar ao agente: nenhum arquivo ou diretório" 2018-08-24 23:28:13 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST
  • Martin Hope
    Bagas Sanjaya Por que o Linux usa LF como caractere de nova linha? 2017-12-20 05:48:21 +0800 CST

Hot tag

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

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve