On Mon, 11 Apr 2022, Raul Miller wrote:
_SC_NPROCESSORS_ONLN
A mobile device may have n cores 'configured', but only 1 'online' at a
given point in time; the remainder are sleeping, but will be woken up if
you provide work for them to do. So prefer _SC_NPROCESSORS_CONF.
OSX
sysconf
Another approach which works under windows, to count cpu cores, would be:
wincpucores=: {{
assert. 0={.;'kernel32 GetNativeSystemInfo n i' 15!:0 , wrote:
>
> The mechanism here is presumably common knowledge, but might be worth
> sharing.
> Here's what I use to allocate half of the laptop's
The mechanism here is presumably common knowledge, but might be worth
sharing.
Here's what I use to allocate half of the laptop's cores for use by J:
NB. Processor Affinity
coclass 'affin'
require'dll'
GetCurrentProcess=: >@{.@('kernel32 GetCurrentProcess i'&(15!:0))
GetProcessAffinityMask=:
There's currently no rush for deciding this kind of thing.
We need some experience with this mechanism, first. And, before that,
we need to support Henry's efforts to sort out the rough edges.
But counting cpu cores is a relatively simple task, if slightly
obscure. So I thought I should leave a
why not have a command line argument providing a default number?
$USER may know better what they consider a good default
Am 11.04.22 um 00:31 schrieb Raul Miller:
It would be nice, I imagine, if we eventually had a mechanism like
It would be nice, I imagine, if we eventually had a mechanism like
https://www.cprogramming.com/snippets/source-code/find-the-number-of-cpu-cores-for-windows-mac-or-linux
to set up a default number of threads.
--
Raul
On Sat, Apr 9, 2022 at 3:04 PM Henry Rich wrote:
>
> The big news in J904
If I understand correctly,
{{for. 1 2 3 4 -.2 T.'' do.0 T.'' end.}}0
each=: (t.'')every
should "just work". The performance of code using 'each' may change
but the results should match current results.
So far, in my limited tests, this has indeed been the case.
Thanks,
On Sat, Apr 9,