Skip to content

Multithreading attempt - #26

Open
lkdvos wants to merge 13 commits into
nicolasloizeau:mainfrom
lkdvos:multithreading
Open

Multithreading attempt#26
lkdvos wants to merge 13 commits into
nicolasloizeau:mainfrom
lkdvos:multithreading

Conversation

@lkdvos

@lkdvos lkdvos commented Mar 26, 2025

Copy link
Copy Markdown
Collaborator

This is me playing around a bit with trying to multithread the commutator.
While it does gain a little bit over the optimized version of #25, the results aren't that impressive:

With 8 threads on my machine:

|                            | 9f209c0dbabaa5... | dirty           | 9f209c0dbabaa5.../dirty |
|:---------------------------|:-----------------:|:---------------:|:-----------------------:|
| lanczos (N=50)/nterms=2^14 | 0.473 ± 0.019 s   | 0.583 ± 0.019 s | 0.81                    |
| lanczos (N=50)/nterms=2^16 | 1.4 ± 0.041 s     | 1.33 ± 0.017 s  | 1.05                    |
| lanczos (N=50)/nterms=2^18 | 4.32 ± 0.012 s    | 2.83 ± 0.022 s  | 1.53                    |
| lanczos (N=50)/nterms=2^20 | 10.6 s            | 5.84 s          | 1.82                    |
| time_to_load               | 0.303 ± 0.013 s   | 0.31 ± 0.011 s  | 0.979                   |

With 16 threads on my machine:

|                            | 9f209c0dbabaa5... | dirty           | 9f209c0dbabaa5.../dirty |
|:---------------------------|:-----------------:|:---------------:|:-----------------------:|
| lanczos (N=50)/nterms=2^14 | 0.453 ± 0.0082 s  | 0.565 ± 0.039 s | 0.801                   |
| lanczos (N=50)/nterms=2^16 | 1.38 ± 0.044 s    | 1.17 ± 0.027 s  | 1.18                    |
| lanczos (N=50)/nterms=2^18 | 4.37 ± 0.037 s    | 2.74 ± 0.024 s  | 1.6                     |
| lanczos (N=50)/nterms=2^20 | 10.5 s            | 5.52 s          | 1.89                    |
| time_to_load               | 0.293 ± 0.015 s   | 0.299 ± 0.013 s | 0.981                   |

From this I'd say that this approach does work, and seems to become more effective at larger nterms, but the actual maximal speed is bound by the dictionary insertions anyways, and it's hard to avoid the final merge dominating the cost.

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.

1 participant