Tips for making 2D simulations as computationally light as possible?
10 weeks ago by
Questions for you brilliant scientists:
-What are your tips for making these simulations run as quickly as possible?
-Potential avenues to try?
Is GPU acceleration/ and or parallelization implementation even remotely feesable?
Any ideas or potential pitfalls would be greatly appreciated, before I go off and try something crazy and overly complicated.
I'm pretty adept with python and motivated to learn
9 weeks ago by
To do both these things, add the lines below to your project's xml file (after the end of the <Potts> block);
The above tells CC3D to only output the step info every 100 MCS and that it should try to use 4 CPUs (or threads, or cores). If your python script also writes to the terminal (with print statements) then remove or reduce how often that is done.
If a surface constraint isn't needed you can also remove that from the simulation, which helps speed. Check your xml for a chunk like;
<SurfaceEnergyParameters CellType="typeA" LambdaSurface="2.0" TargetSurface="79"/>
<SurfaceEnergyParameters CellType="typeB" LambdaSurface="2.0" TargetSurface="79"/>
and either comment it out or delete it. Also remove any reference in your python file to cells' surface parameters (targetSurface, lambdaSurface).
For artistic results you might consider using periodic boundary conditions, which will wrap the simulation around and removes the effects of the border on the simulation. If a cell drifts off the right side of the simulation box it reappears on the left. Cells on one side of the box interact with cells on the other via the wrapping. This will help to generate repetitive patterns. In the <Potts> section of the xml file add;
(You can also add an additional line if you want the Z-axis to be periodic as well.)
You can also explore removing an unneeded (for your simulation) Plugins. In your xml file look for things like <Plugin Name="CenterOfMass"> and remove them if they aren't needed.
One more thing to try is a hexagonal (instead of square) lattice. That probably won't help speed but a hexagonal lattice might give more interesting patterns since the symmetry goes from 4 to 6. In the <Potts> block of the xml file add;
There are a couple changes in the player that can also speed things up;
1. [visualization tab][cell borders] turn off if you don't need the cell borders. In large simulations (particularly in 3D) drawing cell borders takes a lot of time.
2. [Tools tab][Configuration...][output tab];
a. increase the "update screen every Nth MCS" to a larger value so the screen isn't rewritten so often.
b. uncheck the "save image every Nth MCS" or set to a large value
c. uncheck the "Save lattice every Nth MCS"
3. [Tools tab][Configuration...][Axes'n'Decor tab];
a. uncheck everything.
I hope these ideas help.
9 weeks ago by
Please login to add an answer/comment or follow this question.