Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- reformatting data using strides

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-31-2012
09:45 AM

73 Views

reformatting data using strides

Just wanted to clarify a methodological issue about data processing. I generally have prototypes im matlab, where I can change the sense of processing a data cube by reformatting the data: i.e for a [NxMxK] cube, it is easy to process either N MxK slices, or K NxM slices by re-permuting the dimensions, and iterating along the slowest varying index. Can this possibly be done by a smart choice of stride values in IPP? In other words, is it possible to enforce a specific data access pattern by a user defined stride (esp for a ippr malloc'ed data)?

Thanks,

Sid.

Link Copied

11 Replies

Chao_Y_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2012
12:38 AM

73 Views

Sid,

Ippm domain (small matrix) has the parameters on the strides, which can used to select the data with some pattern.

But from the performance perspective, the consecutive data will provide the good performance, If the slowest index is varying, it is not friendly to achieve the performance. So for some image processing and some other function, it only provide the step parameter, which is the distance between consecutive lines. It supposes the data within one line is consecutive.

Thanks,

Chao

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2012
08:59 AM

73 Views

Thanks Chao. I suspected that much.

Sid.

Sid.

igorastakhov

New Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2012
12:07 PM

73 Views

what are N, M and K? if they are greater than 10 - you should not use IPP - in IPP small matrix domain is optimized for small sizes only 3x3 - 6x6, in some cases up to 10x10. For bigger sizes you should use MKL

Regards,

Igor

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-01-2012
01:36 PM

73 Views

use M x K ippiMalloc'ed frame, iterated over 0 .. N-1 . Seems pretty fast for the processing

i do each frame.

I am still learing MKL call/usage syntax, and will probably shift to that for volume processing.

Sid.

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-02-2012
06:42 AM

73 Views

pattern, or something like this, would be better?

From my point of view, reformattingis a "special technique" that allows to change dimensions of a data

set,

It means, ifthere isa data set with dimensions

dimensions

where

Here is an example, if there is a

1 2 3

4 5 6

7 8 9

it could be "reformatted" to anarray (

1 2 3 4 5 6 7 8 9

or, to avector (

1

2

3

4

5

6

7

8

9

etc. I use that technique to "reformat"

Best regards,

Sergey

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-02-2012
10:33 AM

73 Views

For want of a better term, I used "reformatting". In my example though, I would like to permute the dimensions, to MxNxK = KxMxN (=T), hence the constraints that you mentioned are satisfied. In fact, this is what I would like to do: Given M slices of NxK data, can I read them as K slices of MxN data? In neuroimaging for example, this would amount to acquiring data in axial orientation, and reading them in sagittal orientation, a transformation that is normally referred to as "reformatting" in this field at least.

So, In your examle above, do you reformat based on strides? would it work for a 3D arrangement?

Sid.

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-02-2012
08:35 PM

73 Views

Quoting siddy

So, In your examle above, do you reformat based on strides?

[**SergeyK**] This is what I'd like to understand. You have a 3-D data set ( **Volume** ):

**Volume** = **M** x **N** x **K**

Is it a set of**M** 2-D imageswith dimensions of**N** x **K**?

or

Is it a set of **M** 2-D data sets ( not images / justnumbers) with dimensions of **N** x **K**?

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-03-2012
12:06 PM

73 Views

M 2D images of size NxK .

Would I be at an advantage if it were a set on numbers MxNxK ?

Sid.

Would I be at an advantage if it were a set on numbers MxNxK ?

Sid.

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-03-2012
05:54 PM

73 Views

Quoting siddy

Would I be at an advantage if it were a set on numbers MxNxK ?

Sid.

Hi Sid,

I tested my "transform" function and it doesn't work as expected in case of a3-D data set. It actually doesn't

matter if a 3-D data set is a set of 2-D images or 2-D sets of numbers. As soon asthe "transform" is applied

a data set becomes "invalid" in essense.

I'm going to look at it again some time later and here are three approaches I'm going to test for arranging

3-D data sets:

- A Structure of Arrays (

or

- An Array of Structures (

or

- A new version of my current "transform" function with strides

I remember that there is an article about

Best regards,

Sergey

siddy

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2012
11:07 AM

73 Views

Is you "transform" function something that I can have a look at? If it works like a "permute" function in matlab, this can be a good addition for the IPP suite. Just my thought, but I would be really interested in

having a look at it. In the meantime I am getting my head aroung AoS and SoA

Thanks,

Sid.

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-09-2012
09:09 AM

73 Views

// **Simple 2D Data Set class** ( allows transforms )

//

// **Notes:**

// - This is a prototype I used for a template based 2Ddata set class ( it's avery different but idea is the same )

// - An underlying 1D array for a 2D array is a CONTIGUOUS

// - A Transform functionality assumes that the underlying 1D array is not reallocated

// - You could easily add methods like 'SetValue', 'Clear', 'LoadData', C++ operators, etc

class **CDataSet2D**

{

public:

**CDataSet2D**()

{

Init();

};

virtual ~**CDataSet2D**()

{

Free();

};

private:

void **Init**( void )

{

m_iRows = 0;

m_iCols = 0;

m_piData1D = NULL;

m_piData2D = NULL;

};

public:

int **Allocate**( int iRows, int iCols )

{

if( iRows <= 0 || iCols <= 0 )

return ( int )0;

m_iRows = iRows;

m_iCols = iCols;

m_piData1D = ( int * )malloc( ( m_iRows * m_iCols ) * sizeof( int ) );

if( m_piData1D == NULL )

return ( int )0;

memset( m_piData1D, 0x0, ( m_iRows * m_iCols ) * sizeof( int ) );

m_piData2D = ( int ** )malloc( m_iRows * sizeof( int * ) );

if( m_piData2D == NULL )

return ( int )0;

int *piData = m_piData1D;

for( int i = 0; i < m_iRows; i++ )

{

m_piData2D* = piData; piData += m_iCols; }*

return ( int )1;

};

void **Free**( void )

{

if( m_piData2D != NULL )

{

free( m_piData2D );

m_piData2D = NULL;

}

if( m_piData1D != NULL )

{

free( m_piData1D );

m_piData1D = NULL;

}

};

int **Transform**( int iRows, int iCols )

{

if( iRows <= 0 || iCols <= 0 )

return ( int )0;

if( m_iRows <= 0 || m_iCols <= 0 )

return ( int )0;

if( ( m_iRows * m_iCols ) != ( iRows * iCols ) )

return ( int )0;

if( m_piData1D == NULL )

return ( int )0;

if( m_piData2D == NULL )

return ( int )0;

m_iRows = iRows;

m_iCols = iCols;

if( m_piData2D != NULL )

{

free( m_piData2D );

m_piData2D = NULL;

}

m_piData2D = ( int ** )malloc( m_iRows * sizeof( int * ) );

if( m_piData2D == NULL )

return ( int )0;

int *piData = m_piData1D;

for( int i = 0; i < m_iRows; i++ )

{

m_piData2D* = piData; piData += m_iCols; }*

return ( int )1;

};

protected:

int m_iRows;

int m_iCols;

int *m_piData1D;

int **m_piData2D;

};

void **main**( void )

{

int iRetCode = -1;

CDataSet2D ds2D;

iRetCode = ds2D.Allocate( 5, 5 ); // Initialized as Matrix 5x5

iRetCode = ds2D.Transform( 1, 25 ); // Transformed to Array 1x25

iRetCode = ds2D.Transform( 25, 1 ); // Transformed to Vector 25x1

iRetCode = ds2D.Transform( 7, 7 ); // Attempt to Transform to Matrix 7x7 - Invalid input

}

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.