You are not logged in.

#1 2012-09-07 17:50:55

nwhsvc
Member
Registered: 2012-03-23
Posts: 7

[SOLVED] why does cuda-gdb require root permissions?

I am doing GPGPU development on Arch Linux with the cuda-sdk and
cuda-toolkit packages.  My attempts to run cuda-gdb as a normal
user on a simple program results in:

$ cuda-gdb ./driver
NVIDIA (R) CUDA Debugger
4.2 release
Portions Copyright (C) 2007-2012 NVIDIA Corporation
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/nwh/Dropbox/projects/G4CU/driver...done.
(cuda-gdb) run
Starting program: /home/nwh/Dropbox/projects/G4CU/driver 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
fatal:  The CUDA driver initialization failed. (error code = 1)

If I run cuda-gdb as root, it behaves normally:

# cuda-gdb ./driver
NVIDIA (R) CUDA Debugger
4.2 release
Portions Copyright (C) 2007-2012 NVIDIA Corporation
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/nwh/Dropbox/work/2012-09-06-cuda_gdb/driver...done.
(cuda-gdb) run
Starting program: /home/nwh/Dropbox/work/2012-09-06-cuda_gdb/driver 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff5ba8700 (LWP 11386)]
[Context Create of context 0x6e8a30 on Device 0]
[Launch of CUDA Kernel 0 (thrust::detail::backend::cuda::detail::launch_closure_by_value<thrust::detail::backend::cuda::for_each_n_closure<thrust::device_ptr<unsigned long long>, unsigned int, thrust::detail::device_generate_functor<thrust::detail::fill_functor<unsigned long long> > > ><<<(1,1,1),(704,1,1)>>>) on Device 0]
[Launch of CUDA Kernel 1 (set_vector<<<(1,1,1),(10,1,1)>>>) on Device 0]
vd[0] = 0
vd[1] = 1
vd[2] = 2
vd[3] = 3
vd[4] = 4
vd[5] = 5
vd[6] = 6
vd[7] = 7
vd[8] = 8
vd[9] = 9
[Thread 0x7ffff5ba8700 (LWP 11386) exited]

Program exited normally.
[Termination of CUDA Kernel 1 (set_vector<<<(1,1,1),(10,1,1)>>>) on Device 0]
[Termination of CUDA Kernel 0 (thrust::detail::backend::cuda::detail::launch_closure_by_value<thrust::detail::backend::cuda::for_each_n_closure<thrust::device_ptr<unsigned long long>, unsigned int, thrust::detail::device_generate_functor<thrust::detail::fill_functor<unsigned long long> > > ><<<(1,1,1),(704,1,1)>>>) on Device 0]

The test program driver.cu is:

// needed for nvcc with gcc 4.7 and iostream
#undef _GLIBCXX_ATOMIC_BUILTINS
#undef _GLIBCXX_USE_INT128

#include <iostream>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>

__global__
void set_vector(int *a)
{
  // get thread id
  int id = threadIdx.x + blockIdx.x * blockDim.x;
  a[id] = id;
  __syncthreads();
}

int main(void)
{
  // settings
  int len = 10; int trd = 10;

  // allocate vectors
  thrust::device_vector<int> vd(len);

  // get the raw pointer
  int *a = thrust::raw_pointer_cast(vd.data());
  
  // call the kernel
  set_vector<<<1,trd>>>(a);

  // print vector
  for (int i=0; i<len; i++)
    std::cout << "vd[" << i << "] = " << vd[i] << std::endl;

  return 0;
}

driver.c is compiled with the command:

$ nvcc -g -G -gencode arch=compute_20,code=sm_20 driver.cu -o driver

How can I get cuda-gdb to run with out root permissions?

Last edited by nwhsvc (2012-10-21 19:07:08)

Offline

#2 2012-09-18 12:06:04

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: [SOLVED] why does cuda-gdb require root permissions?

Question: What is one mayor difference between root and pretty much any other user account ?

Hint: Access rights....


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#3 2012-10-21 19:06:32

nwhsvc
Member
Registered: 2012-03-23
Posts: 7

Re: [SOLVED] why does cuda-gdb require root permissions?

This problem appears to be fixed with nvidia driver version 304.54.

Offline

Board footer

Powered by FluxBB