Created
July 13, 2013 17:42
-
-
Save rahul8590/5991529 to your computer and use it in GitHub Desktop.
OpenMp program. To compile this in C++ $ g++ table.cpp -fopenmp -o table #this assumes openmp is installed in your system. $ export OMP_NUM_THREADS=4 #set the number of threads needed for you.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include <cmath> | |
int main() | |
{ | |
const int size = 256; | |
double sinTable[size]; | |
#pragma omp parallel | |
{ | |
printf("hello\n"); | |
} | |
#pragma omp parallel for | |
for(int n=0; n<size; ++n) | |
sinTable[n] = std::sin(2 * M_PI * n / size); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment