Skip to content
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

Clarify log file name behaviour in docs #722

Merged
merged 10 commits into from
Mar 18, 2021
Merged
24 changes: 24 additions & 0 deletions python/rmm/_lib/device_uvector.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from rmm._lib.device_buffer cimport device_buffer
kkraus14 marked this conversation as resolved.
Show resolved Hide resolved
from rmm._lib.cuda_stream_view cimport cuda_stream_view
from rmm._lib.memory_resource cimport device_memory_resource


cdef extern from "rmm/device_buffer.hpp" namespace "rmm" nogil:
cdef cppclass device_uvector[T]:
device_uvector(size_t size, cuda_stream_view stream) except +
T* element_ptr(size_t index)
void set_element(size_t element_index, const T& v, cuda_stream_view s)
void set_element_async(
size_t element_index,
const T& v,
cuda_stream_view s
) except +
T front_element(cuda_stream_view s) except +
T back_element(cuda_stream_view s) except +
void resize(size_t new_size, cuda_stream_view stream) except +
void shrink_to_fit(cuda_stream_view stream) except +
device_buffer release()
size_t capacity()
T* data()
size_t size()
device_memory_resource* memory_resource()
20 changes: 15 additions & 5 deletions python/rmm/_lib/memory_resource.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,6 @@ cdef class LoggingResourceAdaptor(UpstreamResourceAdaptor):
"log_file_name= argument or RMM_LOG_FILE "
"environment variable"
)
# Append the device ID before the file extension
log_file_name = _append_id(
log_file_name, getDevice()
)

_log_file_name = log_file_name

self.c_obj.reset(
Expand Down Expand Up @@ -504,6 +499,11 @@ cpdef void _initialize(
setDevice(device)

if logging:
# Append the device ID before the file extension
log_file_name = _append_id(
log_file_name, device
)

mr = LoggingResourceAdaptor(
typ(*args, **kwargs),
log_file_name
Expand Down Expand Up @@ -628,6 +628,13 @@ cpdef _flush_logs():
def enable_logging(log_file_name=None):
"""
Enable logging of run-time events.

log_file_name: str, optional
Name of the log file. If not specified, the environment variable
RMM_LOG_FILE is used. A TypeError is thrown if neither is available.
kkraus14 marked this conversation as resolved.
Show resolved Hide resolved
A separate log file is produced for each device,
and the suffix `".dev{id}"` is automatically added to the log file
name.
"""
global _per_device_mrs

Expand All @@ -636,6 +643,9 @@ def enable_logging(log_file_name=None):
for device in devices:
each_mr = <DeviceMemoryResource>_per_device_mrs[device]
if not isinstance(each_mr, LoggingResourceAdaptor):
log_file_name = _append_id(
log_file_name, device
)
set_per_device_resource(
device,
LoggingResourceAdaptor(each_mr, log_file_name)
Expand Down
3 changes: 3 additions & 0 deletions python/rmm/rmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def reinitialize(
log_file_name : str
Name of the log file. If not specified, the environment variable
RMM_LOG_FILE is used. A TypeError is thrown if neither is available.
A separate log file is produced for each device,
and the suffix `".dev{id}"` is automatically added to the log file
name.
"""
rmm.mr._initialize(
pool_allocator=pool_allocator,
Expand Down