Skip to content

v2.1.0

Latest

Choose a tag to compare

@m-reuter m-reuter released this 09 Mar 14:52
· 3 commits to main since this release
e519342

CPU-based Rendering Support

This release adds EGL CPU rendering (via llvmpipe, "surfaceless") and also osMesa support for older systems. The advantage of EGL over osMesa is that it can do both GPU and CPU off-screen rendering, while osMesa is CPU only (and often osMesa libraries are not installed). This allows rendering without DISPLAY, no xvfb wrappers needed, with or without GPU. Specifically:

  1. You can render on a workstation via ssh login (no supported DISPLAY, either with GPU acceleration or CPU based)
  2. You can render in Docker (EGL CPU based or when --gpus all is passed also with GPU)
  3. You can render in Singularity (same, GPU requires passing --nv)
  4. You can render off screen in Windows (after installing the necessary dll (see our test CI workflow)
  5. You can render with DISPLAY and window manager on a Mac (or use a container for complete off-screen)

Note: osMesa might not be supported for very long, it is recommended to use EGL instead.

Together with this upgrade, we changed a few interfaces (breaking full backward-compatibility, in a few places). Since 2.0 was released last week, we think it is not widely adopted yet anyway and therefore proceed to 2.1 instead of 3.0. as the changes are too minor to warrant a major release.

What's Changed

  • Add support for EGL CPU-based rendering (llvmpipe MESA) on Linux
  • Add OSMesa for CPU rendering on Linux
  • Make get_view_matrix top level import
  • In snap1 remove viewmat paramter and pass it via view (either a view type or matrix) (! breaks backward compatibility!)
  • In snap_rotate also allow passing a matrix via start_view
  • Add gl/osmesa_context.py as a drop-in with the same public API (make_current, read_pixels, destroy). Raises a clear RuntimeError with a platform-specific install hint if libOSMesa is not found
  • Delete gl/_platform.py — the PYOPENGL_PLATFORM=egl env-var setter is no longer needed
  • Delete gl/views.py — redistributed its contents to their natural homes:
    • get_view_matrices / get_view_matrixutils/types.py (pure numpy, no GL, lives alongside ViewType which it maps over)
    • ViewState, arcball_*, compute_view_matrixcli/whippersnap.py (only consumer; no reason to be in a shared module)
  • Rename _egl_context_offscreen_context in gl/utils.py — the old name was a historical artefact.
  • Fix snap4 to look like v1 images (slightly enlarge top views, remove padding, center colorbar)
  • unify parameter names fthresh and fmax (also in plot3d, breaks backward compatibility)
  • Fix license syntax in pyproject.toml
  • Bump action versions
  • Set default visible false for snap functions (don't show on screen), visible window is only for the Qt GUI.
  • Refactor some internal files (file names in the gl module and function names).
  • Docs: Update README.md, DOCKER.md
  • Docker: include only required dependencies and update to allow --gpus all to run EGL GPU-based also.

CI (pytest.yml):

  • Ubuntu installs libegl1 for headless CPU rendering.
  • macOS requires a GLFW invisible window backed by GPU drivers (no headless, therefore skipping rendering in CI). If you need headless on Mac, use linux docker.
  • Windows: we install the necessary dll and can do offscreen rendering also in CI.

Migration from 2.0 (breaking changes)

  • Instead passing viewmat in snap1 -> migrate to using view
  • rename command line and function parameter brain_scale to scale as we plot other geometries, not just brains.
  • In plot3d use fthresh instead of minval and fmax instead of maxval for consistency with other methods

Full Changelog: v2.0.0...v2.1.0