CS491:
Below is information on how to compile and run an openMP
program. You must run this on typhoon.cs.nmsu.edu
YOu need to ensure that you set up the correct environment (path, etc)
set up the number of processors (threads) and then compile the program
-- Lines you need to add to your .cshrc file
#
if ( -e /local/config/cshrc.hpc ) then
source /local/config/cshrc.hpc
endif
-- environment variable for number of threads
setenv OMP_NUM_THREADS 2
-- simple makefile
all: first.c
tmcc first.c -o first -xopenmp=parallel
--- THE PROGRAM
#include
#include
void main()
{
int i;
int num;
num=omp_get_num_procs();
#pragma omp parallel for
for (i=1;i<1000; i++)
{
printf(" %d I am running on %d\n",i,omp_get_thread_num());
}
}