Layer-based scheduling algorithm for parallel tasks with dependencies