apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Can I run the test file (for example: cnn_segmentation_test) with CPU?

Open markofan opened this issue 6 years ago • 7 comments

My computer don't have GPU, Can I run the test file (for example: cnn_segmentation_test) with CPU? I don't need to train the model, just want to test the file.

markofan avatar Jun 23 '20 07:06 markofan

Hi @markofan , many tests in Perception module require GPU, cause they have some cuda functions which can only run in GPU. You can check the BUILD file to see if there are .cu files related to the test. For example, cnn_segmentation_test relies on feature_generator.cu, in this case, it can only run in GPU. For those tests that don't use cuda, you can build apollo in CPU mode and try to run bazel test //path/to/test so it maybe pass with CPU only.

jeroldchen avatar Jun 23 '20 09:06 jeroldchen

Thank you so much for your reply! I find a test file, which is hm_matcher_test.cc, the file is in modules\perception\radar\lib\tracker\matcher There is no '.cu' file in BUILD, but when I run this command

sudo bazel test //modules/perception/radar/lib/tracker/matcher:hm_matcher_test

It caused error, which is "error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory" Do you know how to solve this problem?

markofan avatar Jun 23 '20 09:06 markofan

@markofan Try bazel test --cxxopt=-DCPU_ONLY //modules/perception/radar/lib/tracker/matcher:hm_matcher_test . Hope it helps.

jeroldchen avatar Jun 23 '20 11:06 jeroldchen

I close the docker, and open a new terminal. run the command, but still get the same error,

Test output for //modules/perception/radar/lib/tracker/matcher:hm_matcher_test: /apollo/.cache/bazel/540135163923dd7d5820f3ee4b306b32/execroot/apollo/bazel-out/local-fastbuild/bin/modules/perception/radar/lib/tracker/matcher/hm_matcher_test.runfiles/apollo/modules/perception/radar/lib/tracker/matcher/hm_matcher_test: error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory

markofan avatar Jun 23 '20 12:06 markofan

@markofan Remove .cache (you can just rename it as a backup) and run the command again. Otherwise it won't rebuild.

jeroldchen avatar Jun 23 '20 13:06 jeroldchen

Hi, In the docker, I use this command (remove the . cache folder in docker)

root@in_dev_docker:/apollo$ sudo rm -rf .cache/

and run the command, bazel test --cxxopt=-DCPU_ONLY //modules/perception/radar/lib/tracker/matcher:hm_matcher_test

but it shows the same error!

markofan avatar Jun 23 '20 13:06 markofan

Hi @jeroldchen, When I run the test file in /prediction, it can work! I use this command

sudo bazel test --cxxopt=-DCPU_ONLY //modules/prediction/common:environment_features_test

I don't know why the test file in preception can't run successfully? Is there somthing else needed to be set?

markofan avatar Jun 23 '20 13:06 markofan