Body: <p>I'm implementing multi-thread in my engine but I think I'm not getting the expected performance boost. Below are the results from the initial position to depth 10. The single thread version takes  5288ms to finish and the multi-thread takes 3494ms. Are the results ok or should I expect more performance?</p>
  <pre><code>info depth 1 score cp 42 nodes 23  time 2 pv b1c3 
  info depth 2 score cp 0 nodes 62  time 7 pv b1c3 b8c6 
  info depth 3 score cp 42 nodes 526  time 55 pv b1c3 b8c6 g1f3 
  info depth 4 score cp 0 nodes 1314  time 36 pv b1c3 b8c6 g1f3 g8f6 
  info depth 5 score cp 31 nodes 11130  time 45 pv b1c3 b8c6 g1f3 g8f6 d2d4 
  info depth 6 score cp 0 nodes 11809  time 48 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 
  info depth 7 score cp 20 nodes 97064  time 394 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 e2e3 
  info depth 8 score cp 0 nodes 68896  time 452 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 e2e3 e7e6 
  info depth 9 score cp 22 nodes 1586729  time 1955 pv e2e4 e7e6 d2d4 b8c6 b1c3 g8e7 g1f3 d7d5 f1d3 
  info depth 10 score cp 2 nodes 2443347  time 2182 pv e2e4 e7e5 g1f3 b8c6 b1c3 f8c5 c3a4 c5d6 d2d4 g8f6 
  5288
  bestmove e2e4
  </code></pre>
  <p><strong>Multi Threads enabled</strong></p>
  <pre><code>info depth 1 score cp 31 nodes 20  time 34 pv e2e4 
  info depth 2 score cp -11 nodes 61  time 94 pv e2e4 b8c6 
  info depth 3 score cp 31 nodes 198  time 68 pv e2e4 b8c6 b1c3 
  info depth 4 score cp -11 nodes 830  time 58 pv e2e4 b8c6 b1c3 g8f6 
  info depth 5 score cp 31 nodes 9646  time 75 pv d2d4 g8f6 b1c3 b8c6 g1f3 
  info depth 6 score cp 0 nodes 12662  time 67 pv d2d4 g8f6 b1c3 b8c6 g1f3 d7d5 
  info depth 7 score cp 20 nodes 68563  time 153 pv d2d4 g8f6 b1c3 b8c6 g1f3 d7d5 e2e3 
  info depth 8 score cp 0 nodes 89146  time 270 pv d2d4 g8f6 b1c3 d7d5 g1f3 b8c6 e2e3 e7e6 
  info depth 9 score cp 22 nodes 732191  time 1514 pv e2e4 b8c6 d2d4 e7e6 g1f3 g8e7 b1c3 d7d5 f1d3 
  info depth 10 score cp 11 nodes 938355  time 1043 pv e2e4 b8c6 d2d4 e7e6 g1f3 g8f6 b1c3 d7d5 c1g5 f8b4 
  3494
  bestmove e2e4
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-19T13:32:47.600Z
Comments.Text: For multi-threading to work properly, each CPU must always have something to do.  How do you ensure that?
Comments.UserDisplayName: Thorbjørn Ravn Andersen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-26T13:22:04.027Z
Comments.Text: I'm more concerned about the fact that your NPS tanked,  Can you give more details about your architecture?
Comments.UserDisplayName: Jeff Wilson
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-09-01T08:00:45.310Z
Comments.Text: I think the community needs more details (computer specifications, programming language, etc.) in order to be able to answer your question.
Comments.UserDisplayName: Glorfindel
Tags: <engines><programming>
Title: Multi-thread performance
ThreadText: # Multi-thread performance
  
  (Asked by: username_0 on 2020-06-19)
  
  I'm implementing multi-thread in my engine but I think I'm not getting the expected performance boost. Below are the results from the initial position to depth 10. The single thread version takes 5288ms to finish and the multi-thread takes 3494ms. Are the results ok or should I expect more performance?
  
  ```
  info depth 1 score cp 42 nodes 23  time 2 pv b1c3 
  info depth 2 score cp 0 nodes 62  time 7 pv b1c3 b8c6 
  info depth 3 score cp 42 nodes 526  time 55 pv b1c3 b8c6 g1f3 
  info depth 4 score cp 0 nodes 1314  time 36 pv b1c3 b8c6 g1f3 g8f6 
  info depth 5 score cp 31 nodes 11130  time 45 pv b1c3 b8c6 g1f3 g8f6 d2d4 
  info depth 6 score cp 0 nodes 11809  time 48 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 
  info depth 7 score cp 20 nodes 97064  time 394 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 e2e3 
  info depth 8 score cp 0 nodes 68896  time 452 pv b1c3 b8c6 g1f3 g8f6 d2d4 d7d5 e2e3 e7e6 
  info depth 9 score cp 22 nodes 1586729  time 1955 pv e2e4 e7e6 d2d4 b8c6 b1c3 g8e7 g1f3 d7d5 f1d3 
  info depth 10 score cp 2 nodes 2443347  time 2182 pv e2e4 e7e5 g1f3 b8c6 b1c3 f8c5 c3a4 c5d6 d2d4 g8f6 
  5288
  bestmove e2e4
  
  ```
  
  **Multi Threads enabled**
  
  ```
  info depth 1 score cp 31 nodes 20  time 34 pv e2e4 
  info depth 2 score cp -11 nodes 61  time 94 pv e2e4 b8c6 
  info depth 3 score cp 31 nodes 198  time 68 pv e2e4 b8c6 b1c3 
  info depth 4 score cp -11 nodes 830  time 58 pv e2e4 b8c6 b1c3 g8f6 
  info depth 5 score cp 31 nodes 9646  time 75 pv d2d4 g8f6 b1c3 b8c6 g1f3 
  info depth 6 score cp 0 nodes 12662  time 67 pv d2d4 g8f6 b1c3 b8c6 g1f3 d7d5 
  info depth 7 score cp 20 nodes 68563  time 153 pv d2d4 g8f6 b1c3 b8c6 g1f3 d7d5 e2e3 
  info depth 8 score cp 0 nodes 89146  time 270 pv d2d4 g8f6 b1c3 d7d5 g1f3 b8c6 e2e3 e7e6 
  info depth 9 score cp 22 nodes 732191  time 1514 pv e2e4 b8c6 d2d4 e7e6 g1f3 g8e7 b1c3 d7d5 f1d3 
  info depth 10 score cp 11 nodes 938355  time 1043 pv e2e4 b8c6 d2d4 e7e6 g1f3 g8f6 b1c3 d7d5 c1g5 f8b4 
  3494
  bestmove e2e4
  
  ```
  
  **Tags:** engines, programming
  
  > **Comments:**
  > **username_1**: For multi-threading to work properly, each CPU must always have something to do.  How do you ensure that?  
  > **username_2**: I'm more concerned about the fact that your NPS tanked,  Can you give more details about your architecture?  
  > **username_3**: I think the community needs more details (computer specifications, programming language, etc.) in order to be able to answer your question.  
  
  ---
  
  ## 0 answers
  
  