multi-gpu apple metal graphics #186
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ChimeraX-GraphicsMetal
Metal-accelerated multi-GPU graphics for UCSF ChimeraX.
Overview
This bundle provides a high-performance Metal-based graphics renderer for ChimeraX, optimized for macOS systems with Apple Silicon or Intel processors. It leverages Apple's Metal graphics API to deliver improved performance and reduced CPU overhead compared to the default OpenGL renderer.
Key features:
Requirements
Installation
From within ChimeraX:
Alternatively, you can download the wheel file from the releases page and install it using:
Usage
Enabling Metal Rendering
Metal rendering can be enabled with:
To switch back to OpenGL:
Multi-GPU Acceleration
If your system has multiple GPUs, you can enable multi-GPU acceleration:
You can also choose a specific strategy for multi-GPU rendering:
Available strategies:
split-frame- Each GPU renders a different portion of the screentask-based- Different rendering tasks are distributed across GPUsalternating- Frames are alternated between GPUscompute-offload- Main GPU handles rendering, other GPUs handle compute tasksPreferences
The Metal graphics settings can be configured through the preferences menu:
Tools→General→Metal GraphicsOr you can use the command interface:
Building from Source
Prerequisites
Build Steps
Clone the repository:
Build the bundle:
Install in development mode:
Architecture
The bundle implements a Metal-based renderer that integrates with ChimeraX's graphics system:
metal_graphics.py- Python interface to the Metal renderermetal_context.cpp- Core Metal device and context managementmetal_renderer.cpp- Main rendering pipeline implementationmetal_scene.cpp- Scene management for the Metal renderermetal_argbuffer_manager.cpp- Argument buffer management for efficient resource bindingmetal_heap_manager.cpp- Memory management with Metal heapsmetal_event_manager.cpp- Synchronization for multi-GPU renderingmetal_multi_gpu.cpp- Multi-GPU coordination and management