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.

Reorganize CUB environment variables

See original GitHub issue

Currently there’re 4 CUB-related environment variables.

  • CUB_PATH: used at build time to build cupy.cuda.cub
  • CUPY_CUB_PATH: used at runtime to build reduction kernel (#3244)
  • CUPY_CUB_BLOCK_REDUCTION_DISABLED (default: 1): Set to 0 to enable performance boost in reduction kernel (#3244)
  • CUB_DISABLED (default: 1): Set to 0 to enable CUB in various computations

We think it is better to disable CUB by default, even in CUDA 11, as users expect reproducibility (deterministic behavior). Instead, we need to provide a simple “opt-in” method to enable CUB for users needing a performance boost.

This issue proposes the followings:

  • Remove CUB_PATH and CUPY_CUB_PATH (always use bundled CUB #2584 or CUDA 11 built-CUB, as user-provided CUB headers are unlikely to be used (considering we haven’t requested to implement CUPY_THRUST_PATH).
    • In CUDA 11, use CUB included in CUDA runtime. If CUB headers are unavailable in system (e.g., maybe in “runtime” docker container; need to check after CUDA 11 is finally released), use CUB bundled in CuPy.
    • In CUDA 10 or earlier, always use CUB bundled in CuPy.
  • Merge CUPY_CUB_BLOCK_REDUCTION_DISABLED and CUB_DISABLED into one environment variable CUPY_BACKENDS="cub,cutensor" (default: “”, i.e., cub/cutensor disabled by default). Users can specify backends in the referred order, separated by a comma. Boolean flags (cupy.core.cub_block_reduction_enabled and cupy.cuda.cub_enabled) are removed for consistency.
  • For testing and debugging purposes, provide the following undocumented APIs:
cupy.core.set_routine_backends(['cub', 'cutensor'])
cupy.core.set_reduction_backends(['cub', 'cutensor'])

(edit 2020-06-25: updated based on the latest discussion)

cc/ @leofang @anaruse

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
kmaehashicommented, Jun 24, 2020

Another thing is what do you plan for CUDA 11? Do you wanna use CuPy’s CUB or CUDA’s?

My idea is:

  1. In CUDA 11, use CUB included in CUDA runtime. If CUB headers are unavailable in system (e.g., maybe in “runtime” docker container? I’m not sure as CUDA 11.0 is still RC…), use CUB bundled in CuPy.
  2. In CUDA 10 or earlier, always use CUB bundled in CuPy. No external CUB_PATH.

@asi1024 @emcastillo How do you think?

I guess it depends if you have a separate CI to test CUDA 11 or not…

I’m now preparing CI for CUDA 11. The first cupy-cuda110 release would be in the next month.

2reactions
emcastillocommented, Jun 18, 2020

@emcastillo Because we can then use newer CUB from conda-forge, see all available versions here. Moreover, it allows us to simplify the package recipe as follows (@jakirkham correct me if I’m wrong!):

I think we should stick to the bundled cub when distributing binaries because it is the main one tested and make user configurations deterministic across package systems. Changing packages versions depending on the environment is most likely going to give us headaches later on.

If the user wants to try a different cub version then he/she can update the submodule folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Environment Variables — CUBRID 9.1.0 ...
CUBRID_DATABASES: The environment variable that designates the location of the databases.txt file. The CUBRID system stores the absolute path of database ...
Read more >
Environment Variables | Cube Docs
Cube defines a number of environment variables that can be used to change behavior. Some of these variables can also be set via...
Read more >
Rapid Environment Editor - The Windows Club
Rapid Environment Editor is a powerful Environment Value or Variables Editor for Windows 11/10. Read review, download Rapid EE free.
Read more >
Node.js - How to organize environment variables
Let's say we have only one environment variable, X . X will have a different value in development and production.
Read more >
The Effects of Cortical Reorganization and Applications of ...
Numerous studies have attempted to study the variables that affect CI outcomes, including the personal characteristics of CI candidates, environmental ...
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