nvprof core dumps on Ubuntu 16.04

I am running an AWS EC2 instance with Volta V100,
running Ubuntu 16.04.
I installed Cuda 9.1 toolkit following all the instructions mentioned in:

$ lspci | grep -i nvidia
00:1e.0 3D controller: NVIDIA Corporation GV100 [Tesla V100 SXM2] (rev a1)

When I run ‘nvprof -h’, it core dumps,
giving me an error like:
$ nvprof -h
*** Error in `nvprof’: free(): invalid pointer: 0x0000000001190920 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fadca6337e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fadca63c37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fadca64053c]
nvprof[0xa8bbfd]
nvprof[0xaa22e8]
nvprof[0xaa1523]
nvprof(_ZNSt6locale18_S_initialize_onceEv+0x32)[0xaa1226]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xea99)[0x7fadcb0bba99]
nvprof[0xaa0ec5]
nvprof[0xaa127f]
nvprof[0xaa1008]
nvprof[0xa875c0]
nvprof[0xab4362]
nvprof[0xab221b]
nvprof[0xa4a0e4]
nvprof[0xaeb956]
======= Memory map: ========
00400000-00b83000 r-xp 00000000 ca:01 220821 /usr/local/cuda-9.1/bin/nvprof
00d82000-0113f000 rwxp 00782000 ca:01 220821 /usr/local/cuda-9.1/bin/nvprof

I do have cuda toolkit 8.0 on the same machine.
That nvprof runs fine, but does not recognize V100.
/usr/local/cuda-8.0/bin/nvprof cuda_binary
======== Warning: This version of nvprof doesn’t support the underlying device, GPU profiling skipped.

Can someone please let me know how to resolve this issue?

which GPU driver do you have installed on that instance?

I am using the following:
$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 387.26 Thu Nov 2 21:20:16 PDT 2017
GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)

There is a known issue that prevents 387.26 driver from working correctly on AWS P3 (V100) instances.

https://devtalk.nvidia.com/default/topic/1027689/cuda-setup-and-installation/amazon-ubuntu-16-04-p3-instances-only-run-kernel-once-then-crash-server/

I suggest you try 390.12 (or a future r390 branch driver when it becomes available), or downgrade to CUDA 9.0 with a r384 branch driver.

How do I install 390.12?

I already had CUDA 9.0 on that instance which was throwing the same problem, thats why I upgraded.

390.12:

http://www.nvidia.com/download/driverResults.aspx/128743/en-us

If you installed CUDA 9.1 via runfile installer method, you should just be able to use that installer.

If you installed via the package manager method, you’ll either need to try your luck with something like

sudo apt-get install nvidia-390 nvidia-390-dev

or else clean out your old driver package manager install using the instructions in the install guide, and install the runfile

I still get the same error when I run nvprof, after upgrading the driver using runfile installer method:
$ nvidia-smi -q | head

==============NVSMI LOG==============

Timestamp : Thu Jan 18 23:32:36 2018
Driver Version : 390.12

Attached GPUs : 1
GPU 00000000:00:1E.0
Product Name : Tesla V100-SXM2-16GB
Product Brand : Tesla

$ nvprof -h
*** Error in `nvprof’: free(): invalid pointer: 0x0000000001190920 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb4bb4e07e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fb4bb4e937a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb4bb4ed53c]
nvprof[0xa8bbfd]
nvprof[0xaa22e8]
nvprof[0xaa1523]
nvprof(_ZNSt6locale18_S_initialize_onceEv+0x32)[0xaa1226]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xea99)[0x7fb4bbf68a99]
nvprof[0xaa0ec5]
nvprof[0xaa127f]
nvprof[0xaa1008]
nvprof[0xa875c0]
nvprof[0xab4362]
nvprof[0xab221b]
nvprof[0xa4a0e4]
nvprof[0xaeb956]
======= Memory map: ========
00400000-00b83000 r-xp 00000000 ca:01 3585994 /usr/local/cuda-9.1/bin/nvprof
00d82000-0113f000 rwxp 00782000 ca:01 3585994 /usr/local/cuda-9.1/bin/nvprof
0113f000-01196000 rwxp 00000000 00:00 0
03012000-03033000 rwxp 00000000 00:00 0 [heap]

So, now that you have 390.12 installed, can you validate your cuda install?

For example, can you compile and run properly the deviceQuery and vectorAdd sample codes?

what is the result of:

gcc --version

DEVICE QUERY

$ ./deviceQuery
./deviceQuery Starting…

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

Detected 1 CUDA Capable device(s)

Device 0: “Tesla V100-SXM2-16GB”
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 7.0
Total amount of global memory: 16160 MBytes (16945512448 bytes)
(80) Multiprocessors, ( 64) CUDA Cores/MP: 5120 CUDA Cores
GPU Max Clock rate: 1530 MHz (1.53 GHz)
Memory Clock rate: 877 Mhz
Memory Bus Width: 4096-bit
L2 Cache Size: 6291456 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 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 2 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: Enabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 0 / 30
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS

GCC VERSION

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright © 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

VECTOR ADD
$ ./vectorAdd
[Vector addition of 50000 elements]
Copy input data from the host memory to the CUDA device
CUDA kernel launch with 196 blocks of 256 threads
Copy output data from the CUDA device to the host memory
Test PASSED
Done

These were working earlier too

I am getting the same coredump with nvprof (-h with no arg) in SDK 9.1 with R390.26 driver on the AWS p3.2xlarge instance. Also tried the nvprof from SDK 9.0, with same result.

I am seeing the same nvprof behavior in a p3.2xl with driver 396.26 and cuda 9.2

deviceQuerry and other apps seem to work, but nvprof seg faults.

I am seeing the same nvprof behavior in a p2.8xlarge with driver 384.111 and cuda 9.0

It seems that I’m getting the same coredump in the nvprof. But if I run it with sudo, it works…
And SUID fixes it for a regular user as well:

sudo chmod 4555 /usr/local/cuda-9.2/bin/nvprof

Release version 9.2.148 (21), on AWS g3.4 instance, 4.4.0-1062-aws #71-Ubuntu SMP, Driver Version: 396.44

~$ /usr/local/cuda-9.2/bin/nvprof

*** Error in `/usr/local/cuda-9.2/bin/nvprof': free(): invalid pointer: 0x00000000011f6800 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fd3b33597e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fd3b336237a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd3b336653c]
/usr/local/cuda-9.2/bin/nvprof[0xaca4fd]
.....
7fd3b4635000-7fd3b4636000 rw-p 00026000 ca:01 5890959                    /lib/x86_64-linux-gnu/ld-2.23.so
7fd3b4636000-7fd3b4637000 rw-p 00000000 00:00 0 
7ffec187c000-7ffec189d000 rw-p 00000000 00:00 0                          [stack]
7ffec18c8000-7ffec18cb000 r--p 00000000 00:00 0                          [vvar]
7ffec18cb000-7ffec18cd000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)