MCS 572 CM-5 Fortran & C Source Code Examples
CM-5 DJM Generic Execution Job Script Example:
- click for CM-5 DJM Generic Execution Job Script:
cm5jsub.run
(This DJM Job Script is Meant for Executing an CM-5 Excutable Named `run',
so all you need to do is to have compiled your code.
Usage Notes:
- Enter `jsub cm5jsub.run' on the CM-5 compile server scratch directory
command line
- Enter `jstat' until your job no longer is listed;
- Then `vi pgm.out'.
CM-5 CMF Fortran F90 Extensions Test:
- click for Fortran CMF v.6 Test Source Code:
cmftest.fcm
- click for Fortran CMF v.6 Test Compiler Listing:
cmftest.lis
- click for CM-5 Fortran CMF v. 6 Test Output:
cmftest.out
Usage Notes:
- Copy `cp cmftest.fcm ~/scratch2/pgm.fcm',
- Change to scratch directory `cd ~/scratch2',
- Compile `cmf -cm5 -vu -O -list -o run pgm.fcm >& pgm.lis&'
- And If "Done", Use `jsub cm5jsub.run' Above on cm5 to Execute;
- Else If "Exit", look at compiler listing: `vi pgm.lis',
- Find Errors,
- Correct Source,
- Remove or Rename Compiler Listing: `rm pgm.lis',
- And ReCompile.
- Output can be examined by `vi pgm.out'.
CM-5 CMF Fortran Laplace Equation Example:
- click for Fortran Laplace Source Code:
laplace.fcm
- click for Fortran Laplace Compiler Listing:
laplace.lis
- click for CM-5 Laplace Output:
laplace.out
Usage Notes:
- Copy `cp laplace.fcm ~/scratch2/pgm.fcm',
- Change to scratch directory `cd ~/scratch2',
- Compile `cmf -cm5 -vu -O -list -o run pgm.fcm >& pgm.lis&'
- And If "Done", Use `jsub cm5jsub.run' Above on cm5 to Execute;
- Else If "Exit", look at compiler listing: `vi pgm.lis',
- Find Errors,
- Correct Source,
- Remove or Rename Compiler Listing: `rm pgm.lis',
- And ReCompile.
- Output can be examined by `vi pgm.out'.
CM-5 CMF Fortran Finding Primes Examples:
- click for Fortran Primes1 Source Code:
primes1.fcm
- click for Fortran Primes1 Compiler Listing:
primes1.lis
- click for CM-5 Primes1 Output:
primes1.out
- click for Another Fortran Primes2 Source Code:
primes2.fcm
- click for CM-5 Primes2 Output:
primes2.out
Usage Notes:
- Copy `cp primes1.fcm ~/scratch2/pgm.fcm',
- Continue as with above usage notes.
CM-5 CSTAR C* Finding Primes Examples:
- click for CSTAR Primes Source Code:
primes.cs
- click for CSTAR Primes Compiler Brief Output:
primes-cs.lis
- click for CM-5 Primes Output:
primes-cs.out
Usage Notes:
- Copy `cp primes.cs ~/scratch2/pgm.cs',
- Change to scratch directory `cd ~/scratch2',
- Compile `cs -cm5 -vu -o run pgm.cs >& pgm.lis&'
- And If "Done", Use DJM script: `jsub cm5jsub.run' Above on cm5 to Execute;
(note the the script merely schedules the excutable in the queues)
- Else If "Exit", look at compiler listing: `vi pgm.lis',
- Find Errors,
- Correct Source,
- Remove or Rename Compiler Listing: `rm pgm.lis',
- And ReCompile.
- Output can be examined by `vi pgm.out'.
TMC Getting Started in C*, Chapter 6 Sample Programs:
- click for Sample Programs in Postscript of Chapter:
Sample_Programs_In_C*_Chapter.ps
Contains C* Programs on
- Julia Sets (Conversion of CMX_display to UIC Graphics Needed; Uses SHAPE,
PCOORD, WHERE, and WITH)
- Prime Number Sieve (Uses BOOL, WHILE, WHERE, SHAPE and WITH;
See Class Version Above)
- Perfect Shuffle (Not Very Complicated; Uses SHAPE, WITH and PCOORD)
TMC Getting Started in CM Fortran, Chapter 5 Sample Programs:
- click for Sample Programs in Postscript of Chapter:
Sample_Programs_In_FCM_Chapter.ps
Contains CM Fortran Programs on
- Histograms (F77 and CMF Versions, Latter Demonstrating FORALL Loops)
- Convolution in 1Dim Over 2Dim (CMF Version Uses FORALL and EOSHIFT)
- Prime Number Sieve (CMF Versions Use DOWHILE, FORALL and WHILE;
See Class Modifications Above)
- Laplace Solver (Uses Masks, DO WHILE, CSHIFT, MAXVAL and WHERE;
See Class Modifications Above)
TMC Getting Started Example Program Source Codes:
- On the CM-5 change directory using `cd /usr/examples' and
Search the Directory of Interest:
- cmf (CM Fortran Examples Source Codes)
- cstar (C* Examples Source Codes)
- cmssl (CM Scientific Subroutine Library Example Source Codes)