memory requirement - std::bad_alloc


I am using PALABOS for simulating single fluid in porous media in 3D. I have a large dataset with 100 000 000 lattices.

I was not able to run this dataset. I received the following error:

terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc
Aborted (core dumped)

What are possible reasons for this error? How to solve it?

Do you know how to determine necessary memory before running simulation?

Thank you very much.

Wow that’s a huge dataset!

So, I’m not an expert but I will try to answer. Of course, this can be wrong and I ask the expert in this forum to correct me. Each particle distribution function (iPop) is commonly a double type (8 bytes). If you are using, for instance, the descriptor D3Q19 you have 19 double numbers to allocate on each lattice node. So, in this example, you will have 100000000198 ~= 15GB.

You can reduce this number using single precision numbers (float) or using a different lattice descriptor. Using a big computer with a lot of RAM will also help.

You also can ask yourself if you really need such a huge dataset.

Cheers and good luck!


Thank you for your answer. You are right. I have checked other sources. The memory requirement approximately can be estimated in that way.

What will be the effect of changing from double precision to single precision for such big sample?