Open main menu

CDOT Wiki β

Changes

GPU621/The Chapel Programming Language

143 bytes added, 17:10, 4 December 2020
m
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));
 
//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);
}
== Pros and Cons of Using The Chapel ==
46
edits