Program examples#
If you have not done so already copy our examples to your home directory by running the following command:
cp -r /apps/gent/tutorials/Intro-HPC/examples ~/
~
(tilde) refers to your home directory, the directory you arrive by default when you login.
Go to our examples:
cd ~/examples/Program-examples
Here, we just have put together a number of examples for your convenience. We did an effort to put comments inside the source files, so the source code files are (should be) self-explanatory.
-
01_Python
-
02_C_C++
-
03_Matlab
-
04_MPI_C
-
05a_OMP_C
-
05b_OMP_FORTRAN
-
06_NWChem
-
07_Wien2k
-
08_Gaussian
-
09_Fortran
-
10_PQS
The above 2 OMP directories contain the following examples:
C Files | Fortran Files | Description |
---|---|---|
omp_hello.c | omp_hello.f | Hello world |
omp_workshare1.c | omp_workshare1.f | Loop work-sharing |
omp_workshare2.c | omp_workshare2.f | Sections work-sharing |
omp_reduction.c | omp_reduction.f | Combined parallel loop reduction |
omp_orphan.c | omp_orphan.f | Orphaned parallel loop reduction |
omp_mm.c | omp_mm.f | Matrix multiply |
omp_getEnvInfo.c | omp_getEnvInfo.f | Get and print environment information |
omp_bug* | omp_bug* | Programs with bugs and their solution |
Compile by any of the following commands:
Language | Commands |
---|---|
C: | icc -openmp omp_hello.c -o hello |
pgcc -mp omp_hello.c -o hello | |
gcc -fopenmp omp_hello.c -o hello | |
Fortran: | ifort -openmp omp_hello.f -o hello |
pgf90 -mp omp_hello.f -o hello | |
gfortran -fopenmp omp_hello.f -o hello |
Be invited to explore the examples.