concurrent with pycsp

8 views
Skip to first unread message

Davide 'dada' Carboni

unread,
May 21, 2010, 6:01:42 AM5/21/10
to pycsp
Hi all,
I'm new to the group and interested in concurrent and distributed
computing. My question is about the applicability of pyCSP in real
programs. Given the impact of GIL in python concurrent code I wonder
whether is pyCSP affected by the python GIL or not.

Tnx.

Rune M. Friborg

unread,
May 21, 2010, 6:10:47 AM5/21/10
to pycsp
Hi Davide and welcome to the group.

>is pyCSP affected by the python GIL or not.

It depends on which pycsp implementation you decide to use.

These are the available implementations and are all bundled in the
current distribution:

pycsp.threads
pycsp.processes
pycsp.greenlets
pycsp.net (proof of concept)

You will find a description of the three implementations in
http://pycsp.googlecode.com/files/paper-02.pdf


But to answer question with an example.

Limited by the GIL
{{{
import pycsp.threads as pycsp
@pycsp.process
def foolish_work():
sum = 0
for i in range(1000000):
sum += 1

Parallel(foolish_work(), foolish_work())
}}}

Not affected by the GIL:
{{{
import pycsp.processes as pycsp
@pycsp.process
def foolish_work():
sum = 0
for i in range(1000000):
sum += 1

Parallel(foolish_work(), foolish_work())
}}}


- Rune



On May 21, 12:01 pm, "Davide 'dada' Carboni" <dcarb...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages