2
Entire “for each” loop marked active will divide work:
•Loop control statement has to be regular, not customizable.
•Divides work into chunks for master+team threads.
•Number of threads actually used is tuned to local hardware.
• active for each( Type t in collection ) {
  // each team thread gets a chunk of loop iterations
}
•If there are side effects, use futures to merge results:
• vector<future<…>> results =
  active for each( Type t in collection ) {
  // each team thread gets a chunk of loop iterations
}
• for each( future<…> r in results ) {
  // do something with r.wait()
}
Active Loops