File(s) Screenshot(s) |
Description |
openmp.tar.gz
 |
All the code and stuff. No makefile, because I was being lazy.
Be sure to set the environment variable OMP_NUM_THREADS, preferably to a multiple of 4 up to 16 (because those numbers are just the best for the CRAY). If you use bash on the CRAY, you should use something like this (for 12 threads):
export OMP_NUM_THREADS=12
but if you have no clue what bash is, then you probably don't use it (and should) and you are probably using csh. If this is the case you should use this (again, for 12 threads):
setenv OMP_NUM_THREADS=12
To compile, use something to the effect of:
f90 -o asdf asdf.f -ffree -O3
Note that this may vary depending on implementation, but the only one I had on hand was on the CRAY, so that's the way it is! |
| March 24, 2004 |
Nothing to see.... |
parallel.f
 |
An introduction to OpenMP. It prints out a 1 for every thread, so use sparingly! |
| March 24, 2004 |
[View parallel.f] |
reduction.f
 |
How to use the REDUCTION clause. Basically, the syntax is REDUCTION(operator:variable). It does whatever on each thread, and then performs the operation on each instance of the variable, and stores it in the variable. Err, easier to observe then to explain, really. |
| March 24, 2004 |
[View reduction.f] |
dodir.f
 |
The DO directive. Thanks to the nature of shared memory, this allows you to easily split a DO loop over processors. The intrinsic RANDOM_NUMBER() generates pseudorandom values from 0 to 1 in each element of an array, MAXVAL() returns the highest value in the given array, and MAXLOC() returns the index of the highest value in the given array (would've made tally easier, that's for sure!). What this program does is find the maximum gradient... (that is, the difference between two of the random numbers divided by two). =\ |
| March 24, 2004 |
[View dodir.f] |
matmult.f
 |
An OpenMP matrix multiplication program. Due to the vagueness of the specifications of the assignment, it gives no output whatsoever and you'll just have to take it on faith that it does it's job in O(N3) time.... |
| March 24, 2004 |
[View matmult.f] |
|