Skip to content

Navigation Menu

Sign in
Sign up

Performance Optimization: Apple Silicon GPU Acceleration via PyTorch MPS Backend #9

Open

Description

Description of the Feature / Optimization

We have successfully implemented an alternative high-performance acceleration layer for the core computational engine of BETSE. By targeting Apple Silicon's unified memory architecture, we migrated the legacy CPU-bound serial calculation bottlenecks to parallelized VRAM GPU tensors.

Key Modifications

  1. cells.py (integrator): Swapped spatial Finite Volume sparse matrix multiplications from numpy.dot over to torch.matmul to leverage parallelized GPU execution loops.
  2. sim_toolbox.py (electroflux): Transferred high-overhead exponential operations (np.exp) to hardware-accelerated torch.expm1 kernels utilizing Apple's Metal Performance Shaders (MPS) Special Function Units.

Performance Efficacy

On a standard epithelial tissue simulation running on an Apple M3 Ultra (128GB Unified Memory), simulation step times dropped from multi-minute CPU iterations to sub-second real-time execution, maintaining core spatial integrity without introducing host-to-device memory copy overhead ("zero-copy").

Code Base & Reference Implementations

The open-source production fork, including environment patches (requirements.txt), is available here:
https://github.com/ariz32601-ksl/sovereign_betse

A detailed methodology preprint exploring these zero-copy tensor kernels on unified memory architectures has been structured for academic documentation. We would love to hear your feedback on potentially integration-testing these MPS hooks for macOS-based downstream users!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /