Blitz logo

Blitz Support :

From: Othmar Frey (ofrey_at_[hidden])
Date: 2004-09-07 06:47:06


Thanks to all of you, Julian, Xavier, and Todd, for your hints.

-DBZ_ALIGN_BLOCKS_ON_CACHELINE_BOUNDARY or compiler flags did not
 seem to solve the problem.

Then I tried Xavier's suggestion, which showed me that the
difference in speed is around 10% in favor of the fftw++ solution
using Bowman's Array class.
As the difference is rather small, I guess it has nothing to
do with the question whether SIMD is activated or not. What is your
opinion?

Meanwhile, I think the problem lies in the fftw++ class itself, which expects the vector data to be allocated in a way that must be different from the way it is allocated in blitz++. It looks as if
more memory was allocated than would be needed for the actual size of the vector. Then the pointer is shifted to the beginning of the vector
within that memory block...
Unfortunately, I do not really grasp what Bowman's Array class is doing, so I think that I will stick to Xavier's solution.

Best regards,

Othmar

-- 
-----------------------------------------------------------------------
Othmar Frey                             Remote Sensing Laboratories RSL
ofrey_at_[hidden]                      University of Zurich
http://www.geo.unizh.ch/~ofrey          Winterthurerstrasse 190	
phone +41 44 635 51 64                  CH-8057 Zurich
fax   +41 44 635 68 46                  Switzerland
-----------------------------------------------------------------------
Todd Veldhuizen wrote:
>Hi Othmar, if Julian's suggestion doesn't work you might try compiling
>with -DBZ_ALIGN_BLOCKS_ON_CACHELINE_BOUNDARY which forces blitz arrays to
>be allocated on a 128-byte boundary (see memblock.cc).
>
>cheers,
>Todd
>
>On Thu, 2 Sep 2004, Julian C. Cummings wrote:
>
>  
>
>>Hello Othmar,
>>
>>Presumably the proper data alignment can be obtained by using an appropriate
>>compiler flag.  You might want to look at how the fftw library and the
>>fftw++ wrapper package are being compiled to see what special compiler
>>options (if any) are being used to control data alignment.  Using the same
>>options when building your application with fftw and blitz should be all
>>that is required.  I believe that 8-byte alignment of doubles implies 
>>16-byte alignment of complex<double> objects, since these are concrete data
>>types.
>>
>>Regards, Julian C.
>>
>>Dr. Julian C. Cummings
>>Staff Scientist, CACR/Caltech
>>(626) 395-2543
>>cummings_at_[hidden]
>> 
>>
>>    
>>
>>>-----Original Message-----
>>>From: blitz-support-bounces_at_[hidden] 
>>>[mailto:blitz-support-bounces_at_[hidden]] On Behalf Of Othmar Frey
>>>Sent: Thursday, September 02, 2004 3:14 AM
>>>To: blitz-support_at_[hidden]
>>>Subject: [Blitz-support] FFTW and Blitz++, 16-byte aligned Vector 
>>>
>>>
>>>Hi.
>>>
>>>I am using (or rather trying to use) the fftw library in combination 
>>>with Blitz++.
>>>
>>>I've learned that the arrays of complex data passed to fftw must be 
>>>16-byte aligned
>>>to exploit the "Single Instruction Multiple Data" support of fftw.
>>>
>>>Is there a way to make a Vector<complex<double> > be 16-byte 
>>>aligned in 
>>>memory?
>>>
>>>Until now, I used the fftw++ wrapper class by John C. Bowman in 
>>>combination with his
>>>Array class (http://www.math.ualberta.ca/~bowman/Array.h) 
>>>then created a 
>>>blitz::Vector
>>>from preexisting memory by passing a pointer to an array of Bowman's 
>>>Array class.
>>>But I am not that happy with this kind of "solution".
>>>
>>>Any suggestions?
>>>
>>>Best regards
>>>
>>>Othmar
>>>
>>>-- 
>>>--------------------------------------------------------------
>>>---------
>>>Othmar Frey                             Remote Sensing 
>>>Laboratories RSL
>>>ofrey_at_[hidden]                      University of Zurich
>>>http://www.geo.unizh.ch/~ofrey          Winterthurerstrasse 190	
>>>phone +41 44 635 51 64                  CH-8057 Zurich
>>>fax   +41 44 635 68 46                  Switzerland
>>>--------------------------------------------------------------
>>>---------
>>>
>>>
>>>_______________________________________________
>>>Blitz-support mailing list
>>>Blitz-support_at_[hidden] 
>>>http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>>>
>>>      
>>>
>>_______________________________________________
>>Blitz-support mailing list
>>Blitz-support_at_[hidden]
>>http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>>
>>    
>>
>
>
>  
>