[Date Index]
[Thread Index]
[Author Index]
Re: Can anyone see a faster way to compute quantities for a pair or large matrices?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg127428] Re: Can anyone see a faster way to compute quantities for a pair or large matrices?
*From*: "andre.robin3" <andre.robin281 at orange.fr>
*Date*: Tue, 24 Jul 2012 04:14:58 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: mathgroup-newout@smc.vnet.net
*Delivered-to*: mathgroup-newsend@smc.vnet.net
*References*: <juim0j$k9a$1@smc.vnet.net>
Your problem is a good candidate for parallel computing.
It can be :
1) multi-kernel computing (with Mathematica 7 or Mathematica 8). It's easy to implement.
Of course, it needs a multi-core machine.
2) GPGPU computing (with Mathmatica 8)
It needs a Graphic Card with CUDA or OPENCL capabilities.
I can try 1) or 2) with CUDA.
Are you interested ?
"W Craig Carter" <ccarter at MIT.EDU> a écrit dans le message de news:
juim0j$k9a$1 at smc.vnet.net...
>
> Hello,
> I am computing the gradient on a grid, then computing the gradient's
> angle, and its magnitude. The computations below are the bottleneck for
> a longer bit of code. I would be grateful for any insights on how to
> speed these up.
>
> (*
> Let gradfield be the gradient that I have computed and placed in two
> matrices. Here I will just use random numbers as a proxy:
> *)
>
> (*i.e., df/dx, df/dy*)
> gradfield = { RandomReal[{-1, 1}, {256, 256}], RandomReal[{-1, 1}, {256,
> 256}]};
>
> (*my gradients has many zeroes, so I need to handle these*)
>
> SetAttributes[myArcTan, {Listable, NumericFunction}];
> myArcTan[0.0, 0.0] = 0.0;
> myArcTan[x_, y_] := ArcTan[x, y]
>
>
> (*the angles, this is slow*)
> psiField = MapThread[myArcTan, gradfield, 2];
>
> (*the magnitudes, this is slower*)
> magfield = MapThread[Norm[{#}] &, gradfield, 2];
>
>
> (*examples*)
> Do[psiField = MapThread[myArcTan, gradfield, 2], {100}] // Timing
> Do[magfield = MapThread[Norm[{#}] &, gradfield, 2], {100}] // Timing
>
> W Craig Carter
> Professor of Materials Science, MIT
Prev by Date:
**Re: Can anyone see a faster way to compute quantities for a pair or**
Next by Date:
**Using Fit to interpolate data**
Previous by thread:
**Re: Can anyone see a faster way to compute quantities for a pair or large matrices?**
Next by thread:
**Re: Can anyone see a faster way to compute quantities for a pair or large matrices?**
| |