Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.15k stars 4.14k forks source link

ncnn with vulkan --> nvdc: nvdcEventThread select failed: Bad file descriptor #1561

Closed ghimiredhikura closed 9 months ago

ghimiredhikura commented 4 years ago

NCNN with Vulkan: I got this message while trying to execute example with vulcan in NVIDIA Jetson Nano. I followed this instruction in order to build ncnn with vulkan: https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-nvidia-jetson

Test example with output: detection result is fine but with error message regarding nvdcEventThread. I am wondering is my device using GPU or not?

ghimire@ghimire:~/ncnn/build/examples$ ./retinaface faces.jpg
[0 NVIDIA Tegra X1 (nvgpu)]  queueC=0[16]  queueG=0[16]  queueT=0[16]  buglssc=0
[0 NVIDIA Tegra X1 (nvgpu)]  fp16p=1  fp16s=1  fp16a=1  int8s=1  int8a=1
nvdc: start nvdcEventThread
nvdc: nvdcEventThread select failed: Bad file descriptor
1.00000 at 305.84 766.30 244.91 x 316.35
0.99805 at 1268.22 403.23 137.21 x 174.13
0.99805 at 994.96 178.39 134.77 x 180.02
0.99707 at 1050.96 366.47 127.96 x 157.73
0.99707 at 740.11 764.73 252.11 x 305.27
0.99512 at 717.05 32.50 121.27 x 143.45

ncnn_vulkan_result

nihui commented 4 years ago

Run benchncnn with very large loopcount At the same time, run nvidia-smi and check if benchncnn is in the list

ghimiredhikura commented 4 years ago

@nihui

Thanks for quick reply. Its Jetson Nano so nvidia-smi is not available. However running benchncnn I got following output:

ghimire@ghimire:~/ncnn_vulkan/build/benchmark$ ./benchncnn 10 4 0 0
[0 NVIDIA Tegra X1 (nvgpu)]  queueC=0[16]  queueG=0[16]  queueT=0[16]  buglssc=0
[0 NVIDIA Tegra X1 (nvgpu)]  fp16p=1  fp16s=1  fp16a=1  int8s=1  int8a=1
loop_count = 10
num_threads = 4
powersave = 0
gpu_device = 0
          squeezenet  min =   31.10  max =   36.58  avg =   33.16
           mobilenet  min =   26.63  max =   34.65  avg =   30.48
        mobilenet_v2  min =   20.44  max =   23.86  avg =   22.05
        mobilenet_v3  min =   23.38  max =   25.96  avg =   24.36
          shufflenet  min =   16.46  max =   23.34  avg =   20.55
       shufflenet_v2  min =   19.35  max =   22.94  avg =   21.03
             mnasnet  min =   16.26  max =   19.79  avg =   18.26
     proxylessnasnet  min =   19.12  max =   25.53  avg =   23.34
           googlenet  min =   50.05  max =   58.51  avg =   54.87
            resnet18  min =   49.82  max =   55.74  avg =   54.03

And this is the result of building ncnn without vulkan:

ghimire@ghimire:~/ncnn/build/benchmark$ ./benchncnn 10 4 0
loop_count = 10
num_threads = 4
powersave = 0
gpu_device = -1
          squeezenet  min =   31.02  max =   32.55  avg =   31.42
     squeezenet_int8  min =   38.11  max =   38.64  avg =   38.45
           mobilenet  min =   40.69  max =   46.27  avg =   41.58
      mobilenet_int8  min =   85.51  max =   87.86  avg =   86.38
        mobilenet_v2  min =   32.44  max =   43.20  avg =   33.74
        mobilenet_v3  min =   28.95  max =   30.92  avg =   29.44
          shufflenet  min =   23.16  max =   24.74  avg =   23.44
       shufflenet_v2  min =   21.93  max =   22.90  avg =   22.30
             mnasnet  min =   30.75  max =   41.56  avg =   32.30
     proxylessnasnet  min =   35.76  max =   37.59  avg =   36.32
           googlenet  min =   99.24  max =  105.47  avg =  100.41
      googlenet_int8  min =  121.90  max =  132.61  avg =  124.71
nihui commented 4 years ago

That indicates the gpu is actually used You see that it runs even faster than 4-cpu cores.

ghimiredhikura commented 4 years ago

Yes, it looks great. However, I am still wondering why this message is there while testing retinaface example.

nvdc: nvdcEventThread select failed: Bad file descriptor
nihui commented 4 years ago

I have no idea about this error message, it may be an internal issue of the vulkan driver

A rough search gives me a gfx-rs issue https://github.com/gfx-rs/gfx/issues/3116

It may be related on how the vulkan instance is created because it did not appear in your benchncnn output.

Is it only occurs in retinaface example ? How about the other ncnn examples ?

nihui commented 9 months ago

just ignore warning message atm :D