facebookresearch / CompilerGym

Reinforcement learning environments for compiler and program optimization tasks
https://compilergym.ai/
MIT License
906 stars 127 forks source link

Running `random_search.py` keep printing debug level logs. How do I silent these prints? #556

Closed uduse closed 2 years ago

uduse commented 2 years ago

❓ Questions and Help

It seems these prints are DEBUG level but I couldn't find the correct command line flags to turn these off. Any ideas? 😕

(compiler_gym) zeyi@server121:~/compiler_gym_sandbox_mount/compiler_gym_sandbox/CompilerGym/leaderboard/llvm_instcount/random_search$ python random_search.py --patience_ratio 1.25 --search_time 10 --novalidate --n 1
I0127 18:51:50.960705 1723247 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185150-923576-ed45" listening on 35315, PID = 1723247
Writing results to llvm_instcount-results.csv
Writing logs to llvm_instcount-results.log
=== Evaluating policy on 23 cbench-v1 benchmarks ===
Runtime: 0:00:00. Estimated completion: 0:00:00. Completed: 0 / 23 (0.0%).
Current mean walltime: 0.001s / benchmark.
Current geomean reward: 0.0000.I0127 18:51:51.374635 1723272 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-347401-4234" listening on 46641, PID = 1723272
I0127 18:51:51.387058 1723280 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-359689-64e4" listening on 36469, PID = 1723280
I0127 18:51:51.402427 1723294 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-373197-a806" listening on 43123, PID = 1723294
I0127 18:51:51.405671 1723307 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-384682-8b3d" listening on 44731, PID = 1723307
I0127 18:51:51.422855 1723318 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-384953-cafe" listening on 45317, PID = 1723318
I0127 18:51:51.436448 1723335 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-411264-bf5d" listening on 35145, PID = 1723335
I0127 18:51:51.450918 1723329 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.453621 1723329 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.454818 1723353 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-407768-a74e" listening on 46175, PID = 1723353
I0127 18:51:51.473459 1723376 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-425448-e843" listening on 46783, PID = 1723376
I0127 18:51:51.491595 1723382 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-428236-da5a" listening on 35851, PID = 1723382
I0127 18:51:51.504839 1723384 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-444834-cedd" listening on 35375, PID = 1723384
I0127 18:51:51.521775 1723394 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-430533-b6f9" listening on 39981, PID = 1723394
I0127 18:51:51.539449 1723417 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-464321-0d6e" listening on 44627, PID = 1723417
I0127 18:51:51.539449 1723407 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-442526-f6b3" listening on 40369, PID = 1723407
I0127 18:51:51.544651 1723305 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.549432 1723317 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.550434 1723305 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.552018 1723317 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.581676 1723291 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.586622 1723346 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.586645 1723291 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.593907 1723446 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-487325-dc67" listening on 41007, PID = 1723446
I0127 18:51:51.595366 1723346 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.627743 1723460 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-465215-c7bf" listening on 44303, PID = 1723460
I0127 18:51:51.646414 1723474 CreateAndRunCompilerGymServiceImpl.h:123] Service "/dev/shm/compiler_gym_zeyi/s/0127T185151-497278-0a9c" listening on 34389, PID = 1723474
I0127 18:51:51.657454 1723374 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.661252 1723360 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.667390 1723374 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.669800 1723360 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.673712 1723381 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.681447 1723401 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.681946 1723381 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.700899 1723401 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.710613 1723415 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
I0127 18:51:51.711825 1723391 CompilerGymServiceImpl.h:60] StartSession(id=0, benchmark=benchmark://cbench-v1/adpcm), 1 active sessions
ChrisCummins commented 2 years ago

Hey @uduse! Sorry for the slow reply. I looked into this and the bug is in the logging setup code in compiler_gym/leaderboard/llvm_instcount.py:

https://github.com/facebookresearch/CompilerGym/blob/development/compiler_gym/leaderboard/llvm_instcount.py#L238-L242

Changing the line:

-            logger.setLevel(logging.DEBUG)
+            logger.setLevel(logging.WARNING)

Prevented those debugging logs from being printed to stdout. Of course, it also prevents the logging output from being written to file. I'll see if there's a proper fix down the road. In the meantime, patches welcome!

Cheers, Chris

uduse commented 2 years ago

Thanks for the reply. I have no idea how I missed that line. I looked at that file at least ten times. Need to eat more 🐟 and ðŸŦ ðŸĪĢ

Also do you have any plan to change llvm_instcount.py in the near future?

ChrisCummins commented 2 years ago

Hah, no worries! I'll keep this open for now as it is definitely a bug and might be an easy fix for someone looking to contribute.

Also do you have any plan to change llvm_instcount.py in the near future?

We have discussed that, but tbh I don't think its on anyone's near term roadmap. There's a few things that it could do better, like parallel evaluation for single-threaded searches, better support for logging agent progress, etc. Why do you ask?

Cheers, Chris

uduse commented 2 years ago

I'm working a better evaluation script for my research. If you don't have a plan for now, maybe I'll do a PR later. No promise at all though ðŸĪŠ

ChrisCummins commented 2 years ago

Oh nice! I look forward to it if/when 🙂

Cheers, Chris