Complex math on GPU v CPU

조회 수: 1 (최근 30일)
Rodrigo
Rodrigo 2012년 9월 23일
I am using complex step derivatives to compute gradients of an otherwise real and analytic function, but I get different answers when running the exact same code on the GPU as on the CPU. Most differences are small (<.1%), but some can be off by more than a factor of 2. All GPU computations are done using double precision on a GTX 580 running 2012a.
When I use John D'Errico's DERIVEST to compute the same thing using real finite differences (awesome program by the way) CPU and GPU produce pretty much identical answers. Is there some subtle difference in the way the GPU handles complex numbers that would cause this?
Thanks, Rodrigo

답변 (1개)

Andy
Andy 2012년 9월 24일
hello Rodrigo,
first, thanks for trying the MathWorks GPU offering.
the GPU math library has been written to give results as close to the CPU as reasonably possible. most functions and arithmetic operators are off only a couple ulps. your comments/questions are somewhat surprising. would you mind posting some more details such as example code with inputs? also what OS are you using to run CPU MATLAB?
thanks,
Andy
.
  댓글 수: 2
Rodrigo
Rodrigo 2012년 9월 24일
I can post the code, but it operates on image stacks that are several GB in size, so that would be a problem. More generally, the code tries to simulate the shadow of an object that is spinning. This requires finding distances and evaluating spline fits. So each result averages over millions of pixel values, uses sqrt's where the argument can have a small imaginary part (for the CSD), runs an gpu adapted version of ppval, and does a lot of trivial arithmetic. Could accumulated round-off from the millions of averaged pixels really be that bad?
Rodrigo
Rodrigo 2012년 9월 24일
Both versions run on the same machine, which runs 64bit Ubuntu 12.04

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by