220 17233 <3be1928f-2116-4712-be20-7368682abf26@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: tef@tentity.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Generic Parallel Computing (GPC) API
Date: Fri, 3 Apr 2015 05:15:13 -0700 (PDT)
Lines: 229
Approved: news@gmane.org
Message-ID: <3be1928f-2116-4712-be20-7368682abf26@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_297_924641526.1428063313015"
X-Trace: ger.gmane.org 1428063322 7844 80.91.229.3 (3 Apr 2015 12:15:22 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 3 Apr 2015 12:15:22 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDL4BSXDYUBBBUMI7KUAKGQEG7JD7CQ@isocpp.org Fri Apr 03 14:15:16 2015
Return-path: <std-proposals+bncBDL4BSXDYUBBBUMI7KUAKGQEG7JD7CQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f71.google.com ([209.85.220.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDL4BSXDYUBBBUMI7KUAKGQEG7JD7CQ@isocpp.org>)
	id 1Ye0VH-0000GE-RF
	for gclcip-std-proposals@m.gmane.org; Fri, 03 Apr 2015 14:15:16 +0200
Original-Received: by pactp5 with SMTP id tp5sf179632419pac.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 03 Apr 2015 05:15:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=mD4wkg9cY/tmwdnnYenTOiQDb2cVliRH6JGZ9O8vk4I=;
        b=XFm7sFP6swmBWiHpmZQdGT6ijOKsn1iJqzn0wK2EzVpXlKuniL+Cf7YaHic0svwERH
         3cEVb6IO8sXy5dBZC2cVNRS/YXVYTBA0Pgecj/P0Epw57+U7bHO5jnAEgXM3/Ynh1qRF
         K6V7sFOuxPgELnn6FmBeF4IHiiSCzjEPJUTK4ybU5kUpcIpzvovOxVTRtauXPsnQfpBM
         1qagAp2fvsjEgjGFr+/VAa6H3TAbDFBI00spjzqa/aly97tI0+GtpepRGLw/Nwn74CBl
         YD6Ysu3BoZfdJyl+Jz0J36TQ4RYmzfeIsnJ9u/hZByFk0FCd70uSamfsBNltJPsPLlUV
         g6Lg==
X-Gm-Message-State: ALoCoQmGK/soRvVK9rMAEgVIeb1nZDq5iqRVEStsHeItPiaOUQX1nHjUCTj/aBs+gNqmUx2cS3nU
X-Received: by 10.66.236.74 with SMTP id us10mr2625050pac.28.1428063314669;
        Fri, 03 Apr 2015 05:15:14 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.90.239 with SMTP id x102ls1232931qgd.86.gmail; Fri, 03 Apr
 2015 05:15:13 -0700 (PDT)
X-Received: by 10.140.39.148 with SMTP id v20mr18539qgv.24.1428063313753;
        Fri, 03 Apr 2015 05:15:13 -0700 (PDT)
X-Original-Sender: tef@tentity.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:17233
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17233>

------=_Part_297_924641526.1428063313015
Content-Type: multipart/alternative; 
	boundary="----=_Part_298_1258457790.1428063313015"

------=_Part_298_1258457790.1428063313015
Content-Type: text/plain; charset=UTF-8

 

Now, C++ includes built-in support for threads, mutual exclusion, condition 
variables, and futures. But some essential paradigm for parallel computing 
is missing.

I am talking about well known *fork/join* but enhanced for task 
parallelism. 

So, in GPC API:


   - the *fork* API does not clone a process or thread but submit a 
   function/lambda to a thread pool. 
   - the *join* API submits a function/lambda to a quetex.
   
 Quetex is Mutual Exclusion Queue. It eliminates blocking/waiting and 
thread switching in comparison to mutexes and futures.

 gpc::quetex<int> qtx;

 while( /* condition */ ) {

    gpc::fork([qtx]() {

         // do something, then

         qtx.join([](gpc::mutex<int>& state) {

               // exclusive access to <int>

              state.setData() or state.getData()

        });
    });

 }


Here is an example of the usage: Reduction 
<http://websql.s3-website-us-east-1.amazonaws.com/ReductionCpp.html>

I assume that if C++ includes threads it can include thread pools also. And 
if there is mutexes it could be also quetexes there.

I have an implementation of GPC API that I use for my development. You can 
try it at http://parallect.codeplex.com

If you have a use case for task parallelization, please share. It would be 
interesting to see how the *fork/join* would work or not.

Thanks

Andrew



-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_298_1258457790.1428063313015
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">







<p class=3D"p1"><span class=3D"s1">Now, C++ includes built-in support for t=
hreads, mutual exclusion, condition variables, and futures. But some essent=
ial paradigm for parallel computing is missing.</span></p><p class=3D"p1">I=
 am talking about well known&nbsp;<u>fork/join</u>&nbsp;but enhanced for ta=
sk parallelism.&nbsp;</p><p class=3D"p1">So, in GPC API:</p><p class=3D"p1"=
>







</p><p class=3D"p1"></p><ul><li><span class=3D"s1" style=3D"line-height: 18=
px;">the </span><span class=3D"s2" style=3D"line-height: 18px;"><u>fork</u>=
</span><span class=3D"s1" style=3D"line-height: 18px;"> API does not clone =
a process or thread but submit a function/lambda to a thread pool.&nbsp;</s=
pan><br></li><li><span class=3D"s1" style=3D"line-height: 18px;">the </span=
><span class=3D"s2" style=3D"line-height: 18px;"><u>join</u></span><span cl=
ass=3D"s1" style=3D"line-height: 18px;"> API submits a function/lambda to a=
 quetex.</span><br></li></ul><p></p><p class=3D"p1"><span class=3D"s1">







</span></p><p class=3D"p1"><span class=3D"s1">







</span></p><p class=3D"p1"><span class=3D"s1">Quetex is Mutual Exclusion Qu=
eue. I</span>t eliminates blocking/waiting and thread switching in comparis=
on to mutexes and futures.</p><div class=3D"prettyprint" style=3D"border: 1=
px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(2=
50, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp;gpc</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">quetex</span><span styl=
e=3D"color: #080;" class=3D"styled-by-prettify">&lt;int&gt;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> qtx</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br>&nbsp;</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">while</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">/* condition */</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &=
nbsp; gpc</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">fork</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">([</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">qtx</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">]()</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// do something, th=
en</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;qtx</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">join</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">([](</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">gpc</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">mutex</sp=
an><span style=3D"color: #080;" class=3D"styled-by-prettify">&lt;int&gt;</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> state</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp;</span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">// exclusive access to &lt;int&gt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; state</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">setD=
ata</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">or</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> state</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">getData</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">});</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">});</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br><br>&nbsp;</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br></span></div></code></div><p =
class=3D"p1"><span class=3D"s1"><br></span></p><p class=3D"p1">Here is an e=
xample of the usage:&nbsp;<a href=3D"http://websql.s3-website-us-east-1.ama=
zonaws.com/ReductionCpp.html">Reduction</a><br></p><p class=3D"p1">I assume=
 that if C++ includes threads it can include thread pools also. And if ther=
e is mutexes it could be also quetexes there.</p><p class=3D"p1">I have an =
implementation of GPC API that I use for my development. You can try it at&=
nbsp;<a href=3D"http://parallect.codeplex.com">http://parallect.codeplex.co=
m</a></p>







<p class=3D"p1">If you have a use case for task parallelization, please sha=
re. It would be interesting to see how the&nbsp;<u>fork/join</u>&nbsp;would=
 work or not.</p><p class=3D"p1">Thanks</p><p class=3D"p1">Andrew</p>







<p class=3D"p1"><span class=3D"s1"><br></span></p><p class=3D"p1"><span cla=
ss=3D"s1"><br></span></p></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_298_1258457790.1428063313015--
------=_Part_297_924641526.1428063313015--

.
