Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!chx400!chx400!bernina!bloepfe From: bloepfe@bernina.ethz.ch (Bruno Loepfe) Newsgroups: comp.lang.fortran Subject: Re: Cray conditional vector merge Message-ID: <1991Feb25.122147.430@bernina.ethz.ch> Date: 25 Feb 91 12:21:47 GMT References: <1991Feb24.050433.21694@ariel.unm.edu> Reply-To: bloepfe@bernina.UUCP (Bruno Loepfe) Organization: Swiss Federal Institute of Technology (ETH), Zuerich Lines: 31 In article <1991Feb24.050433.21694@ariel.unm.edu> john@ghostwheel.unm.edu (John Prentice) writes: >I have a question for the Cray guru's out there. When you execute >a conditional vector merge in Cray Fortran, what is really happening? >For example, consider: > > a=cvmgp(f(x),g(x),h(x)) > >where f,g, and h are some arithmetic functions. Does it compute both >f(x) and g(x) and then return only one depending on what the value >of h(x) is or does it only compute f(x) or g(x) as required depending >on the value of h(x)? > Yes, it does indeed. It evaluates f(x) to some vector register, evaluates g(x) to another vector register, creates a bit mask of (h(x) .GT. 0.0) and then stores the aproppriate value in a, according to the mask. This means, if for example h(x) > 0.0 for 90% or more of all x, f(x) = const and g(x) = VERY time consuming function of x, such a loop might execute slower in vector mode than in scalar mode... ------------------------------------------------------------------------------- Bruno Loepfe u36@czheth5a.bitnet Computing Center loepfe@rz.id.ethz.ch Federal Institute of Technology bloepfe@ethz.uucp Zuerich, Switzerland ..!uunet!mcsun!ethz!bloepfe (UUCP) -- ------------------------------------------------------------------------------- Bruno Loepfe u36@czheth5a.bitnet Computing Center loepfe@rz.id.ethz.ch Federal Institute of Technology bloepfe@ethz.uucp