Skip to content

apple_mps_pearl

apple_mps_pearl

Experimental Apple-GPU Pearl mining provider via PyTorch MPS.

This provider is a correctness-first bridge to upstream Pearl miner-base. It uses the Apple GPU for the NoisyGEMM matmuls through PyTorch MPS, while leaving transcript hashing and proof construction on CPU until a native Metal kernel exists.

Classes

AppleMpsPearlProvider

AppleMpsPearlProvider()

Bases: CpuPearlProvider

Experimental MPS-backed Pearl provider.

Source code in src/openjarvis/mining/cpu_pearl.py
def __init__(self) -> None:
    self._launcher: PearlSubprocessLauncher | None = None
    self._config: MiningConfig | None = None
    self._started_at: float | None = None
Functions
start async
start(config: MiningConfig) -> None

Spawn pearl-gateway and the MPS miner-loop subprocess.

Source code in src/openjarvis/mining/apple_mps_pearl.py
async def start(self, config: MiningConfig) -> None:
    """Spawn pearl-gateway and the MPS miner-loop subprocess."""
    extra = dict(config.extra or {})
    password_env = extra.get("pearld_rpc_password_env", "PEARLD_RPC_PASSWORD")
    password = os.environ.get(password_env, "")

    self._launcher = PearlSubprocessLauncher(
        gateway_host=extra.get("gateway_host", "127.0.0.1"),
        gateway_port=int(extra.get("gateway_port", DEFAULT_GATEWAY_RPC_PORT)),
        metrics_port=int(extra.get("metrics_port", DEFAULT_GATEWAY_METRICS_PORT)),
        pearld_rpc_url=extra.get("pearld_rpc_url", DEFAULT_PEARLD_RPC_URL),
        pearld_rpc_user=extra.get("pearld_rpc_user", "rpcuser"),
        pearld_rpc_password=password,
        wallet_address=config.wallet_address,
        log_dir=_log_dir(),
        provider_id=self.provider_id,
        miner_module="openjarvis.mining._mps_miner_loop_main",
    )
    self._launcher.start(
        m=int(extra.get("m", 128)),
        n=int(extra.get("n", 128)),
        k=int(extra.get("k", CPU_PEARL_DEFAULT_K)),
        rank=int(extra.get("rank", 64)),
    )
    self._config = config
    self._started_at = time.time()
    self._write_sidecar()

Functions

ensure_registered

ensure_registered() -> None

Idempotently register AppleMpsPearlProvider in MinerRegistry.

Source code in src/openjarvis/mining/apple_mps_pearl.py
def ensure_registered() -> None:
    """Idempotently register AppleMpsPearlProvider in MinerRegistry."""
    if MinerRegistry.contains("apple-mps-pearl"):
        return
    MinerRegistry.register_value("apple-mps-pearl", AppleMpsPearlProvider)