-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of GLog #718
Implementation of GLog #718
Conversation
ae328c7
to
11371db
Compare
@vlad-perevezentsev @oleksandr-pavlyk IMO glog usage in dpctl is a debugging feature intended for developers of dpctl or library writers who want to investigate some problem by turning on logging. I propose the following design:
Few unknowns:
|
@diptorupd Glog has little information in the documentation so I can't answer using it.
|
Another important aspect is whether |
0ebf25e
to
420d8c5
Compare
8daf2e3
to
a1ced1a
Compare
a1ced1a
to
6a4d00f
Compare
Note for posterity: glog=0.5 is required. The 0.4 does not declare |
62cb7e3
to
94ffffd
Compare
94ffffd
to
860afcd
Compare
Replaced use of `stat` function with use of `filesystem::is_directory`. Stat was always erroring out even for path to existing directory. Created `dpctl._dev` module for developers. It adds ```python dpctl._dev.init_logger(log_dir=None) ``` Function to initialize the logger. It uses `"dpctl"` for application name, and supplied log directory. `log_dir=None` is interpreted as use the current working directory. ```pyton dpctl._dev.fini_logger() ``` Call ShutdownLogger. ```python dpctl._dev.verbose(verbostiy="warning", log_dir=None) ``` Context manager which initializes the logger, and sets the verbosity level for a given block of Python code: Example: ``` In [1]: import dpctl, dpctl._dev as dd In [2]: with dd.verbose(): dpctl.SyclDevice().parent_device No parent for device because it is not a subdevice -33 (CL_INVALID_DEVICE) in DPCTLDevice_GetParentDevice at /localdisk/work/opavlyk/repos/dpctl/libsyclinterface/source/dpctl_sycl_device_interface.cpp:540 In [3]: dpctl.SyclDevice().parent_device # no message In [4]: with dd.verbose(): dpctl.SyclDevice().parent_device No parent for device because it is not a subdevice -33 (CL_INVALID_DEVICE) in DPCTLDevice_GetParentDevice at /localdisk/work/opavlyk/repos/dpctl/libsyclinterface/source/dpctl_sycl_device_interface.cpp:540 In [5]: dpctl.SyclDevice().parent_device # no message In [6]: quit ``` Export DPCTLService_InitLogger and DPCTLService_FiniLogger
1. GLOG defaults (log_dir=None) to outputing to color-enhanced std::cerr 2. Specifying valid log_dir changes the mode to logging 3. Context manager renamed from verbose to syclinterface_diagnostic Test updated.
6f174bd
to
84e7dc5
Compare
This PR contains the primary implementation of using GLog in dpctl.
The implementation used Glog 5.0
conda install glog
Added the
--glog
flag for setup in development modepython setup.py develop --glog=True
Implemented 2 functions for initialization and deinitialization of GLog
void DPCTLService_InitLogger
andvoid DPCTLService_ShutdownLogger