Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11063
| From | W Craig Carter <ccarter@MIT.EDU> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Can anyone see a faster way to compute quantities for a pair or large matrices? |
| Date | 2012-07-25 06:31 +0000 |
| Message-ID | <juo3ra$14u$1@smc.vnet.net> (permalink) |
| References | <juim0j$k9a$1@smc.vnet.net> <20120724081458.9C7796835@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Thank you Andre,
I did do a version using ParallelTable and that give me some speed up.
But, mostly, I am trying to develop techniques for teaching
Mathematica's more advanced constructs. This was a good lesson. I am
trying to understand why my MapThread solution was so slow.
Thank you for your kind offer for help. I tried for about an hour or so
about a year ago, but I wasn't able to get CUDA to work on my mac laptop
(with which I use to teach and give seminars). If I remember
correctly, the message I get implies that it doesn't work with my
graphics card.(AMD Radeon HD 6770M 1024 M).
I would **very much** like to see an example of how to get it to work;
more to the point, I am hopeful that that I can get an fft (Fourier[])
to use the GPU on a depth 3 array (e.g., RandomReal[{0,1} ,
{nx,ny,nz}]. I am developing a spectral methods example for a course
that I am teaching.
Thank you, Craig
W Craig Carter
Professor of Materials Science, MIT
On Jul 24, , at Tue Jul 24, 12 @4:14 AM, andre.robin3 wrote:
> 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@MIT.EDU> a =E9crit dans le message de news:
> juim0j$k9a$1@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
>
>
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can anyone see a faster way to compute quantities for a pair or large matrices? W Craig Carter <ccarter@MIT.EDU> - 2012-07-23 05:04 +0000 Re: Can anyone see a faster way to compute quantities for a pair or daniel.lichtblau0@gmail.com - 2012-07-23 23:59 +0000 Re: Can anyone see a faster way to compute quantities for a pair or large matrices? "andre.robin3" <andre.robin281@orange.fr> - 2012-07-24 08:15 +0000 Re: Can anyone see a faster way to compute quantities for a pair or Ray Koopman <koopman@sfu.ca> - 2012-07-24 08:15 +0000 Re: Can anyone see a faster way to compute quantities for a pair or Ray Koopman <koopman@sfu.ca> - 2012-07-24 08:16 +0000 Re: Can anyone see a faster way to compute quantities for a pair or W Craig Carter <ccarter@MIT.EDU> - 2012-07-25 06:34 +0000 Re: Can anyone see a faster way to compute quantities for a pair or large matrices? W Craig Carter <ccarter@MIT.EDU> - 2012-07-25 06:31 +0000 Re: Can anyone see a faster way to compute quantities for a pair or Ray Koopman <koopman@sfu.ca> - 2012-07-26 07:36 +0000 Re: Can anyone see a faster way to compute quantities for a pair or Sseziwa Mukasa <mukasa@gmail.com> - 2012-07-26 07:38 +0000
csiph-web