ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.03k stars 9.68k forks source link

PointPillars DoInference takes time too long? #14458

Closed kttnk closed 1 year ago

kttnk commented 2 years ago

System information

Steps to reproduce the issue:

Supporting materials (screenshots, command lines, code/script snippets):

s95huang commented 2 years ago

Hi, it doesn't look like you are using GPU based on your nvidia-smi

kttnk commented 2 years ago

Thanks s95hung. The nvidia-smi screenshot is not seen when the test is running since it'll finish within few secs.

Ex. cnn_segmentation_test( it takes more seconds to execute), it looks like below. image

PointPillars unit test setting is same as above, so it should be run with GPU.

I appreciate it if you let me know the excution time on your machine for reference.

kttnk commented 2 years ago

Using the unit test "point_pillars_test", DoInference function took around 1msec.

Correction: Using the unit test "point_pillars_test", DoInference function took around 1sec.

As you see: image

daohu527 commented 1 year ago

@kttnk This abnormal, We tested on 1080 and it will be 10hz the whole detection pipeline

kttnk commented 1 year ago

@daohu527 I started with another machine and fresh Apollo.

[asdf@in-dev-docker:/apollo]$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              16
On-line CPU(s) list: 0-15
Thread(s) per core:  2
Core(s) per socket:  8
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz
Stepping:            4
CPU MHz:             1200.224
CPU max MHz:         4500.0000
CPU min MHz:         1200.0000
BogoMIPS:            7200.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            11264K
NUMA node0 CPU(s):   0-15
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req md_clear flush_l1d arch_capabilities

[asdf@in-dev-docker:/apollo]$ nvidia-smi
Sat Nov  5 17:47:18 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01    Driver Version: 515.65.01    CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:65:00.0  On |                  N/A |
| 44%   39C    P8    20W / 250W |    474MiB / 11264MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1485      G   /usr/lib/xorg/Xorg                 24MiB |
|    0   N/A  N/A      1558      G   /usr/bin/gnome-shell               82MiB |
|    0   N/A  N/A      1751      G   /usr/lib/xorg/Xorg                190MiB |
|    0   N/A  N/A      1897      G   /usr/bin/gnome-shell               34MiB |
|    0   N/A  N/A      6033      G   /usr/lib/firefox/firefox          137MiB |
+-----------------------------------------------------------------------------+

[asdf@in-dev-docker:/apollo]$ ./apollo.sh config
[INFO] Apollo Environment Settings:
[INFO]     APOLLO_ROOT_DIR: /apollo
[INFO]     APOLLO_CACHE_DIR: /apollo/.cache
[INFO]     APOLLO_IN_DOCKER: true
[INFO]     APOLLO_VERSION: master-2022-10-11-aa0c5eb661
[INFO]     DOCKER_IMG: dev-x86_64-18.04-20210914_1336
[INFO]     APOLLO_ENV:  STAGE=dev USE_ESD_CAN=false
[INFO]     USE_GPU: USE_GPU_HOST=1 USE_GPU_TARGET=1
[INFO] Usage: /apollo/scripts/apollo_config.sh [Options]
[INFO] Options:
[INFO]     -i|--interactive      Run in interactive mode
[INFO]     -n|--noninteractive   Run in non-interactive mode
[INFO]     -h|--help             Show this message and exit

Now I got "Failed to find match for field 'intensity'.".

