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

Add parallelism to cpu miner #983

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

Fi3
Copy link
Collaborator

@Fi3 Fi3 commented Jun 19, 2024

Make the cpu miner multithread as requested by @Sjors

@Fi3 Fi3 requested a review from Sjors June 19, 2024 13:17
Copy link
Contributor

github-actions bot commented Jun 19, 2024

🐰Bencher

ReportMon, July 22, 2024 at 14:14:17 UTC
ProjectStratum v2 (SRI)
BranchAddParallelismToCpuMiner
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.49 (-0.14%)45.24 (98.36%)
client_sv2_handle_message_mining✅ (view plot)74.94 (+2.84%)80.34 (93.28%)
client_sv2_mining_message_submit_standard✅ (view plot)14.64 (-0.06%)14.69 (99.67%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)260.24 (-1.57%)283.97 (91.64%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)589.82 (-0.73%)627.41 (94.01%)
client_sv2_open_channel✅ (view plot)166.39 (+0.28%)173.39 (95.96%)
client_sv2_open_channel_serialize✅ (view plot)272.12 (-3.77%)293.56 (92.70%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)376.05 (-0.61%)423.46 (88.80%)
client_sv2_setup_connection✅ (view plot)163.64 (-0.27%)174.76 (93.64%)
client_sv2_setup_connection_serialize✅ (view plot)437.64 (-7.64%)507.53 (86.23%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)959.88 (-1.10%)1,038.19 (92.46%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 19, 2024

🐰Bencher

ReportMon, July 22, 2024 at 14:14:19 UTC
ProjectStratum v2 (SRI)
BranchAddParallelismToCpuMiner
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
serialize_deserialize_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)299.00 (+1.38%)298.03 (100.33%)
serialize_deserialize_handle_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)369.00 (+1.38%)367.55 (100.39%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Upper Boundary
accesses | (%)
get_authorize✅ (view plot)8,538.00 (+1.20%)8,724.96 (97.86%)✅ (view plot)3,746.00 (+0.15%)3,854.74 (97.18%)✅ (view plot)5,248.00 (+0.06%)5,400.71 (97.17%)✅ (view plot)7.00 (-11.71%)10.37 (67.47%)✅ (view plot)93.00 (+3.25%)94.08 (98.85%)
get_submit✅ (view plot)95,509.00 (-0.05%)96,137.14 (99.35%)✅ (view plot)59,439.00 (-0.05%)59,776.31 (99.44%)✅ (view plot)85,359.00 (-0.05%)85,833.33 (99.45%)✅ (view plot)49.00 (-10.88%)62.64 (78.22%)✅ (view plot)283.00 (+0.32%)287.67 (98.38%)
get_subscribe✅ (view plot)7,991.00 (+0.18%)8,268.55 (96.64%)✅ (view plot)2,841.00 (+0.39%)2,939.32 (96.65%)✅ (view plot)3,971.00 (+0.43%)4,099.07 (96.88%)✅ (view plot)13.00 (-19.20%)19.97 (65.10%)✅ (view plot)113.00 (+0.33%)116.92 (96.65%)
serialize_authorize✅ (view plot)12,291.00 (+0.69%)12,502.68 (98.31%)✅ (view plot)5,317.00 (+0.10%)5,425.74 (98.00%)✅ (view plot)7,411.00 (+0.05%)7,564.06 (97.98%)✅ (view plot)10.00 (-7.28%)13.35 (74.89%)✅ (view plot)138.00 (+1.78%)140.26 (98.39%)
serialize_deserialize_authorize✅ (view plot)24,588.00 (+0.48%)24,710.26 (99.51%)✅ (view plot)9,898.00 (-0.02%)10,025.45 (98.73%)✅ (view plot)13,958.00 (-0.06%)14,149.90 (98.64%)✅ (view plot)33.00 (-9.63%)41.61 (79.31%)🚨 (view plot | view alert)299.00 (+1.38%)298.03 (100.33%)
serialize_deserialize_handle_authorize✅ (view plot)30,327.00 (+0.59%)30,352.68 (99.92%)✅ (view plot)12,101.00 (+0.05%)12,209.74 (99.11%)✅ (view plot)17,117.00 (-0.00%)17,279.06 (99.06%)✅ (view plot)59.00 (+0.40%)64.64 (91.28%)🚨 (view plot | view alert)369.00 (+1.38%)367.55 (100.39%)
serialize_deserialize_handle_submit✅ (view plot)126,372.00 (-0.03%)127,027.20 (99.48%)✅ (view plot)73,224.00 (-0.04%)73,617.68 (99.47%)✅ (view plot)104,947.00 (-0.04%)105,508.32 (99.47%)✅ (view plot)120.00 (-0.40%)131.19 (91.47%)✅ (view plot)595.00 (+0.02%)599.20 (99.30%)
serialize_deserialize_handle_subscribe✅ (view plot)27,491.00 (+0.13%)27,601.37 (99.60%)✅ (view plot)9,643.00 (+0.11%)9,741.32 (98.99%)✅ (view plot)13,641.00 (+0.13%)13,774.92 (99.03%)✅ (view plot)61.00 (-7.30%)73.78 (82.68%)✅ (view plot)387.00 (+0.31%)388.57 (99.60%)
serialize_deserialize_submit✅ (view plot)114,999.00 (-0.07%)115,648.77 (99.44%)✅ (view plot)68,001.00 (-0.08%)68,400.22 (99.42%)✅ (view plot)97,559.00 (-0.09%)98,146.91 (99.40%)✅ (view plot)65.00 (-6.26%)75.35 (86.27%)✅ (view plot)489.00 (+0.18%)492.37 (99.32%)
serialize_deserialize_subscribe✅ (view plot)22,922.00 (+0.21%)23,110.37 (99.18%)✅ (view plot)8,195.00 (+0.11%)8,297.00 (98.77%)✅ (view plot)11,542.00 (+0.11%)11,682.18 (98.80%)✅ (view plot)36.00 (-8.45%)44.13 (81.58%)✅ (view plot)320.00 (+0.46%)321.51 (99.53%)
serialize_submit✅ (view plot)99,826.00 (-0.07%)100,465.40 (99.36%)✅ (view plot)61,483.00 (-0.05%)61,825.66 (99.45%)✅ (view plot)88,206.00 (-0.05%)88,686.82 (99.46%)✅ (view plot)49.00 (-11.83%)62.44 (78.47%)✅ (view plot)325.00 (+0.10%)329.16 (98.74%)
serialize_subscribe✅ (view plot)11,328.00 (+0.02%)11,604.51 (97.62%)✅ (view plot)4,188.00 (+0.26%)4,286.32 (97.71%)✅ (view plot)5,828.00 (+0.27%)5,958.26 (97.81%)✅ (view plot)15.00 (-8.00%)19.06 (78.72%)✅ (view plot)155.00 (-0.13%)159.74 (97.03%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 19, 2024

🐰Bencher

ReportMon, July 22, 2024 at 14:13:53 UTC
ProjectStratum v2 (SRI)
Branch983/merge
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,523.20 (-5.71%)7,355.65 (88.68%)
client-submit-serialize-deserialize✅ (view plot)7,470.70 (-4.69%)8,331.65 (89.67%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,020.40 (-4.59%)8,845.63 (90.67%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)892.48 (-0.63%)926.10 (96.37%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)692.25 (-0.63%)717.48 (96.48%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)245.01 (-1.21%)255.07 (96.06%)
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)157.10 (-0.04%)162.38 (96.75%)
client-sv1-get-submit✅ (view plot)6,335.40 (-5.18%)7,150.18 (88.60%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)276.65 (-0.66%)290.99 (95.07%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)761.60 (+1.86%)777.08 (98.01%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)613.31 (-0.22%)638.11 (96.11%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)201.76 (-2.31%)219.77 (91.80%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 19, 2024

🐰Bencher

ReportMon, July 22, 2024 at 14:14:31 UTC
ProjectStratum v2 (SRI)
BranchAddParallelismToCpuMiner
Testbedsv2

🚨 10 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_mining_message_submit_standardL2 Accesses (accesses)🚨 (view plot | view alert)26.00 (+46.52%)23.55 (110.40%)
client_sv2_mining_message_submit_standard_serializeL2 Accesses (accesses)🚨 (view plot | view alert)55.00 (+15.72%)53.06 (103.66%)
client_sv2_mining_message_submit_standard_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)10,585.00 (+0.39%)10,570.15 (100.14%)
client_sv2_mining_message_submit_standard_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)15,399.00 (+0.37%)15,378.20 (100.14%)
client_sv2_open_channel_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)8,027.00 (+0.52%)8,012.52 (100.18%)
client_sv2_open_channel_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)11,671.00 (+0.47%)11,652.63 (100.16%)
client_sv2_open_channel_serialize_deserializeL2 Accesses (accesses)🚨 (view plot | view alert)84.00 (+14.05%)82.95 (101.27%)
client_sv2_setup_connectionL2 Accesses (accesses)🚨 (view plot | view alert)15.00 (+61.76%)14.20 (105.67%)
client_sv2_setup_connection_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)14,855.00 (+0.29%)14,839.94 (100.10%)
client_sv2_setup_connection_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)21,810.00 (+0.26%)21,789.75 (100.09%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Upper Boundary
accesses | (%)
client_sv2_handle_message_common✅ (view plot)2,111.00 (+2.93%)2,129.60 (99.13%)✅ (view plot)473.00 (+0.49%)486.23 (97.28%)✅ (view plot)731.00 (-0.15%)754.95 (96.83%)✅ (view plot)10.00 (+41.39%)11.08 (90.23%)✅ (view plot)38.00 (+3.62%)38.60 (98.45%)
client_sv2_handle_message_mining✅ (view plot)8,219.00 (+0.26%)8,335.84 (98.60%)✅ (view plot)2,137.00 (+0.45%)2,171.21 (98.42%)✅ (view plot)3,159.00 (+0.45%)3,215.82 (98.23%)✅ (view plot)39.00 (+1.18%)43.57 (89.51%)✅ (view plot)139.00 (+0.10%)141.95 (97.92%)
client_sv2_mining_message_submit_standard✅ (view plot)6,316.00 (+0.64%)6,388.43 (98.87%)✅ (view plot)1,750.00 (+0.03%)1,763.03 (99.26%)✅ (view plot)2,546.00 (-0.30%)2,575.66 (98.85%)🚨 (view plot | view alert)26.00 (+46.52%)23.55 (110.40%)✅ (view plot)104.00 (+0.18%)106.88 (97.31%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,691.00 (-0.54%)15,031.37 (97.74%)✅ (view plot)4,694.00 (+0.01%)4,707.03 (99.72%)✅ (view plot)6,751.00 (-0.05%)6,775.02 (99.65%)🚨 (view plot | view alert)55.00 (+15.72%)53.06 (103.66%)✅ (view plot)219.00 (-1.47%)229.92 (95.25%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,499.00 (+0.08%)27,840.84 (98.77%)🚨 (view plot | view alert)10,585.00 (+0.39%)10,570.15 (100.14%)🚨 (view plot | view alert)15,399.00 (+0.37%)15,378.20 (100.14%)✅ (view plot)89.00 (+6.09%)89.77 (99.14%)✅ (view plot)333.00 (-0.52%)345.18 (96.47%)
client_sv2_open_channel✅ (view plot)4,451.00 (-0.87%)4,610.22 (96.55%)✅ (view plot)1,461.00 (+0.06%)1,474.29 (99.10%)✅ (view plot)2,156.00 (+0.15%)2,172.86 (99.22%)✅ (view plot)11.00 (-7.77%)15.21 (72.33%)✅ (view plot)64.00 (-1.65%)68.15 (93.91%)
client_sv2_open_channel_serialize✅ (view plot)14,040.00 (-1.20%)14,463.81 (97.07%)✅ (view plot)5,064.00 (+0.02%)5,077.29 (99.74%)✅ (view plot)7,320.00 (+0.03%)7,339.10 (99.74%)✅ (view plot)42.00 (+12.14%)42.58 (98.65%)✅ (view plot)186.00 (-2.91%)199.03 (93.45%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,591.00 (-0.21%)23,019.38 (98.14%)🚨 (view plot | view alert)8,027.00 (+0.52%)8,012.52 (100.18%)🚨 (view plot | view alert)11,671.00 (+0.47%)11,652.63 (100.16%)🚨 (view plot | view alert)84.00 (+14.05%)82.95 (101.27%)✅ (view plot)300.00 (-1.44%)314.91 (95.26%)
client_sv2_setup_connection✅ (view plot)4,693.00 (-0.09%)4,764.54 (98.50%)✅ (view plot)1,502.00 (+0.06%)1,515.29 (99.12%)✅ (view plot)2,273.00 (-0.16%)2,299.42 (98.85%)🚨 (view plot | view alert)15.00 (+61.76%)14.20 (105.67%)✅ (view plot)67.00 (-1.23%)69.67 (96.17%)
client_sv2_setup_connection_serialize✅ (view plot)15,976.00 (-1.71%)16,509.70 (96.77%)✅ (view plot)5,963.00 (+0.01%)5,976.29 (99.78%)✅ (view plot)8,661.00 (+0.07%)8,677.67 (99.81%)✅ (view plot)49.00 (+9.46%)49.32 (99.35%)✅ (view plot)202.00 (-4.13%)218.16 (92.59%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,450.00 (-0.23%)35,745.96 (99.17%)🚨 (view plot | view alert)14,855.00 (+0.29%)14,839.94 (100.10%)🚨 (view plot | view alert)21,810.00 (+0.26%)21,789.75 (100.09%)✅ (view plot)110.00 (+10.04%)113.43 (96.98%)✅ (view plot)374.00 (-1.41%)384.89 (97.17%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

@jbesraa jbesraa left a comment

Choose a reason for hiding this comment

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

Looks good, added a few small comments

roles/test-utils/mining-device/Cargo.toml Outdated Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Outdated Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Outdated Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Show resolved Hide resolved
@Sjors
Copy link
Collaborator

Sjors commented Jun 20, 2024

All your coins, are belong to us! Will try later.

Copy link
Contributor

@Shourya742 Shourya742 left a comment

Choose a reason for hiding this comment

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

Concept ACK.
nit:

help = "This value is used to slow down the cpu miner, it rapresents the number of micro-seconds that are awaited between hashes",
. rapresents -> represents

roles/test-utils/mining-device/src/main.rs Outdated Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Outdated Show resolved Hide resolved
roles/test-utils/mining-device/src/main.rs Outdated Show resolved Hide resolved
@Sjors
Copy link
Collaborator

Sjors commented Jun 25, 2024

While you're at it, can you add a README file to roles/test-utils/mining-device?

Mined a block! https://mempool.space/testnet4/block/00000000f6b1355bcf0077bce98b21566728ad10bd7e0856dbc38e0bb2c9f74a

@Fi3 Fi3 force-pushed the AddParallelismToCpuMiner branch from 3f2a191 to 7c3c45d Compare July 1, 2024 10:05
@Fi3
Copy link
Collaborator Author

Fi3 commented Jul 1, 2024

@GitGab19 there are issues with benches no way that this PR impact the performance of the SRI libraries

@GitGab19
Copy link
Collaborator

GitGab19 commented Jul 1, 2024

@GitGab19 there are issues with benches no way that this PR impact the performance of the SRI libraries

Yeah I definitely need to figure out what's going on there. I will try to fix it by eof

@GitGab19 GitGab19 merged commit 04f6df8 into stratum-mining:dev Jul 22, 2024
30 of 31 checks passed
@Sjors
Copy link
Collaborator

Sjors commented Jul 22, 2024

🎉

@pavlenex pavlenex mentioned this pull request Jul 25, 2024
@plebhash plebhash mentioned this pull request Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done ✅
Development

Successfully merging this pull request may close these issues.

8 participants