As a contrived example, to find the maximum within 10 sets of numbers
   >./@:> t.''"0[  _1e5<\ ?1e6#1e10
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
|9999848805|9999857715|9999916190|9999950164|9999958186|9999654397|9999995337|9999840462|9999971302|9999983414|
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+

You need not worry about the number of threads or how many tasks are being
used. J will evaluate at the full capacity of the computer.

On Thu, Dec 22, 2022 at 2:59 PM bill lam <bbill....@gmail.com> wrote:

> I am not sure. But you can check the number of thread created.
>
> On Thu, 22 Dec 2022 at 2:28 PM Ak O <akin...@gmail.com> wrote:
>
>> Thank you Bill,
>>
>> Are these two lines equivalent?
>>
>> T.&''"0 (|change)#(*change){1 0 55
>>
>> 0&T.''0^:(0 < #)1$~(1>. (<:MAXTHREADS)-1 T.'')
>>
>>
>> Raul's example:
>>
>> setthreadcount=: {{
>>       change=. y-1 T.''
>>       T.&''"0 (|change)#(*change){0 0 55
>>       1 T.''
>>    }}
>>
>>
>> Ak.
>>
>>
>> On Wed., Dec. 21, 2022, 19:20 bill lam, <bbill....@gmail.com> wrote:
>>
>> > create thread pool:
>> > MAXTHREADS_z_=: {: 8 T.''
>> > echo 'MAXTHREADS: ',": MAXTHREADS
>> > 3 : 0''
>> > if. 1<MAXTHREADS do.
>> >  0&T."0^:(0 < #) 0$~ (1 >. (<:9!:56'cores') <. (<:MAXTHREADS)- 1 T. '')
>> >  echo 'thread pool#0: ', ": n1=. 1 T. ''
>> >  0&T."0^:(0 < #) 1$~ (1 >. (<:MAXTHREADS)- 1 T. '')
>> >  echo 'thread pool#1: ', ": (1 T. '') - n1
>> > end.
>> > )
>> >
>> > for cpu intensive tasks
>> > f1 t.(0;<'worker';1)"0 foo
>> >
>> > for i/o bound tasks
>> > g t.(1;<'worker';1)"0 bar
>> >
>> >
>> >
>> >
>> > On Thu, Dec 22, 2022 at 9:53 AM Ak O <akin...@gmail.com> wrote:
>> >
>> > > Hi Bill,
>> > >
>> > > How is a threadpool assigned?
>> > > For clarity, can you please show two sample commands?
>> > > The command that creates threads in threadpool 0.
>> > > The command that creates threads in threadpool 1.
>> > >
>> > > Thank you for your help.
>> > >
>> > > Ak
>> > >
>> > >
>> > >
>> > > >
>> > > ----------------------------------------------------------------------
>> > > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> > >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to