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

nixos/manual: add a section about enabling OpenCL for AMD GPUs #93290

Merged
merged 1 commit into from Jul 18, 2020

Conversation

danieldk
Copy link
Contributor

Motivation for this change
  • Begin a new chapter "GPU Acceleration", this should also cover
    VA-API, OpenGL, Vulkan, etc.
  • Add a general blurb about OpenCL and how to check whether OpenCL
    devices are found.
  • Add a section about enabling OpenCL for AMD GPUs specifically.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@acowley acowley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Is it worth mentioning how to use rocm-runtime-ext without installing it system-wide? Especially since the documentation describes how to use the OpenCL driver without installing it system-wide, we may as well say how to enable image support that way, too.

@danieldk
Copy link
Contributor Author

Looks good. Is it worth mentioning how to use rocm-runtime-ext without installing it system-wide? Especially since the documentation describes how to use the OpenCL driver without installing it system-wide, we may as well say how to enable image support that way, too.

Great idea. It's also nice for testing. I patched rocm-runtime so that the environment variable is used before the OpenGL driver path, so that it's possible to test updates even if the extension package is installed globally.

@danieldk danieldk requested a review from acowley July 17, 2020 06:31
@Flakebi
Copy link
Member

Flakebi commented Jul 17, 2020

Nice read. Does it make sense to add a command that checks image support (sth like clinfo | grep Image)?

@danieldk
Copy link
Contributor Author

danieldk commented Jul 17, 2020

Nice read. Does it make sense to add a command that checks image support (sth like clinfo | grep Image)?

That would be a nice addition, I'll add that after work.

- Begin a new chapter "GPU Acceleration", this should also cover
  VA-API, OpenGL, Vulkan, etc.
- Add a general blurb about OpenCL and how to check whether OpenCL
  devices are found.
- Add a section about enabling OpenCL for AMD GPUs specifically.
@danieldk
Copy link
Contributor Author

Added!

It is also possible to use the OpenCL Image extension without a
system-wide installation of the <package>rocm-runtime-ext</package>
package by setting the <varname>ROCR_EXT_DIR</varname> environment
variable to the directory that contains the extension:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this handled by the setup-hook.sh for rocm-runtime-ext? If you enter a nix-shell with it as a dependency, the environment variable should be set.

Copy link
Contributor Author

@danieldk danieldk Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix-shell should probably not be recommended for such purposes, since it 'pollutes' the environment with other things (e.g. propagated build inputs). It probably makes most sense to just remove the hook. Such hooks are intended to be used at build time by packages that depend on a package, which is not the case here.

@danieldk danieldk merged commit cace440 into NixOS:master Jul 18, 2020
@danieldk danieldk deleted the manual-opencl-amd branch July 18, 2020 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants