Skip to content

Conversation

@yurekami
Copy link
Contributor

Summary

  • Introduces include/util/logging.h that provides glog-compatible macros (LOG, VLOG, CHECK, DCHECK, CHECK_NOTNULL) with a lightweight fallback implementation
  • This enables gradual migration away from glog dependency
  • When USE_GLOG is defined: uses glog as before
  • Otherwise: uses minimal stderr-based logging with UCCL_VLOG_LEVEL env var for verbose level control

Updated key headers to use the new abstraction:

  • include/util/util.h
  • include/util/timer.h
  • include/util/net.h
  • include/util/shared_pool.h

Test plan

  • Build with USE_GLOG defined - should use glog as before
  • Build without USE_GLOG - should use lightweight fallback
  • Verify UCCL_VLOG_LEVEL environment variable controls verbose logging

Addresses #295

🤖 Generated with Claude Code

Introduces include/util/logging.h that provides glog-compatible macros
(LOG, VLOG, CHECK, DCHECK) with a lightweight fallback implementation.

This enables gradual migration away from glog dependency:
- When USE_GLOG is defined: uses glog as before
- Otherwise: uses minimal stderr-based logging

Updated key headers to use the new abstraction:
- include/util/util.h
- include/util/timer.h
- include/util/net.h
- include/util/shared_pool.h

Addresses uccl-project#295

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@YangZhou1997
Copy link
Member

YangZhou1997 commented Dec 27, 2025

Hi @yurekami , thank you for the contribution! We actually have some plans on this and would like a similar interface to NCCL's one: https://github.com/NVIDIA/nccl/blob/master/src/debug.cc. Would you like to convert to NCCL's APIs and implementation?

@yurekami
Copy link
Contributor Author

Thanks for the pointer to NCCL's debug.cc! I'll study that implementation and revise this PR to align with NCCL's logging interface. This would provide better consistency for users familiar with NCCL debugging.

Revise logging abstraction to match NCCL's logging interface per
maintainer feedback. The new implementation:

- Uses ncclDebugLogger_t function pointer passed via pluginInit()
- Provides INFO(flags, fmt, ...), WARN(fmt, ...), TRACE(flags, ...) macros
- Defines subsystem flags (UCCL_INIT, UCCL_NET, UCCL_P2P, UCCL_ALL)
- Includes fallback logger for stderr when NCCL logger unavailable
- Updates RDMA plugin as reference implementation

This aligns with NCCL's debug.cc interface as requested:
https://github.com/NVIDIA/nccl/blob/master/src/debug.cc

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@yurekami
Copy link
Contributor Author

Thanks for the feedback @YangZhou1997! I've revised the implementation to use NCCL-style logging API.

Changes

include/util/logging.h now provides:

  • ncclDebugLogger_t function pointer storage (set via uccl::logging::initLogger())
  • NCCL-style macros matching the interface from NCCL's debug.cc:
    • INFO(flags, fmt, ...) - info-level logging with subsystem flags
    • WARN(fmt, ...) - warning-level logging
    • TRACE(flags, fmt, ...) - trace-level logging
  • Subsystem flags: UCCL_INIT, UCCL_NET, UCCL_P2P, UCCL_ALL
  • Fallback stderr logger when NCCL logger is unavailable

collective/rdma/nccl_plugin.cc updated as reference:

ncclResult_t pluginInit(ncclDebugLogger_t logFunction) {
  uccl::logging::initLogger(logFunction);
  INFO(UCCL_INIT, "UCCL RDMA plugin initialized, PID: %d", getpid());
  ...
}

The EFA and afxdp plugins can be migrated similarly in follow-up PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants