dolfinx.common
General tools for timing and configuration.
Functions
|
Decorator for timing functions. |
Classes
|
|
|
A timer can be used for timing tasks. The basic usage is::. |
- class dolfinx.common.IndexMap(self, comm: MPICommWrapper, local_size: int)
- class dolfinx.common.IndexMap(self, comm: MPICommWrapper, local_size: int, ghosts: ndarray[dtype=int64, shape=(*), order='C', writable=False], ghost_owners: ndarray[dtype=int32, shape=(*), order='C', writable=False])
- class dolfinx.common.IndexMap(self, comm: MPICommWrapper, local_size: int, dest_src: collections.abc.Sequence[ndarray[dtype=int32, shape=(*), order='C', writable=False]], ghosts: ndarray[dtype=int64, shape=(*), order='C', writable=False], ghost_owners: ndarray[dtype=int32, shape=(*), order='C', writable=False])
Bases:
object
- property comm
(self) -> MPICommWrapper
- property ghosts
Return list of ghost indices
- global_to_local
- imbalance
Imbalance of the current IndexMap.
- index_to_dest_ranks
- property local_range
Range of indices owned by this map
- local_to_global
- property num_ghosts
(self) -> int
- property owners
(self) -> numpy.ndarray[dtype=int32, shape=(*), writable=False]
- property size_global
(self) -> int
- property size_local
(self) -> int
- class dolfinx.common.Timer(name: str | None = None)[source]
Bases:
object
A timer can be used for timing tasks. The basic usage is:
with Timer("Some costly operation"): costly_call_1() costly_call_2()
or:
with Timer() as t: costly_call_1() costly_call_2() print("Elapsed time so far: %s" % t.elapsed()[0])
The timer is started when entering context manager and timing ends when exiting it. It is also possible to start and stop a timer explicitly by:
t = Timer("Some costly operation") t.start() costly_call() t.stop()
and retrieve timing data using:
t.elapsed()
Timings are stored globally (if task name is given) and may be printed using functions
timing
,timings
,list_timings
,dump_timings_to_xml
, e.g.:list_timings(comm, [TimingType.wall, TimingType.user])