Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Efficient storage of 3D field data

Sebastian_U_1
Beginner
433 Views

Hi,

in working on a numerical code, which solves a discretised equation on a three dimensional grid. I have multiple fields (around 80) I need to save on this grid and which are needed to compute my results. I want to perform my computations (which consist of rather simple operations (as product / dot product) to set up a sparse matrix and solve this matrix using MKL. My questions are:

1) What ist the most efficient way to store the data? Using a 1D array or a multidimensional array? At the moment I'm using a 1D array and accessing it in my innermost loop using 

for kk...
for jj...
for ii...
for (int k = 0 ; k < 8 l k++){
for (int j = 0 ; j < 8 ; j++){
for (int i = 0 ; i < 8 ; i++){
   field1[offset + i] += field2[offset + i]
}}}
}}}

 

in order to get good spacial and temporal data locality. The data is aligned in such a way, that offset is always a multiple of 8. To do so - as far as I understood - my data should be aligned to a 64 byte boundary. Since I have many blocks consisting of ni x nj x nk cells, this alignment leads to a quite high overhead (the factor between aligned and unaligned data is between 1.5 and 2). Is there a more efficient way to store my data?

Thanks,

Sebastian

0 Kudos
2 Replies
Anoop_M_Intel
Employee
433 Views

Hi Sebastian,

I have redirected this thread to MKL forum who can help with the best data layout for using MKL routines.

Thanks and Regards
Anoop

0 Kudos
Gennady_F_Intel
Moderator
433 Views

in the case if you are going to use some sparse mkl's routines, then you will need to convert your format to the CSR or another sparse formats are supported my mkl. There are some axiliary routines which will help you to make conversion from one format to another. see MKL Reference for details.

0 Kudos
Reply