| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I'll make a more detailed comment next week, but while in general this looks very good (thanks!), I think the "reemitting" needs some change. Currently, this will duplicate warning/error messages, they will be once printed during the run and once after the run. My initial thought behind reemitting was that we hide the output in standalone mode, but actually that is not the case (by default at least) in Brian2CUDA. So with the new logging system, we will already see the relevant messages during the run (according to the console log level configuration), there is no need to print them again after the run. However, the messages that are printed during the run are not included in Brian's file log (which is by default deleted if everything goes well, actually). I need to think a bit more about this, but a failing simulation is probably the main use case where we'd like to reemit log messages, but we'd only send them to the file handler. Another option would be to directly print things to the file log from within the C++ code, i.e. to also take the file log level into account. Maybe this is actually the easiest solution, and also the more robust. For example, if a simulation crashes completely, there might still be helpful stuff in the log, even if we never get back to Python to reemit things. |
Sorry, something went wrong.
|
A few more notes, but no need to rush this:
|
Sorry, something went wrong.
|
Thank you @mstimberg , that makes sense. I’ll switch host logging to stderr and keep the separate CUDA log file, re-emitting it only to the FileHandler. so that we can avoid duplicated console output but still record relevant messages when failures happen. For OOM/cudaMalloc failures, yes, they go through B2C_LOG_ERRORvia CUDA_SAFE_CALL / _cudaSafeCall and will be captured after a failed run. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Hi @mstimberg, this PR introduces a unified compile-time logging system for Brian2CUDA built around B2C_LOG_* macros.
The Brian2 console log level maps to -DB2C_LOG_LEVEL at build time, ensuring host and device diagnostics are gated before compilation. On the host, log messages print to stdout, while WARNING and ERROR logs are also saved to results/cuda_log.txt and re-emitted via the Brian2 logger after the standalone process completes. On the device, logging currently relies on printf.
The main change replaces ad-hoc printf, std::cout, and std::cerr calls across the codebase with the new B2C_LOG_ERROR/WARN/INFO/DEBUG macros.