icp/oer/courses/c-openmp/sections/02-advanced/07-tasks/content.md

439 B

Task offer an easy way to offload a block of code to another thread, while the main thread can keep going.

Knowledge

To mark a block of code as a task, use the pragma omp task directive. The current thread will keep going, while another thread will execute the specified block. If you need to be sure that all the task are done before you proceed use the pragma omp taskwait directive.

Task

Use task to speed up the code.