Skip to content
Snippets Groups Projects
Commit 03f4462b authored by Jan David Mol's avatar Jan David Mol
Browse files

Use locks to speed up numpy by preventing thrashing

parent 3185592e
No related branches found
No related tags found
1 merge request!921Use locks to speed up numpy by preventing thrashing
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import datetime import datetime
from functools import lru_cache from functools import lru_cache
import threading
from typing import TypedDict from typing import TypedDict
import casacore.measures import casacore.measures
...@@ -28,6 +29,9 @@ The measures ...@@ -28,6 +29,9 @@ The measures
# Where to store the measures table sets # Where to store the measures table sets
IERS_ROOTDIR = "/opt/IERS" IERS_ROOTDIR = "/opt/IERS"
# Compute lock to prevent thrashing when multithreading
compute_lock = threading.Lock()
def get_IERS_timestamp() -> datetime.datetime: def get_IERS_timestamp() -> datetime.datetime:
"""Return the date of the currently installed IERS tables.""" """Return the date of the currently installed IERS tables."""
...@@ -200,6 +204,7 @@ class Delays: ...@@ -200,6 +204,7 @@ class Delays:
Returns delays[antenna][direction].""" Returns delays[antenna][direction]."""
with compute_lock:
# obtain the direction vector for each pointing # obtain the direction vector for each pointing
direction_vectors = self.get_direction_vector_bulk(pointings) direction_vectors = self.get_direction_vector_bulk(pointings)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment