'Running discrete grid projections on more than 4 processes

I currently have my model running with a discrete grid projection on 4 processes. I create the grid in the following way:

    std::vector<int> processDimensions;
processDimensions.push_back(2);
processDimensions.push_back(2);

// The grid projection will contain agents of type VirusCellInteractionAgents, so that it can facilitate all agents types
// Then we can use the agent type identifier in each agent ID, to cast them to the correct type of agent.
discreteGridSpace = new repast::SharedDiscreteSpace<VirusCellInteractionAgents, repast::WrapAroundBorders, repast::SimpleAdder<VirusCellInteractionAgents>>("AgentsDeiscreteSpace", gridDimensions, processDimensions, 2, comm);

I wanted to try and run the model on 8 or 16 processes, so I was wondering, what should the processDimensions be in such case. I attempted keeping it 2 on each axis, as it was initially, however that results in the following error just after the first grid balance() call

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 71163 RUNNING AT Aleksandars-MBP
=   EXIT CODE: 11
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault: 11 (signal 11)


Solution 1:[1]

The dimensions should multiply to the number of processes. So, 4x2 for 8 or 4x4 for 16.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Collier