Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multithread keogram #664

Merged
merged 8 commits into from
Oct 16, 2021
Merged

Multithread keogram #664

merged 8 commits into from
Oct 16, 2021

Conversation

ckuethe
Copy link
Collaborator

@ckuethe ckuethe commented Oct 16, 2021

Apply similar logic to keogram as was done for startrails (#628 and #649)

Inspired by @sebmueller. This splits up the input images into batches of work
more or less evenly divided across the number of processors.

Two new flags are added:
* -n / --nice to make the workers be nice. default = 10
* -m / --max-threads to control the number of worker threads. default = ncpus

Allows me to process a night of startrails on my workstation in under 3.5s.
On my pi3b+, it'll use between 350% - 395% CPU without making it feel slow

```
root@skycam:/home/allsky/src# time ./startrails -b 0.255 -d ../images/20210912/ -e jpg -o /tmp/junk.jpg -s 1280x960
Minimum: 0.0265446 maximum: 0.804403 mean: 0.143959 median: 0.137787

real	5m5.951s
user	11m22.243s
sys	1m5.347s

root@skycam:/home/allsky/src# time ./startrails -b 0.255 -d ../images/20210912/ -e jpg -o /tmp/junk2.jpg -s 1280x960 --max-threads 1
Minimum: 0.0265446 maximum: 0.804403 mean: 0.143959 median: 0.137787

real	12m8.758s
user	11m3.073s
sys	0m54.200s

```

Fixes #628
Inspired by @sebmueller. This splits up the input images into batches of work
more or less evenly divided across the number of processors.

Two new flags are added (-m and -n were already used):
* -q / --level to make the workers be nice. default = 10
* -Q / --max-threads to control the number of worker threads. default = ncpus

Generates a keogram on my laptop in under 3.5s, even after doing horrible string
manipulations to compute time of exposure for label generation. Tested on rpi3b
too.
now both of these tools use -Q / --max-threads to control the number of worker
threads, and -q / --nice-level to set the scheduler priority.

Q is vaguely mnemonic for queue (job scheduling) and it's not likely that you
will want to change the settings without a good reason. Use as much CPU as
possible, without dragging the whole system down, right?
@EricClaeys EricClaeys merged commit 1a42539 into AllskyTeam:master Oct 16, 2021
@ckuethe ckuethe deleted the multithread_keogram branch October 16, 2021 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants