
#12181: Multi-threaded code on ARM64 GHC runtime doesn't use all available cores --------------------------------------------+------------------------------ Reporter: varosi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Runtime performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | --------------------------------------------+------------------------------ Comment (by thomie): varosi: you are reporting an issue with `+RTS -N`, correct? When compiling the following program with `-threaded`, and running it with `./Main +RTS -N`, it prints `2` instead of `4` on your machine: {{{ import Control.Concurrent main = getNumCapabilities >>= print }}} Here's the code that gets the number of processors when using `+RTS -N`, from `rts/posix/OSThreads.c`: {{{#!C uint32_t getNumberOfProcessors (void) { static uint32_t nproc = 0; if (nproc == 0) { #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) nproc = sysconf(_SC_NPROCESSORS_ONLN); #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) nproc = sysconf(_SC_NPROCESSORS_CONF); #elif defined(darwin_HOST_OS) size_t size = sizeof(uint32_t); if(sysctlbyname("hw.logicalcpu",&nproc,&size,NULL,0) != 0) { if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0) nproc = 1; } #elif defined(freebsd_HOST_OS) size_t size = sizeof(uint32_t); if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0) nproc = 1; #else nproc = 1; #endif } return nproc; } }}} From `man sysconf`: {{{ - _SC_NPROCESSORS_CONF The number of processors configured. - _SC_NPROCESSORS_ONLN The number of processors currently online (available). }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12181#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler