Flexible Parallel Learning in Edge Scenarios: Communication, Computational and Energy Cost