Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #4925

Re: Short-circuiting in C

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From blmblm@myrealbox.com <blmblm.myrealbox@gmail.com>
Newsgroups comp.lang.c
Subject Re: Short-circuiting in C
Date 28 May 2011 19:31:20 GMT
Organization None
Lines 86
Message-ID <94d0s8FrfmU1@mid.individual.net> (permalink)
References <irm4et$66d$1@speranza.aioe.org> <irmuo5$u9t$1@dont-email.me> <94b8ekFsnU1@mid.individual.net> <irpr4j$q20$1@dont-email.me>
X-Trace individual.net DHXE03cEKwrVxkVmZEHGBg+BHBFG4V4uyXK9YEYWbovB+qjbmM
X-Orig-Path not-for-mail
Cancel-Lock sha1:W3P64iK4ntY5RHog+/Z1AFc6NnM=
X-Newsreader trn 4.0-test76 (Apr 2, 2001)
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:4925

Show key headers only | View raw


In article <irpr4j$q20$1@dont-email.me>,
Eric Sosman  <esosman@ieee-dot-org.invalid> wrote:
> On 5/27/2011 11:28 PM, blmblm@myrealbox.com wrote:
> > In article<irmuo5$u9t$1@dont-email.me>,
> > Eric Sosman<esosman@ieee-dot-org.invalid>  wrote:
> >> [...]
> >>       C has no way to express the computation you desire.  C's abstract
> >> machine has only one flow of control, if we ignore the rather mysterious
> >> effects of asynchronous signals and `volatile' variable.  There is no
> >> C construct that will evaluate a,b,c in parallel execution paths and
> >> then somehow combine the three results into a single test.  You've
> >> chosen the wrong implementation language.
> >
> > Hesitant though I am to argue with someone who generally seems
> > far more expert than I am ....
> 
>      "My blushes, Watson."  (And don't be too awed by my expertise;
> the only reason I'm in the top ten of this group -- on good days --
> is that the top twenty have stopped posting.)

Well, all right, if that's too much flattery, how about

s/far more expert than I am/very clueful/ 

?

> > I don't get the impression at all that the OP wants a, b, and
> > c evaluated in parallel.  As I understand it, he just wants to
> > be sure that there is no branching involved in the evaluation
> > of the condition (a&&  b&&  c).  I admit I don't have a clear
> > understanding of the platform he's targeting, but it sounds like
> > it somehow involves multiple processing elements [*] executing the
> > same compiled code, and under those circumstances I can vaguely
> > imagine that performance might be better if all these processing
> > elements execute exactly the same instructions (i.e., no branches).
> >
> > [*] The ones that put the "MD" in "SIMD" is what I'm thinking here,
> > though admittedly not with as much clarity as I might like.
> 
>      He didn't say anything about parallel execution at first, which
> is why I gave a rather different response on the initial go-around.
> But later he wrote that "On the GPU I am using, threads execute
> simultaneously [provided...]," and I understood that as a request for
> a C construct that expresses the "provided" and guarantees parallel
> execution.  

I think what I'm not getting is why you're interpreting his words as
a request to have *a, b, and c* evaluated ....  

Oh, maybe we're talking at cross purposes here!  I understand you to
be saying that he wants the three parts of the conditional executed
concurrently, presumably each in its own thread, and that's what
didn't/doesn't make sense to me.

But maybe in fact you're asking about how he hopes to have multiple
threads concurrently evaluating the whole expression (a && b && c)?
Now *that* would at least make sense as something one might want the
program to do.

But in general I understand him to be saying that the parallelism
(multiple threads operating concurrently, each evaluating the whole
expression) is being provided by some other part of the platform,
and he just wants to know how to come up with an expression whose
evaluation doesn't involve branching.  That seems to me to be entirely
topical for this group and something one might want to do for other
reasons (such as improved performance on a platform where any kind
of branching is slow), though admittedly some of those alleged reasons
might be ill-advised.

> C has conditional constructs that may (*may*) involve no
> branches, given smooth seas and a following wind, but has nothing that
> can guarantee or even talk about parallel execution, leaving aside
> signals and volatiles.

Sure, but I don't think that's what he's asking ....  

>      'course, it's possible I've misunderstood the O.P. or blundered
> in some other way, and will be summarily drummed out of the top ten.
> Again.  (Anybody recall the Brain Trust of the TV series "Scrubs?"
> Them's my guys ...)

No room for error, eh?  :-)?

-- 
B. L. Massingill
ObDisclaimer:  I don't speak for my employers; they return the favor.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 13:58 -0400
  Re: Short-circuiting in C Ben Pfaff <blp@cs.stanford.edu> - 2011-05-26 11:09 -0700
    Re: Short-circuiting in C Thomas Richter <thor@math.tu-berlin.de> - 2011-05-26 20:22 +0200
      Re: Short-circuiting in C Ben Pfaff <blp@cs.stanford.edu> - 2011-05-26 11:35 -0700
        Re: Short-circuiting in C falk@rahul.net (Edward A. Falk) - 2011-05-31 18:45 +0000
          Re: Short-circuiting in C Nizumzen <chicken@mcnuggets.com> - 2011-05-31 20:31 +0100
      Re: Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 14:51 -0400
        Re: Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 15:10 -0400
          Re: Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 21:35 -0400
            Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-26 23:38 -0700
              Re: Short-circuiting in C Shao Miller <sha0.miller@gmail.com> - 2011-05-27 09:28 -0400
          Re: Short-circuiting in C falk@rahul.net (Edward A. Falk) - 2011-05-31 19:01 +0000
            Re: Short-circuiting in C falk@rahul.net (Edward A. Falk) - 2011-05-31 19:02 +0000
        Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-26 12:55 -0700
          Re: Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 16:17 -0400
            Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-26 21:28 -0400
              Re: Short-circuiting in C Seebs <usenet-nospam@seebs.net> - 2011-05-27 05:06 +0000
              Re: Short-circuiting in C Noob <root@127.0.0.1> - 2011-05-27 17:48 +0200
                Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-27 21:31 -0400
              Re: Short-circuiting in C blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-05-28 03:28 +0000
                Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-27 23:43 -0400
                Re: Short-circuiting in C blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-05-28 19:31 +0000
                Re: Short-circuiting in C Michael Press <rubrum@pacbell.net> - 2011-05-30 00:28 -0700
                Re: Short-circuiting in C BGB <cr88192@hotmail.com> - 2011-05-30 23:08 -0700
                Re: Short-circuiting in C Michael Press <rubrum@pacbell.net> - 2011-05-31 18:30 -0700
                Re: Short-circuiting in C BGB <cr88192@hotmail.com> - 2011-06-02 09:08 -0700
                Re: Short-circuiting in C Nobody <nobody@nowhere.com> - 2011-05-28 14:08 +0100
                Re: Short-circuiting in C BGB <cr88192@hotmail.com> - 2011-05-28 12:52 -0700
              Re: Short-circuiting in C falk@rahul.net (Edward A. Falk) - 2011-05-31 19:22 +0000
                Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-31 21:07 -0400
                Re: Short-circuiting in C Dr Nick <3-nospam@temporary-address.org.uk> - 2011-06-11 17:07 +0100
                Re: Short-circuiting in C Shao Miller <sha0.miller@gmail.com> - 2011-06-11 12:57 -0500
  Re: Short-circuiting in C "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-05-26 14:36 -0400
  Re: Short-circuiting in C "Scott Fluhrer" <sfluhrer@ix.netcom.com> - 2011-05-26 14:39 -0400
    Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-26 13:28 -0700
      Re: Short-circuiting in C Urist Sethkab <uristqwerty@gmail.com> - 2011-05-26 15:34 -0700
        Re: Short-circuiting in C "Scott Fluhrer" <sfluhrer@ix.netcom.com> - 2011-05-27 10:08 -0400
          Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-27 07:56 -0700
          Re: Short-circuiting in C Geoff <geoff@invalid.invalid> - 2011-05-27 20:14 -0700
            Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-27 20:26 -0700
              Re: Short-circuiting in C Geoff <geoff@invalid.invalid> - 2011-05-27 20:44 -0700
  Re: Short-circuiting in C Nobody <nobody@nowhere.com> - 2011-05-27 00:06 +0100
    Re: Short-circuiting in C Billy Mays <noway@nohow.com> - 2011-05-26 21:34 -0400
      Re: Short-circuiting in C Nobody <nobody@nowhere.com> - 2011-05-27 07:41 +0100
  Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-26 21:21 -0400
  Re: Short-circuiting in C Shao Miller <sha0.miller@gmail.com> - 2011-05-26 20:41 -0500
    Re: Short-circuiting in C Shao Miller <sha0.miller@gmail.com> - 2011-05-26 21:03 -0500
      Re: Short-circuiting in C Shao Miller <sha0.miller@gmail.com> - 2011-05-26 21:37 -0500
  Re: Short-circuiting in C ImpalerCore <jadill33@gmail.com> - 2011-05-27 09:01 -0700
    Re: Short-circuiting in C Willem <willem@toad.stack.nl> - 2011-05-27 16:08 +0000
      Re: Short-circuiting in C ImpalerCore <jadill33@gmail.com> - 2011-05-27 09:46 -0700
        Re: Short-circuiting in C BGB <cr88192@hotmail.com> - 2011-05-28 13:27 -0700
  Re: Short-circuiting in C James Kuyper <jameskuyper@verizon.net> - 2011-05-28 09:44 -0400
    Re: Short-circuiting in C Keith Thompson <kst-u@mib.org> - 2011-05-28 12:15 -0700
      Re: Short-circuiting in C James Kuyper <jameskuyper@verizon.net> - 2011-05-28 17:07 -0400
  Re: Short-circuiting in C "Herbert Rosenau" <os2guy@pc-rosenau.de> - 2011-05-29 07:25 +0000
  Re: Short-circuiting in C falk@rahul.net (Edward A. Falk) - 2011-05-31 18:40 +0000
    Re: Short-circuiting in C BGB <cr88192@hotmail.com> - 2011-06-02 09:48 -0700
      Re: Short-circuiting in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-02 21:05 -0400

csiph-web