Using the TracerMP Class

Using the TracerMP Class#

The TracerMP class is a multi-processing, thread-safe variant of the Tracer class. It enables users to create multiple (distinct) instances of the mapflpy_fortran object in separate processes, allowing for concurrent tracing operations across multiple threads. the TracerMP branches new instances of the mapflpy_fortran object into discrete processes and communicates with these instances through python’s Pipe() protocol.

The Pipe() protocol requires that the multiprocessing.connection.Connection is properly opened and closed to avoid resource leaks. Therefore, it is recommended to use the TracerMP class within a context manager (the with statement) to ensure that resources are properly managed (or, alternatively, one can explicitly open and close the connection using the connect() and disconnect() methods).

Using TracerMP Defaults

Using TracerMP Defaults

Multiple TracerMP Instances

Multiple TracerMP Instances

Setting the Magnetic Field

Setting the Magnetic Field