brew install gcc
brew install libomp
brew info gcc (To find out which version of GCC was installed)
gcc-11 -fopenmp <file-name>.c -o <file-name>
export OMP_NUM_THREADS=8 (To set the number of threads you want)
./<file-name>
Example:
- To run the hello_world.c file, I used:
gcc-11 -fopenmp hello_world.c -o hello_world
export OMP_NUM_THREADS=8
./hello_world
- Hello World
- Fibonacci and Factorial with OpenMP directives