Re: [racket-users] Racket 7 multi core support

2018-05-22 Thread Sam Tobin-Hochstadt
Just like with current Racket, both futures and places run in a single
process.

Sam

On Tue, May 22, 2018, 2:39 AM Piyush Katariya 
wrote:

> Thanks Sam.
>
> When you say Racket 7's "cs" variant can use Future and Places to leverage
> multiple CPU cores, is it one OS process or multiple ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread Piyush Katariya
Thanks Sam.

When you say Racket 7's "cs" variant can use Future and Places to leverage 
multiple CPU cores, is it one OS process or multiple ? 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread George Neuner

Hi Sam,

On 5/21/2018 11:42 PM, Sam Tobin-Hochstadt wrote:

First, the default build of Racket 7 (according to the plan Matthew
posted to the racket-dev list on Feb 20) will have the new in-Racket
expander, but the default will not be to use Chez Scheme's runtime.

Second, the "cs" variant of Racket will map Racket futures onto Chez
pthreads, and many more operations are future-safe in that variant.
However, Racket threads still do not run in parallel in the "cs"
variant -- you need to use futures or places to make use of more than
one hardware core from Racket.

Sam


Thanks for the clarification.  I'm not on the developer list - I've just 
read the blog entries.  I have pretty much suspected all along that 
Racket would not rush to adopt kernel threads (other than internally to 
implement places).


George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread Sam Tobin-Hochstadt
First, the default build of Racket 7 (according to the plan Matthew
posted to the racket-dev list on Feb 20) will have the new in-Racket
expander, but the default will not be to use Chez Scheme's runtime.

Second, the "cs" variant of Racket will map Racket futures onto Chez
pthreads, and many more operations are future-safe in that variant.
However, Racket threads still do not run in parallel in the "cs"
variant -- you need to use futures or places to make use of more than
one hardware core from Racket.

Sam

On Mon, May 21, 2018 at 11:31 PM, George Neuner  wrote:
>
> On 5/21/2018 12:00 PM, Piyush Katariya wrote:
>>
>> what if i dont wish to juggle between Threads and Places to leverage all
>> CPU cores ?
>
>
> Just use Thread abstraction.
>
> Chez Scheme page says it can possible run on multi core, so I believe it
> must be possible for Racket 7 to do so ???
> https://github.com/cisco/chezscheme
>
>
> Not necessarily.   Chez uses kernel threads on most platforms, but it's
> threads don't have the same semantics as Racket's threads.  So far, I have
> heard nothing definitive about whether Chez-Racket will try to use Chez
> threads directly, or continue with the Racket user-space thread model.
>
>
> You also should note the caution in Chez's documentation:
>
> One restriction should be observed when one of multiple threads creates or
> loads compiled code, however, which is that only that thread or subsequently
> created children, or children of subsequently created children, etc., should
> run the code. This is because multiple-processor systems upon which threaded
> code may run might not guarantee that the data and instruction caches are
> synchronized across processors.
>
> I'm not familiar with the internals of Chez threads, but this wording makes
> me wonder.  It's possible that the initial program thread might be started
> on any core, but other threads it creates are restricted to running on the
> same core as the parent  [most OS allow doing this].  Forking another
> process may be the only way to (guarantee to) use multiple cores.
>
> Also note that Chez's thread API provides no way to change thread affinity.
>
> George
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread George Neuner


On 5/21/2018 12:00 PM, Piyush Katariya wrote:


what if i dont wish to juggle between Threads and Places to
leverage all CPU cores ?


Just use Thread abstraction.

Chez Scheme page says it can possible run on multi core, so I believe 
it must be possible for Racket 7 to do so ???

https://github.com/cisco/chezscheme


Not necessarily.   Chez uses kernel threads on most platforms, but it's 
threads don't have the same semantics as Racket's threads.  So far, I 
have heard nothing definitive about whether Chez-Racket will try to use 
Chez threads directly, or continue with the Racket user-space thread model.



You also should note the caution in Chez's documentation:

   /One restriction should be observed when one of multiple threads
   creates or loads compiled code, however, which is that only that
   thread or subsequently created children, or children of subsequently
   created children, etc., should run the code. This is because
   multiple-processor systems upon which threaded code may run might
   not guarantee that the data and instruction caches are synchronized
   across processors. /

I'm not familiar with the internals of Chez threads, but this wording 
makes me wonder.  It's possible that the initial program thread might be 
started on any core, but other threads it creates are restricted to 
running on the same core as the parent  [most OS allow doing this].  
Forking another process may be the only way to (guarantee to) use 
multiple cores.


Also note that Chez's thread API provides no way to change thread affinity.

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread Piyush Katariya

>
> what if i dont wish to juggle between Threads and Places to leverage all 
> CPU cores ?


Just use Thread abstraction.

Chez Scheme page says it can possible run on multi core, so I believe it 
must be possible for Racket 7 to do so ???
https://github.com/cisco/chezscheme 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread Sam Tobin-Hochstadt
Additionally, the `racket/future` library provides (somewhat limited)
support for shared memory parallelism.

Sam

On Mon, May 21, 2018 at 11:31 AM, George Neuner  wrote:
>
> On 5/21/2018 10:31 AM, Piyush Katariya wrote:
>>
>> Will Racket 7 support utilizing multi-core CPUs in one process instance ?
>
>
> Sort of.  The Racket VM implements userspace threads on a single core.
> However a single OS process can host multiple instances of the VM which can
> communicate with each other by message passing.
>
> See "places":
> https://docs.racket-lang.org/guide/parallelism.html?q=places#%28part._effective-places%29
> https://docs.racket-lang.org/reference/places.html?q=places
> https://docs.racket-lang.org/guide/parallelism.html?q=places#%28part._distributed-places%29
> https://docs.racket-lang.org/distributed-places/index.html?q=places
>
> George
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 7 multi core support

2018-05-21 Thread George Neuner


On 5/21/2018 10:31 AM, Piyush Katariya wrote:

Will Racket 7 support utilizing multi-core CPUs in one process instance ?


Sort of.  The Racket VM implements userspace threads on a single core.  
However a single OS process can host multiple instances of the VM which 
can communicate with each other by message passing.


See "places":
https://docs.racket-lang.org/guide/parallelism.html?q=places#%28part._effective-places%29
    https://docs.racket-lang.org/reference/places.html?q=places
https://docs.racket-lang.org/guide/parallelism.html?q=places#%28part._distributed-places%29
https://docs.racket-lang.org/distributed-places/index.html?q=places

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.