Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instructions for specifying floating-point precision of fields/materials arrays #1563

Merged
merged 2 commits into from
May 5, 2021

Conversation

oskooi
Copy link
Collaborator

@oskooi oskooi commented May 4, 2021

Following #1544, adds a new section "Floating-Point Precision of the Fields and Materials Arrays" to the Build From Source page of the user manual.

Also includes a couple of minor fixes in other (unrelated) parts of the user manual.

@@ -244,6 +244,31 @@ By default, Meep's configure script tries to guess the gcc `-march` flag for the
This flag enables some experimental support for [OpenMP](https://en.wikipedia.org/wiki/OpenMP) multithreading parallelism on multi-core machines (*instead* of MPI, or in addition to MPI if you have multiple processor cores per MPI process). Currently, only multi-frequency [`near2far`](Python_User_Interface.md#near-to-far-field-spectra) calculations are sped up this way, but in the future this [may be expanded](https://github.com/NanoComp/meep/issues/228) with additional OpenMP parallelism. When you run Meep, you can first set the `OMP_NUM_THREADS` environment variable to the number of threads you want OpenMP to use.

### Floating-Point Precision of the Fields and Materials Arrays

By default, the time-domain fields ($\mathbf{E}$, $\mathbf{D}$, $\mathbf{H}$) and materials ($\varepsilon$) arrays used in Meep are defined using [double-precision floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format). Updating the fields arrays generally dominates the cost of the simulation because it occurs at every voxel in the computational cell and at every timestep. Because discretization error from the discontinuous material interfaces (as described in [Subpixel Smoothing](Subpixel_Smoothing.md)) typically dominates the [floating-point roundoff error](https://en.wikipedia.org/wiki/Round-off_error), the fields/materials arrays can be defined using [single-precision floating point](https://en.wikipedia.org/wiki/Single-precision_floating-point_format) to provide a significant speedup (by reducing the [memory bandwidth](https://en.wikipedia.org/wiki/Memory_bandwidth)) often without *any loss* in simulation accuracy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even without material interfaces, discretization error should dominate over the floating-point roundoff error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the wording in this line to make this point clearer.

@stevengj stevengj merged commit f2bae0c into NanoComp:master May 5, 2021
@oskooi oskooi deleted the docs_float_precision branch May 5, 2021 03:37
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
…als arrays (NanoComp#1563)

* instructions for specifying floating-point precision of fields/materials arrays

* clarify that discretization errors in general dominate roundoff error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants