Getting Started with Meent

Getting Started with Meent#

Welcome to Meent!

Meent uses RCWA for Electromagnetic (EM) simulation and automatic-differentiation for back-propagation.

Installation#

Meent can be installed via pip.

pip install meent

How to use#

Use call_mee() with backend option, to make meent instance containing the functionalities.

import meent

# backend 0 = NumPy
# backend 1 = JAX
# backend 2 = PyTorch

backend = 1
mee = meent.call_mee(backend=backend, ...)

All the methods in mee are same across backends.

Tutorials#

Tutorials will help you go through the key features.

Backends#

Meent provides three libraries as a backend:

_images/backends.png
  • NumPy numpy/numpy

    • The fundamental package for scientific computing with Python

    • Easy and lean to use

  • JAX google/jax

    • Autograd and XLA, brought together for high-performance machine learning research.

  • PyTorch pytorch/pytorch

    • A Python package that provides two high-level features: Tensor computation with strong GPU acceleration and Deep neural networks built on a tape-based autograd system

When to use#

Backend features#

NumPy

JAX

PyTorch

Description

64bit

O

O

O

Default for scientific computing

32bit

O

O

O

32bit data type operation [*]

GPU

X

O

O

except Eigendecomposition []

TPU

X

X

X

Not supported []

AD

X

O

O

Automatic Differentiation (Back Propagation)

pmap

X

O

X

Parallelization function in JAX

Numpy is simple and light to use. Suggested as a baseline with small ~ medium scale optics problem. JAX and PyTorch is recommended for cases having large scale or optimization part. If you want parallelized computing with multiple devices(e.g., GPUs), JAX is ready for that. But since JAX does jit compilation, it takes much time at the first run.