[asdf@in-dev-docker:/apollo]$ ./bazel-bin/modules/perception/lidar/lib/detector/point_pillars_detection/point_pillars_test
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestSuite
[ RUN      ] TestSuite.CheckDoInference
Failed to find match for field 'intensity'.
object id: 0, x: -10.597, y: 22.6303, z: -0.665026, dx: 4.66114, dy: 2.0102, dz: 1.54743, yaw: -0.265771, label: 0
object id: 1, x: 4.30061, y: 9.67776, z: -1.53812, dx: 4.36442, dy: 1.97584, dz: 1.61129, yaw: 1.54705, label: 0
object id: 2, x: 7.10302, y: 9.30122, z: -1.60145, dx: 4.66161, dy: 2.06203, dz: 1.60633, yaw: 1.46886, label: 0
object id: 3, x: -10.042, y: 26.1391, z: -0.608218, dx: 4.77884, dy: 2.13735, dz: 1.91483, yaw: -0.118531, label: 0
object id: 4, x: 25.0653, y: 3.03073, z: -1.64661, dx: 4.59018, dy: 2.07872, dz: 1.89428, yaw: 1.23717, label: 0
object id: 5, x: 17.6317, y: 5.79744, z: -1.48118, dx: 4.8096, dy: 2.07607, dz: 1.66119, yaw: 1.21685, label: 0
object id: 6, x: 1.26803, y: 8.97789, z: -1.6264, dx: 4.46663, dy: 1.98351, dz: 1.5496, yaw: 1.63924, label: 0
object id: 7, x: 9.86496, y: 8.98435, z: -1.44599, dx: 4.14666, dy: 1.88895, dz: 1.52672, yaw: 1.35965, label: 0
object id: 8, x: -10.955, y: -11.5212, z: -3.60534, dx: 4.91877, dy: 2.15993, dz: 1.99958, yaw: 1.4515, label: 0
object id: 9, x: 19.694, y: 4.51149, z: -1.54153, dx: 5.1654, dy: 2.22471, dz: 1.97741, yaw: 1.19349, label: 0
object id: 10, x: 37.0329, y: -1.99839, z: -1.91137, dx: 4.98546, dy: 2.16431, dz: 1.83118, yaw: 1.18934, label: 0
object id: 11, x: -1.58414, y: 7.97316, z: -1.7281, dx: 4.25313, dy: 1.90643, dz: 1.47089, yaw: 1.80225, label: 0
object id: 12, x: 61.4408, y: -12.4587, z: -2.27538, dx: 5.20939, dy: 2.23457, dz: 1.91971, yaw: 1.18785, label: 0
object id: 13, x: 27.5971, y: 2.40396, z: -1.7307, dx: 4.41434, dy: 1.98672, dz: 1.73067, yaw: 1.23259, label: 0
object id: 14, x: -14.1648, y: 66.0262, z: 1.32511, dx: 4.82568, dy: 2.12585, dz: 1.61017, yaw: -2.27892, label: 0
object id: 15, x: 57.059, y: -10.5419, z: -2.30359, dx: 4.31349, dy: 1.92307, dz: 1.65877, yaw: 1.20801, label: 0
object id: 16, x: 45.9339, y: 1.5869, z: -1.53391, dx: 4.45126, dy: 1.98937, dz: 1.75779, yaw: -0.375638, label: 0
[       OK ] TestSuite.CheckDoInference (1800 ms)
[----------] 1 test from TestSuite (1800 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1800 ms total)
[  PASSED  ] 1 test.

Do you know what is this?

From the command

./apollo.sh test

'perception/lidar' related tests are followings, not including point_pillars_test. Seems point_pillars_test is not tested.

//modules/perception/lidar/common:cloud_mask_test               (cached) PASSED in 0.0s
//modules/perception/lidar/lib/detector/cnn_segmentation/spp_engine:spp_cluster_list_test (cached) PASSED in 0.6s
//modules/perception/lidar/lib/ground_detector/ground_service_detector:ground_service_detector_test (cached) PASSED in 0.5s
//modules/perception/lidar/lib/ground_detector/spatio_temporal_ground_detector:spatio_temporal_ground_detector_test (cached) PASSED in 0.6s
//modules/perception/lidar/lib/object_filter_bank:object_filter_bank_test (cached) PASSED in 0.2s
//modules/perception/lidar/lib/object_filter_bank/roi_boundary_filter:roi_boundary_filter_test (cached) PASSED in 0.2s
//modules/perception/lidar/lib/scene_manager:scene_manager_test (cached) PASSED in 1.2s
kttnk commented 1 year ago

@daohu527

We tested on 1080 and it will be 10hz the whole detection pipeline

Maybe input/output/testing scheme are time consuming...

daohu527 commented 1 year ago

Yes, preprocess will cost time, I think you can test to see where the time is spent