@@ -34,7 +34,8 @@ use subspace_farmer::utils::readers_and_pieces::ReadersAndPieces;
3434use subspace_farmer:: utils:: ss58:: parse_ss58_reward_address;
3535use subspace_farmer:: utils:: {
3636 all_cpu_cores, create_plotting_thread_pool_manager, parse_cpu_cores_sets,
37- run_future_in_dedicated_thread, thread_pool_core_indices, AsyncJoinOnDrop ,
37+ recommended_number_of_farming_threads, run_future_in_dedicated_thread,
38+ thread_pool_core_indices, AsyncJoinOnDrop ,
3839} ;
3940use subspace_farmer:: { Identity , NodeClient , NodeRpcClient } ;
4041use subspace_farmer_components:: plotting:: PlottedSector ;
@@ -116,7 +117,8 @@ pub(crate) struct FarmingArgs {
116117 #[ arg( long) ]
117118 sector_downloading_concurrency : Option < NonZeroUsize > ,
118119 /// Defines how many sectors farmer will encode concurrently, defaults to 1 on UMA system and
119- /// number of NUMA nodes on NUMA system. It is further restricted by
120+ /// number of NUMA nodes on NUMA system or L3 cache groups on large CPUs. It is further
121+ /// restricted by
120122 /// `--sector-downloading-concurrency` and setting this option higher than
121123 /// `--sector-downloading-concurrency` will have no effect.
122124 #[ arg( long) ]
@@ -133,7 +135,8 @@ pub(crate) struct FarmingArgs {
133135 #[ arg( long) ]
134136 farming_thread_pool_size : Option < NonZeroUsize > ,
135137 /// Size of one thread pool used for plotting, defaults to number of logical CPUs available
136- /// on UMA system and number of logical CPUs available in NUMA node on NUMA system.
138+ /// on UMA system and number of logical CPUs available in NUMA node on NUMA system or L3 cache
139+ /// groups on large CPUs.
137140 ///
138141 /// Number of thread pools is defined by `--sector-encoding-concurrency` option, different
139142 /// thread pools might have different number of threads if NUMA nodes do not have the same size.
@@ -154,7 +157,8 @@ pub(crate) struct FarmingArgs {
154157 plotting_cpu_cores : Option < String > ,
155158 /// Size of one thread pool used for replotting, typically smaller pool than for plotting
156159 /// to not affect farming as much, defaults to half of the number of logical CPUs available on
157- /// UMA system and number of logical CPUs available in NUMA node on NUMA system.
160+ /// UMA system and number of logical CPUs available in NUMA node on NUMA system or L3 cache
161+ /// groups on large CPUs.
158162 ///
159163 /// Number of thread pools is defined by `--sector-encoding-concurrency` option, different
160164 /// thread pools might have different number of threads if NUMA nodes do not have the same size.
@@ -498,22 +502,16 @@ where
498502 . unwrap_or ( plotting_thread_pool_core_indices. len ( ) + 1 ) ,
499503 ) ) ;
500504
501- let all_cpu_cores = all_cpu_cores ( ) ;
502505 let plotting_thread_pool_manager = create_plotting_thread_pool_manager (
503506 plotting_thread_pool_core_indices
504507 . into_iter ( )
505508 . zip ( replotting_thread_pool_core_indices) ,
506509 ) ?;
507510 let farming_thread_pool_size = farming_thread_pool_size
508511 . map ( |farming_thread_pool_size| farming_thread_pool_size. get ( ) )
509- . unwrap_or_else ( || {
510- all_cpu_cores
511- . first ( )
512- . expect ( "Not empty according to function description; qed" )
513- . cpu_cores ( )
514- . len ( )
515- } ) ;
512+ . unwrap_or_else ( recommended_number_of_farming_threads) ;
516513
514+ let all_cpu_cores = all_cpu_cores ( ) ;
517515 if all_cpu_cores. len ( ) > 1 {
518516 info ! ( numa_nodes = %all_cpu_cores. len( ) , "NUMA system detected" ) ;
519517
0 commit comments