This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How and where to use parameters['num_threads']?

+2 votes

An example of how to use the num_threads speed up would be nice. Does it work if running on 1 process?

asked Nov 7, 2013 by chaffra FEniCS User (1,830 points)

1 Answer

+4 votes

num_threads sets the threads during multi threaded assemble. For dense problems it can speed up the assemble considerably. It sure works for one process, but the speedup is probably not that big. For 1 CPU with several cores you can get nice speedup up to the number of cores.

Note however that the method used to facilitate the multithreaded assemble (mesh coloring) slows the assemble down as it is very cache unfriendly. So first a slowdown and then a speedup :) Also note that multithreaded assemble does not work with MPI and for forms using the Real function spaces.

answered Nov 8, 2013 by johanhake FEniCS Expert (22,480 points)
...