Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "omp.h"
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <unistd.h>
#include <chrono>
#include <thread>
#include <time.h>
#define THREADS 4
#define N 16
/**
* Use the internal work queue to give a chunk-sized block
* of loop iterations to each thread. When a thread is finished,
* it retrieves the next block of loop iterations from the top of the work queue.
*/
/**
* @brief A function that showcases how threads and dynamic scheduling work
* @note Makes use of OpenMP
*/
int main ()
{
int i;
/**
* @TODO: Make a loop that prints the iteration and the thread that executed it.
* @note Use one directive that combines 'schedule' and 'num_threads'.
* ! Make sure that you use dynamic scheduling!
* Here is an example print statement:
* std::cout<<"Thread"<<" "<<omp_get_thread_num()<<" "<<"has completed iteration"<<" "<<i<<std::endl;
*/
std::cout<<"All threads done"<<std::endl;
return 0;
}