Below we list common issues and gotchas encountered when using
SuperScreen, along with the recommended solutions.
If you encounter an issue not listed here, or the recommended solution does not work for you, please
open an issue on GitHub.
Device.make_mesh()hangs for a
superscreen.Devicewith transport terminals.
In order to correctly set the boundary conditions for films with transport terminals (see Terminal currents),
SuperScreengenerates a mesh for such films where the boundary vertices of the mesh are exactly the same as the boundary vertices of the associated
superscreen.Polygon. As a result,
Device.make_mesh()can hang if the distance between vertices in the film
superscreen.Polygonis greater than the
Device.make_mesh(). To fix this, simply increase the number of points in the
superscreen.Polygondefining the film. For example, to double the number of points in the polygon, run:
polygon.points = polygon.resample(2 * len(polygon.points))
Poor performance when running
SuperScreenin multiple Python processes.
SuperScreenuses numba to automatically perform some computations in parallel across multiple CPUs. To avoid competition between multiple Python processes running
SuperScreen, you can set the number of threads available to
numbain each process. For example, if your computer has 8 physical CPU cores and you are running
SuperScreenin 2 different Python processes, you should tell
numbato use 8 / 2 = 4 threads in each Python process.
import joblib import numba # Number of Python processes in which you will run SuperScreen number_of_python_processes = 2 # Number of physical CPU cores available physical_cpus = joblib.cpu_count(only_physical_cores=True) # Tell numba how many threads to use in each Python process numba.set_num_threads(int(physical_cpus / number_of_python_processes))
For more details, see Setting the Number of Threads in the
A similar problem can occur when running
SuperScreenon a cluster using a scheduler such as Slurm.
numbasets the default number of threads according to
multiprocessing.cpu_count(), which does not know about the number of CPUs requested from the scheduler. On the other hand
joblib.cpu_count()does know about the number of CPUs allocated by the scheduler. Therefore, when running
SuperScreenon such a cluster you should always run
import joblib import numba numba.set_num_threads(joblib.cpu_count(only_physical_cores=True))
or set the environment variable
NUMBA_NUM_THREADSprior to importing