question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This is more for my own little curiosity than a feature request, but I thought it’s worth discussing.

It is not possible to compile Thrust/CUB code in NVRTC because many system headers are missing, which was why @emcastillo struggled in #2629 and we still have to keep a copy of our own Thrust complex headers. Jitify claims to provide an easy solution to address this.

I have been looking into jitify’s implementation lately, and I think the key idea is to:

  1. Recursively find out what header (and its absolute path) should be included (by repeating compiling -> inspecting error log)
  2. Fix the headers: for example, provide some stubs to patch a few C++ std functions or system headers so that they can work as __device__ functions, remove static variables, fix pragma, etc

Since we have most of the toolchain in place (compile/launch/CUDA API/etc), especially #3319 is now merged, I think it is not super difficult to address this. I can think of two design choices:

  1. Wrap jitify in cupy.cuda.jitify: Ideally, we still use our NVRTC wrapper to do compilation, and only take all these lookup implementations as-is so we don’t reinvent the wheel. Unfortunately it is currently not possible, as many logics are baked in jitify’s public APIs, and it requires some refactoring on the their side for us to reuse.
  2. Implement the compile-error search loop by ourselves in cupy/cuda/compiler.py: This would require kinda reimplementing what’s done in jitify, but only for a small part (I hope). The pro is jitify doesn’t need to be a dependency and we just reuse what’s already available (very important for code maintenance), and the cons are that it takes more effort and that it needs to copy a significant amount of code from jitify (mainly those code patches).

I think a few RAPIDS libraries like cuDF use jitify. I will dig into how they use it…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
maddyscientistcommented, Aug 13, 2020

@harrism just to note that https://github.com/NVIDIA/jitify/pull/39 has been merged.

1reaction
maddyscientistcommented, Nov 4, 2020

@leofang if you’re just wanting some of the headers provided by Jitify, you might be better looking at using libcu++'s headers: https://github.com/NVIDIA/libcudacxx/tree/main/include/cuda/std.

These are more fully featured, and are being continually expanded to provide more coverage of the the C++ standard library, as well as some C headers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NVIDIA/jitify: A single-header C++ library for ... - GitHub
Support for CUDA versions 7.0, 7.5, 8.0, 9.x, 10.x, on both Linux and Windows; Convenient parallel_for function and lambda support; *New* jitify::experimental ...
Read more >
Combined Python/CUDA JIT for Flexible Acceleration in RAPIDS
Our framework uses the Numba Python compiler and Jitify CUDA just-in-time (JIT) compilation library to provide cuDF users the flexibility of Python with...
Read more >
cupy/community - Gitter
CUDA 11.1 support has been added so now you can use CuPy with your GeForce RTX ... Python to CUDA, NVIDIA Jitify support,...
Read more >
Check that `name_expressions` is iterable - Stack Overflow
When trying out the new jitify support planned for CuPy v9.x, I found that the name_expressions named argument to cupy.
Read more >
User-Defined Kernels — CuPy 11.4.0 documentation
Accessing texture (surface) memory in RawKernel is supported via CUDA ... In this case, try enabling CuPy's Jitify support by setting jitify=True when ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found