46
edits
Changes
m
//Hello World OpenMP
#include <iostream>
#include <omp.h>
#include <chrono>
using namespace std::chrono;
// report system time
void reportTime(const char* msg, steady_clock::duration span) {
auto ms = duration_cast<milliseconds>(span);
std::cout << msg << " - took - " <<
ms.count() << " milliseconds" << std::endl;
}
int main() {
steady_clock::time_point ts, te;
ts = steady_clock::now();
#pragma omp parallel
{
int tid = omp_get_thread_num();
int nt = omp_get_num_threads();
printf("Hello from task %d of %d \n", tid, nt);
}
te = steady_clock::now();
reportTime("Integration", te - ts);
}
→Comparesion to MPI & OpenMP
stop_time();
}
//Hello World OpenMP
#include <iostream>
#include <omp.h>
#include <chrono>
using namespace std::chrono;
// report system time
void reportTime(const char* msg, steady_clock::duration span) {
auto ms = duration_cast<milliseconds>(span);
std::cout << msg << " - took - " <<
ms.count() << " milliseconds" << std::endl;
}
int main() {
steady_clock::time_point ts, te;
ts = steady_clock::now();
#pragma omp parallel
{
int tid = omp_get_thread_num();
int nt = omp_get_num_threads();
printf("Hello from task %d of %d \n", tid, not);
}
te = steady_clock::now();
reportTime("Integration", te - ts);
}
//Hello World Chapel
t.stop();
writeln(t.elapsed(TimeUnits.milliseconds));
== Pros and Cons of Using The Chapel ==