Great view of datasets in C / C ++

What is the best way to present the following data for subsequent parallel computing:

A set of quadruple (approximately 20,000,000) integers that should be accessible by the first three elements of the four as indices?

The calculation should be done using MPI in C / C ++.

UPD: It should also be emphasized that I have two similar data structures described above, with the only difference being that the first is static and the second is dynamic. To be precise, you need to calculate the fourth element of each tuple in the second structure.

Based on the comments, I am now inclined to use C ++ vectors and hash them using the first three values. I guess I need to create a hash map. How to do it in C ++?

+3
source share
4 answers

It basically sounds like pointwise data in three-dimensional space. There are many solutions to this problem, and choosing the best depends on the range and distribution of your indexes, as well as your data access patterns. The latter is especially important - do you arbitrarily choose a set of values ​​as your key and want to see if there are data quadrants there, or do you access them more regularly? Different data structures offer very different costs for regular and random access.

For description, I will call your data quadrants {X, Y, Z, W}, where {X, Y, Z} is your key, and W is the value associated with this key.

Xmin-to-Xmax, Ymin-to-Ymax, Zmin-to-Zmax, , X, Y Z quad, , 3D-, X, Y Z, W, .

- , , , (, 25% ), 3D-, W, "". , X, Y, Z , W (-1, , , INT_MAX, ), W is_present true/false , .

, , , , . : http://en.wikipedia.org/wiki/Octree. , 8 . , ; 8 - . , . , ( ), , .

+2

?

, io/, ?

?

32 (20 * 4 * 4) ~ 305 , , , .

, . O (N). .

+1

, ( ), concurrency.

, "" , (, ) . , , , .

, , , - . , . , hashmap , . - O (log n) looups per-w630 > .

+1

(, ), -.

0

Source: https://habr.com/ru/post/1735989/


All Articles