Skip to main content

Backend server for flopscope client-server architecture

Project description

flopscope-server

PyPI version Python 3.10+ License: MIT

Server-side runtime for the flopscope client-server architecture.

flopscope-server runs the heavy NumPy-backed flopscope library on behalf of remote flopscope-client processes that connect over ZMQ + msgpack. Use it when you want to isolate untrusted or sandboxed code (typically participant submissions in the ARC Whitebox Estimation Challenge) from the actual computation environment.

When to install this

You want this on the server side of a client-server flopscope deployment. It pulls in flopscope, numpy, pyzmq, and msgpack:

pip install flopscope-server

Equivalent extra on the main flopscope distribution (installs both at the same exact version):

pip install "flopscope[server]"

Quick start

Launch the server

# Over a UNIX domain socket (recommended for local / single-host deployments)
python -m flopscope_server --url ipc:///tmp/flopscope.sock

# Or over TCP
python -m flopscope_server --url tcp://127.0.0.1:15555

Connect a client

In a separate process (typically a sandboxed container) that has flopscope-client installed:

export FLOPSCOPE_SERVER_URL=ipc:///tmp/flopscope.sock
import flopscope as flops
import flopscope.numpy as fnp

with flops.BudgetContext(flop_budget=1_000_000):
    a = fnp.array([1.0, 2.0, 3.0])
    b = fnp.array([4.0, 5.0, 6.0])
    fnp.add(a, b)
    flops.budget_summary()

The client's first request performs a version handshake with the server; mismatched flopscope versions raise ConnectionError with both versions in the message. Keep flopscope-server and flopscope-client on the same release.

Architecture overview

┌─────────────────────────────┐         ZMQ + msgpack         ┌──────────────────────────────┐
│  flopscope-client process   │ ───────────────────────────▶  │  flopscope-server process    │
│  (sandbox; no numpy)        │                                │  (full flopscope + numpy)    │
│  `import flopscope as flops`│ ◀───────────────────────────  │  Executes ops, tracks budget │
└─────────────────────────────┘                                └──────────────────────────────┘

Every counted operation (matmul, einsum, FFT, reductions, …) is dispatched to the server, executed against the real library, and the result + remaining budget streamed back. The client never sees numpy.

Related

  • flopscope — the NumPy-backed library hosted by this server
  • flopscope-client — the lightweight proxy clients use to talk to a flopscope-server
  • Documentation — full guides including client/server architecture and Docker recipes
  • GitHub — source, CHANGELOG, contributor guide

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flopscope_server-0.8.0rc4.tar.gz (73.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flopscope_server-0.8.0rc4-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file flopscope_server-0.8.0rc4.tar.gz.

File metadata

  • Download URL: flopscope_server-0.8.0rc4.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flopscope_server-0.8.0rc4.tar.gz
Algorithm Hash digest
SHA256 1127bf232289bc324136c3057f61d1fe60226f2eda77565b905f73fa5a734e8e
MD5 da760f523d99d1daff3ac12d842b1bfd
BLAKE2b-256 5ae82a66c6647cb9d16e8659a4a083f241fa828f88b0838450d3ace61cfe5af5

See more details on using hashes here.

Provenance

The following attestation bundles were made for flopscope_server-0.8.0rc4.tar.gz:

Publisher: pypi-publish.yml on AIcrowd/flopscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flopscope_server-0.8.0rc4-py3-none-any.whl.

File metadata

File hashes

Hashes for flopscope_server-0.8.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 0895b3530a90dd4a79713b831c3ddc7feed65fcd61dca5bb21b37c078d2894a9
MD5 a07a7108fcec62b4ad50fbc75fb0dbb6
BLAKE2b-256 c5d1e9990a6d6e861b03cead208f9be688d0241f3bcf39920a7c82e4fbd5a31b

See more details on using hashes here.

Provenance

The following attestation bundles were made for flopscope_server-0.8.0rc4-py3-none-any.whl:

Publisher: pypi-publish.yml on AIcrowd/flopscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page