Article View: comp.lang.misc
Article #1988Re: After aliassing -- parallelisation?
From: Dan Bernstein
Date: Fri, 09 Nov 1990 06:50
Date: Fri, 09 Nov 1990 06:50
21 lines
1283 bytes
1283 bytes
In article <1990Nov8.183058.25045@maths.nott.ac.uk> anw@maths.nott.ac.uk (Dr A. N. Walker) writes:
> int f() { return i++; }
> { int j = (f(), 2) + (f(), 2);
> printf ("%d\n", i);
[ two f()s may run in parallel, so i's value is undefined ]
One thing that helps detect this situation is pure functions, which
depend only on their arguments and local variables initialized from
their arguments. (Clearly subroutines of pure functions must be pure.)
Once you add the ``pure'' keyword, the compiler can warn about parallel
non-pure functions. It also helps vectorization if you can assert that a
series of statements is pure.
[ semaphores ]
> but who is going to go to so much trouble [and why will we think of
> it in the first place]? What should users of C and Fortran do?
> Pray?
Be careful with static and global variables?
---Dan
Technical Details
Message-ID:
<24674:Nov906:50:1890@kramden.acf.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstndReferences:
<5085@lanl.gov> <1990Nov8.183058.25045@maths.nott.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: After aliassing -- parallelisation? Message-ID: <24674:Nov906:50:1890@kramden.acf.nyu.edu> Date: 9 Nov 90 06:50:18 GMT References: <5085@lanl.gov> <1990Nov8.183058.25045@maths.nott.ac.uk> Organization: IR Lines: 21