Changes

Jump to: navigation, search

GPU621/The Chapel Programming Language

973 bytes added, 17:07, 4 December 2020
m
Comparesion to MPI & OpenMP
stop_time();
}
 
//Hello World Chapel
use Time;
var t: Timer;
//const numTasks = here.numPUs();
const numTasks = 8;
t.start();
coforall tid in 1..numTasks do
writef("Hello from task %n of %n \n", tid, numTasks);
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

Navigation menu