@@ -31,7 +31,8 @@ use subspace_farmer::utils::readers_and_pieces::ReadersAndPieces;
3131use subspace_farmer:: utils:: ss58:: parse_ss58_reward_address;
3232use subspace_farmer:: utils:: {
3333 all_cpu_cores, create_plotting_thread_pool_manager, parse_cpu_cores_sets,
34- run_future_in_dedicated_thread, thread_pool_core_indices, AsyncJoinOnDrop ,
34+ recommended_number_of_farming_threads, run_future_in_dedicated_thread,
35+ thread_pool_core_indices, AsyncJoinOnDrop ,
3536} ;
3637use subspace_farmer:: { Identity , NodeClient , NodeRpcClient } ;
3738use subspace_farmer_components:: plotting:: PlottedSector ;
@@ -113,7 +114,8 @@ pub(crate) struct FarmingArgs {
113114 #[ arg( long) ]
114115 sector_downloading_concurrency : Option < NonZeroUsize > ,
115116 /// Defines how many sectors farmer will encode concurrently, defaults to 1 on UMA system and
116- /// number of NUMA nodes on NUMA system. It is further restricted by
117+ /// number of NUMA nodes on NUMA system or L3 cache groups on large CPUs. It is further
118+ /// restricted by
117119 /// `--sector-downloading-concurrency` and setting this option higher than
118120 /// `--sector-downloading-concurrency` will have no effect.
119121 #[ arg( long) ]
@@ -130,7 +132,8 @@ pub(crate) struct FarmingArgs {
130132 #[ arg( long) ]
131133 farming_thread_pool_size : Option < NonZeroUsize > ,
132134 /// Size of one thread pool used for plotting, defaults to number of logical CPUs available
133- /// on UMA system and number of logical CPUs available in NUMA node on NUMA system.
135+ /// on UMA system and number of logical CPUs available in NUMA node on NUMA system or L3 cache
136+ /// groups on large CPUs.
134137 ///
135138 /// Number of thread pools is defined by `--sector-encoding-concurrency` option, different
136139 /// thread pools might have different number of threads if NUMA nodes do not have the same size.
@@ -151,7 +154,8 @@ pub(crate) struct FarmingArgs {
151154 plotting_cpu_cores : Option < String > ,
152155 /// Size of one thread pool used for replotting, typically smaller pool than for plotting
153156 /// to not affect farming as much, defaults to half of the number of logical CPUs available on
154- /// UMA system and number of logical CPUs available in NUMA node on NUMA system.
157+ /// UMA system and number of logical CPUs available in NUMA node on NUMA system or L3 cache
158+ /// groups on large CPUs.
155159 ///
156160 /// Number of thread pools is defined by `--sector-encoding-concurrency` option, different
157161 /// thread pools might have different number of threads if NUMA nodes do not have the same size.
@@ -495,22 +499,16 @@ where
495499 . unwrap_or ( plotting_thread_pool_core_indices. len ( ) + 1 ) ,
496500 ) ) ;
497501
498- let all_cpu_cores = all_cpu_cores ( ) ;
499502 let plotting_thread_pool_manager = create_plotting_thread_pool_manager (
500503 plotting_thread_pool_core_indices
501504 . into_iter ( )
502505 . zip ( replotting_thread_pool_core_indices) ,
503506 ) ?;
504507 let farming_thread_pool_size = farming_thread_pool_size
505508 . map ( |farming_thread_pool_size| farming_thread_pool_size. get ( ) )
506- . unwrap_or_else ( || {
507- all_cpu_cores
508- . first ( )
509- . expect ( "Not empty according to function description; qed" )
510- . cpu_cores ( )
511- . len ( )
512- } ) ;
509+ . unwrap_or_else ( recommended_number_of_farming_threads) ;
513510
511+ let all_cpu_cores = all_cpu_cores ( ) ;
514512 if all_cpu_cores. len ( ) > 1 {
515513 info ! ( numa_nodes = %all_cpu_cores. len( ) , "NUMA system detected" ) ;
516514
0 commit comments