Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread bill lam
I am not sure. But you can check the number of thread created. On Thu, 22 Dec 2022 at 2:28 PM Ak O wrote: > Thank you Bill, > > Are these two lines equivalent? > > T.&''"0 (|change)#(*change){1 0 55 > > 0''0^:(0 < #)1$~(1>. (<:MAXTHREADS)-1 T.'') > > > Raul's example: > > setthreadcount=: {{ >

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Ak O
Thank you Bill, Are these two lines equivalent? T.&''"0 (|change)#(*change){1 0 55 0''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

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Raul Miller
Oh, wait.. I guess I'm ignorant of the thread grouping issues. Please ignore this previous email. Thanks, -- Raul On Wed, Dec 21, 2022 at 10:55 PM Raul Miller wrote: > > Note that you could have used the 'setthreadcount' implementation for this: > > setthreadcount <:{:8T.'' > > However, I'm

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Raul Miller
Note that you could have used the 'setthreadcount' implementation for this: setthreadcount <:{:8T.'' However, I'm not sure that creating the maximum number of threads is going to be the most efficient approach. (In some cases it might be.) Also, I'm realizing that I should have included that

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Raul Miller
On Wed, Dec 21, 2022 at 8:07 PM Ak O wrote: > setthreadcount=: {{ > change=. y-1 T.'' > T.&''"0 (|change)#(*change){0 0 55 > 1 T.'' > }} > > To accomplish this, you might use a routine like > setthreadcount=: {{ >change=. y-1 T.'' > -NB. Does this set 'change' to a

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread bill lam
create thread pool: MAXTHREADS_z_=: {: 8 T.'' echo 'MAXTHREADS: ',": MAXTHREADS 3 : 0'' if. 1. (<:9!:56'cores') <. (<:MAXTHREADS)- 1 T. '') echo 'thread pool#0: ', ": n1=. 1 T. '' 0"0^:(0 < #) 1$~ (1 >. (<:MAXTHREADS)- 1 T. '') echo 'thread pool#1: ', ": (1 T. '') - n1 end. ) for cpu intensive

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Ak O
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 >

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Ak O
Hi Ed, I hope you are well. If you are willing, do you mind sharing a comparison of the routine that you improved (with some commentary)? Ak > > -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread bill lam
It would be sufficient to create threadpool when starting an application. No need to bother how many threads are available inside the application. Eg if your machine has 8 CPU, then create 7 threads for pool 0 (for CPU bounded tasks) and 56 threads for pool 1 (for I/O bounded tasks) On Thu, Dec

Re: [Jprogramming] Thread Primitives -> Execute as task (t.)

2022-12-21 Thread Ak O
Thank you Raul, Conceptually, the primitives are simple. T. is for configuration and setup. You always have one thread (the master thread), and you probably should have one additional thread for each cpu "core" (which you might think of as a register set -- a small set of variables that