Repository navigation
Conversation
Author
|
@greptileai review |
Ensure the MLX backend selection test runs consistently on non-macOS platforms.
Author
|
@greptileai review |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use the MLX GPU binary for
device="gpu"/is_gpu_simulation=Trueon Apple SiliconWhat
macOS has no CUDA. With this PR, GPU runs of the C++ backend on Apple Silicon use
kspaceFirstOrder-MLX, the k-WaveCUDA solver ported to MLX/Metal. It is released by kspacefirstorder-unified as
kspaceFirstOrder-MLX-darwinplusmlx.metallib(the PR adding it to kspacefirstorder-unified is waltsims/kspacefirstorder-unified#31).kwave/__init__.py:mlxarchitecture, darwin only, which downloadskspaceFirstOrder-MLX-darwin(saved askspaceFirstOrder-MLX) andmlx.metallibintoBINARY_PATH. Intel Macs keep getting no C++ binaries, as before.instead of aborting
import kwave, so the OMP backend stays usable.SimulationExecutionOptions.binary_name,CppSimulation._resolve_binary_path:kspaceFirstOrder-MLX."MLX"is accepted as abackendvalue and maps tocpp/gpuincompat.Before merging
BINARY_VERSIONmust point to the first kspacefirstorder-unified release that containskspaceFirstOrder-MLX-darwinand
mlx.metallib. This PR keepsv1.4.2, which has neither: macOS users then just get a warning and no GPU binary.Testing
pytest tests/test__init__.py tests/test_executor.py tests/test_cpp_simulation.py tests/test_checks.py tests/test_compute_capability_warning.py: 43 passed, 2 skipped (macOS).kwave/bin/darwin:kspaceFirstOrder(..., backend="cpp", device="gpu")matchesdevice="cpu"(v1.4.2 OMP binary) to 1e-6 to 1.2e-5on
ivp_3D_simulation,ivp_heterogeneous_mediumandtvsp_homogeneous_medium_monopole.kspace_first_order_2d_gpu(at_array_as_source) runs on the MLX binary.

Confidence Score: 5/5
The latest test fix appears safe to merge, with no remaining review findings.Summary
Adds MLX binary downloads and GPU selection for Apple Silicon. The latest change fixes the macOS-specific test on Windows.
Reviews (4) · Last reviewed commit: "Mock macOS platform in MLX binary test" · Reviewed by Greptile