NVIDIA / jitify

A single-header C++ library for simplifying the use of CUDA Runtime Compilation (NVRTC).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jitify should not print warnings to stdout by default

harrism opened this issue · comments

Jitify prints logs to stdout by default because JITIFY_PRINT_LOG is defined to 1 by default.

jitify/jitify.hpp

Lines 2817 to 2821 in 3e96bcc

#if JITIFY_PRINT_LOG
std::cout << include_parent << "(" << line_num
<< "): warning: " << include_name << ": [jitify] File not found"
<< std::endl;
#endif

I think it really should print warnings and errors to stderr by default, and ideally provide a way to override logs so they can be output to a file if desired.

See rapidsai/cudf#6117

I encounter the same issue when working on the Python support (cupy/cupy#4228). In Python, in principle we could intercept Jitify's output by hijacking stdout's file descriptor (I actually made this work locally), but the problem is pytest (a Python test framework used in many projects, including CuPy) also does exactly the same thing internally, so when running the test suite it would interfere with my workaround. It would be great if Jitify could optionally print the log somewhere like @harrism suggested.

Even better: append the log to the raised error messages, so that when we capture it in Cython/Python, we can access the log without any file or stream I/O.