Created
March 6, 2025 07:35
-
-
Save zonca/7b33648c21235f833aa3315099b65146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
start_time = time.time() | |
import pickle | |
with open("sim_objects_inputs.pkl", "rb") as f: | |
data = pickle.load(f) | |
from pixell import ( | |
pointsrcs, | |
) | |
shape = data["shape"] | |
wcs = data["wcs"] | |
pointing = data["poss"] | |
amps = data["amps"] | |
r, p = data["profile"] | |
output_map = pointsrcs.sim_objects( | |
shape=shape, | |
wcs=wcs, | |
poss=pointing, | |
amps=amps, | |
profile=(r, p), | |
) | |
end_time = time.time() | |
print(f"sim_objects took {end_time - start_time:.1f} seconds") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in {1..10}; do | |
/usr/bin/time -v timeout --kill-after=10s 5m python debug_sim_objects.py 2>&1 | \ | |
grep -E "Maximum resident set size|Elapsed" | \ | |
awk ' | |
/Maximum/ { | |
printf "Memory usage (GB): %.2f\n", $6/1048576 # Convert KB to GB | |
} | |
/Elapsed/ { | |
# Parse time components | |
split($NF, parts, ":") | |
if (length(parts) == 3) { # h:mm:ss format | |
mins = parts[1] * 60 + parts[2] | |
secs = parts[3] | |
} | |
else if (length(parts) == 2) { # m:ss format | |
mins = parts[1] | |
secs = parts[2] | |
} | |
else { # seconds format | |
mins = 0 | |
secs = $NF | |
} | |
printf "Elapsed time: %dm %.2fs\n", mins, secs | |
}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment