cs205-lecture-examples

Example codes used during Harvard CS205 lectures
git clone https://git.0xfab.ch/cs205-lecture-examples.git
Log | Files | Refs | README | LICENSE

omp_device.cpp (537B)


      1 #include <iostream>
      2 #include <omp.h>
      3 
      4 int main(void)
      5 {
      6 #pragma omp parallel
      7     {
      8 #pragma omp single
      9         {
     10             const int nprocs = omp_get_num_procs();
     11             const int nthreads = omp_get_num_threads();
     12             const int maxthreads = omp_get_max_threads();
     13             std::cout << "Number of processors:      " << nprocs << '\n';
     14             std::cout << "Number of threads in team: " << nthreads << '\n';
     15             std::cout << "Maximum number of threads: " << maxthreads << '\n';
     16         }
     17     }
     18     return 0;
     19 }