Skip to main content

Exact, evidence-oriented comparison of GDSII layout geometry

Project description

gdsdiff

gdsdiff compares the geometry and hierarchy of two GDSII layouts and emits neutral, machine-readable evidence. It supports exact CPU verification by default and can use optional CUDA or Apple Metal acceleration when a compatible system toolchain and device are available.

The package is usable on CPU-only machines. CUDA, Metal, CMake, and compiler toolchains are runtime capabilities, not mandatory Python dependencies.

Install

python -m pip install gdsdiff

For local development from this checkout:

UV_PROJECT_ENVIRONMENT=.venv_wsl UV_LINK_MODE=copy uv sync --locked --extra dev
TMPDIR=/tmp .venv_wsl/bin/python -m pytest

Use a repository-local virtual environment: .venv_wsl on Windows 11 through WSL, .venv_mac on macOS, and .venv on native Linux.

Command line

python -m gdsdiff before.gds after.gds --output-dir comparison

Exit codes are stable: 0 means the selected failure policy passed, 1 means differences failed the policy, and 2 means the comparison could not produce valid evidence. Reports use factual directions such as coverage_before_only and coverage_after_only.

Python API

from gdsdiff import CompareConfig, compare_gds_files

result = compare_gds_files(
    CompareConfig("before.gds", "after.gds", backend="cpu")
)
print(result.status, result.exit_code)

Polygon extraction is public so downstream tools such as ebeamtime can share the same zero-copy PolygonBuffer representation:

from gdsdiff import extract_gds_polygons

extraction = extract_gds_polygons("layout.gds", layers="1:0,2:0")
print(extraction.buffer.polygon_count)

See docs/ for comparison semantics, report format, engine details, and debugging guidance.

Optional acceleration

  • CUDA requires an NVIDIA GPU, a compatible driver, and the CUDA toolkit with nvcc available. On WSL, install the Windows NVIDIA display driver and the WSL CUDA toolkit, never a Linux display driver. nvcc is discovered from PATH, CUDA_HOME, /usr/local/cuda, or /opt/cuda.
  • On-demand builds default to NVIDIA's -arch=native: nvcc detects visible GPUs and emits native SASS without PTX. For cross-machine builds, set GDSDIFF_CUDA_ARCHITECTURES to comma-separated compute capabilities without decimals (for example, 89,120). Targets and standard NVCC_*_FLAGS are included in the content-addressed cache key.
  • Metal requires Apple Silicon/macOS with the Xcode command-line tools.
  • Missing or unusable accelerators fall back to CPU unless require_gpu=True is explicitly requested.

Installation and import never compile GPU code. Inspect the CUDA toolchain with gdsdiff.inspect_cuda_toolchain(), then build and verify the optional backend with gdsdiff.prepare_cuda() or gdsdiff-prepare-cuda --json. Explicit backend="cuda" use retains lazy preparation. Passive diagnostics and discover_native_capabilities() report only already-prepared backends.

Native artifacts are stored in a private, content-addressed user cache keyed by source, compiler/toolkit identity, build flags, and native GPU identity. The optional geometry cache uses JSON plus non-executable NumPy arrays; legacy pickle cache entries are ignored and rebuilt.

License

GPL-3.0-only. See LICENSE.

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

gdsdiff-0.1.0.tar.gz (304.6 kB view details)

Uploaded Source

Built Distribution

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

gdsdiff-0.1.0-py3-none-any.whl (275.8 kB view details)

Uploaded Python 3

File details

Details for the file gdsdiff-0.1.0.tar.gz.

File metadata

  • Download URL: gdsdiff-0.1.0.tar.gz
  • Upload date:
  • Size: 304.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for gdsdiff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a5f16a241b0e3797d027cdef2b20dd3c61128e27c7dd43e913285957605023e
MD5 620a8766faaa18786f647300efa69c87
BLAKE2b-256 e1e1d3b7b8eef25f41a5758f1f6c5d2988cf10c9649c4efe53a1fe370e66a476

See more details on using hashes here.

Provenance

The following attestation bundles were made for gdsdiff-0.1.0.tar.gz:

Publisher: release.yml on SandboChang/gdsdiff

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

File details

Details for the file gdsdiff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gdsdiff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 275.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for gdsdiff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a561cf759639c515306d24568ff64ca148722bc4b0fa918326b8138e7b16c43
MD5 e50cfcd6619bf06a4869fb1aebb6a758
BLAKE2b-256 1617f5f8ae8b73d008988346096ea83d1f12f9ccee796a54c51beff8e7f51bde

See more details on using hashes here.

Provenance

The following attestation bundles were made for gdsdiff-0.1.0-py3-none-any.whl:

Publisher: release.yml on SandboChang/gdsdiff

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