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

Speed up mandelbrot #742

Merged
merged 9 commits into from
Sep 12, 2023
Merged

Speed up mandelbrot #742

merged 9 commits into from
Sep 12, 2023

Conversation

jackos
Copy link
Collaborator

@jackos jackos commented Sep 12, 2023

Addresses the improvements @zbosons pointed out.

Changed to using an isolated machine with 8-core CPU, for 960x960 image with 200 max_iters results in:

Pre change

Vectorized: 20.33 ms
Parallelized: 2.76 ms
Parallel speedup: 7.4

After change

Vectorized: 13.54 ms
Parallelized: 1.41 ms
Parallel speedup: 9.59

@zbosons
Copy link
Contributor

zbosons commented Sep 12, 2023 via email

@zbosons
Copy link
Contributor

zbosons commented Sep 12, 2023

We can calculate the best possible time. I guess this system has 16 physical cores

time = 40120461 * (8.5) /frequency/16/16.

I don't know what the frequency is on this system but lets assume its about 3 GHz. Then the best time is about 0.4 ms. And the best time was 0.96 s. So about 42% of best possible.

We should test with larger sizes. We could increase max_iter to e.g. 1000. I usually try and get something to run for about a second. In this case it runs for less than 1 ms and I am afraid the overhead is large. When I benchmarked I used 4000x4000 and 1000 max iterations.

I think @abduld did not want to do increase the run time default on the server. But 5 * num_cores() still seems too arbitrary to me.

Copy link
Contributor

@zbosons zbosons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out the new version is faster on the current system. Can you please report the numbers with the old code and the new code to show the improvement on the current system.

@jackos jackos changed the title Jackos/speedup mandelbrot Speedup mandelbrot Sep 12, 2023
@jackos jackos changed the title Speedup mandelbrot Speed up mandelbrot Sep 12, 2023
@jackos jackos merged commit 6ecab31 into main Sep 12, 2023
@jackos jackos deleted the jackos/speedup-mandelbrot branch October 10, 2023 20:15
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.

2 participants