Good point! 4 or 6 may be good numbers. -Øystein
søn. 6. sep. 2026 kl. 23:48 skrev Philippe Michel <[email protected] >: > I agree with the principle. Regarding the various thresholds, I like the > initial proposition: > > - I used the think that one less than the CPU threads count mattered but > I now find that it doesn't really matter. Maybe the OS schedulers > improved or what made a difference with, say, older dual cores is less > clear now that even low-end systems tend to have four or more. > > - For the maximum, "all" may not be that useful. Multithreading doesn't > scale linearly, especially for analyses. Moreover, CPU threads above 4 > or 6 may often not be real ones but come from hyperthreading. For common > PCs, 4 threads should reap a large part of the potential improvement. > > I may be deluded, but I would thing that sophisticated users already > tune this and the proposed setup, while possibly conservative, would > already be a nice improvement for the others. > > > On Sun, Sep 06, 2026 at 12:33:45PM +0200, Øystein Schønning-Johansen wrote: > > Agreed. Default should be more than 1. The simplest is to default to all. > > Actually the command should be able to parse a command like: > > > > set threads all > > > > Then a setting file can be transferred from on computer to another > without > > having to manually change that setting. > > > > -Øystein > > > > On Sun, 6 Sept 2026, 10:30 Ian Shaw, <[email protected]> wrote: > > > > > I usually set gnubg to use the max threads - 1 so that it doesn't > > > completely slug performance of other tasks during rollouts. > > > > > > Definitely, the default should be greater than 1. > > > > > > Regards, > > > Ian > > > > > > On Sat, 5 Sept 2026, 16:31 TAKAHASHI Kaoru, < > [email protected]> > > > wrote: > > > > > >> Currently, the default number of threads for gnubg is 1, but > considering > > >> today’s typical PCs, I believe this is a rather conservative setting. > > >> > > >> In particular, users trying gnubg for the first time are likely to > > >> attempt an analysis without changing the thread count setting; in that > > >> case, even on a PC with a multi-core CPU, only one thread will be > > >> used. As a result, this may give the first impression that gnubg’s > > >> analysis is slower than it actually is. > > >> > > >> > > >> Since the number of threads explicitly set by a user is saved as > > >> "set threads", changing the default value will not overwrite existing > > >> users' saved settings. The change will primarily affect the initial > value > > >> for new users or environments where the number of threads has not yet > > >> been set. > > >> > > >> Therefore, I propose determining the default number of evaluation > > >> threads based on the number of available CPUs. > > >> > > >> One proposal, for example, is to use > > >> > > >> MIN(g_get_num_processors(), 4) > > >> > > >> which utilizes the number of schedulable threads returned by GLib > while > > >> capping the default at a maximum of 4 threads. > > >> > > >> This way, in environments where only one or two threads are available, > > >> the program will adapt accordingly, while in typical multi-core > > >> environments, it will run significantly faster than the current > > >> single-threaded version. On the other hand, even on machines with a > > >> large number of logical CPUs, this approach prevents gnubg from using > up > > >> nearly all available CPU resources by default. > > >> > > >> > > >> Another option is to use g_get_num_processors() as-is and use all > > >> threads deemed available as the default. > > >> > > >> This approach is straightforward in terms of prioritizing analysis > speed > > >> and allows us to more directly show first-time users the performance > > >> achievable on their machine. However, in environments capable of using > > >> 8, 16, 32, or more threads, gnubg will place a significantly high CPU > > >> load even if the user hasn’t configured anything. > > >> > > >> I believe that if we want to address the issue where the default > setting > > >> of 1 thread gives the impression that "gnubg is slow", while also > > >> ensuring the default setting does not consume an excessive amount of > CPU > > >> resources, > > >> > > >> MIN(g_get_num_processors(), 4) > > >> > > >> would be a reasonable choice. > > >> > > >> On the other hand, if the priority is for the analysis software to use > > >> the maximum number of available CPUs by default, using > > >> g_get_num_processors() as-is is also a viable option. > > >> > > >> Which approach do you think is better? > > >> > > >> Best regards, > > >> -- > > >> TAKAHASHI Kaoru > > >> > > > >
