Programming
Compilers Available
- FORTRAN
- gfortran - GNU FORTRAN 95 compiler
- g95 - FORTRAN 95 compiler
- ifort - Intel FORTRAN compiler - Linux PCs only
- C
- gcc - GNU C compiler
- icc - Intel C compiler
- C++
- g++ - GNU C++ compiler
- icpc - Intel C++ compiler
- Pascal
- ppc386 - free pascal compiler available on the Linux PCs only
- p2c - pascal to C convert
Debuggers Available
- gdb - GNU debugger
- ddd - Data Display Debugger
- idb - Intel Debugger
Using NAG Libraries
The usage of the NAG libraries in this department and the university in general is on the decline. After significant effort a new 3 year deal was taken out which runs until July 2013. This covers the use of the NAG libraries on the departmental Linux systems only.
NAG Matlab Toolbox
This is now part of our standard matlab install so no special procedure is needed anymore to use it.
You use the nag functions and routines in broadly the same way as you would within a FORTRAN programme, e.g.
a00aa - reports the version of the NAG library used
a00ac - returns 1 if a license is available
s07aa(x) - returns the value of tan(x)
NAG FORTRAN
Note as of version 23 NAG have merged the FORTRAN77 and FORTRAN90 library into a single library package.
There are two versions of the NAG FORTRAN library on the system.
Using GNU gfortran compiler
Using the gfortran compiler a typical compile command for FORTRAN77 code would be
gfortran -o myexec prog.f -lnag -lpthread -Wl,-rpath,/opt/nagfl/rtl
Using the gfortran compiler a typical compile command for FORTRAN90 code would be
gfortran -o myexec prog.f -lnag -lpthread -Wl,-rpath,/opt/nagfl/rtl -I/opt/nagfl/nag_interface_blocks/gfortran
Using Intel ifort compiler
Using the ifort compiler a typical compile command for FORTRAN77 code would be
ifort -o myexec prog.f -lnag_nag -lpthread -Wl,-rpath,/opt/nagfl/rtl -Wl,-rpath,/opt/nagfl/lib/ifort
Using the ifort compiler a typical compile command for FORTRAN90 code would be
ifort -o myexec prog.f -lnag_nag -lpthread -Wl,-rpath,/opt/nagfl/rtl -Wl,-rpath,/opt/nagfl/lib/ifort -I/opt/nagfl/nag_interface_blocks/ifort
To run the program you will need to first specify the license server, see below.
NAG C
Typical compile command would be
gcc -I/opt/nagcl/include -o myexec prog.c -lnagc -lm -lpthread
To run the program you will need to first specify the license server, see below.
Specifying the NAG license server
The binary produced from compiling checks for a valid NAG library license when run. To specify the license server:
-
setenv NAG_KUSARI_FILE licenses.maths.ox.ac.uk:7733 -
If you have an newer account using a bash shell:
export NAG_KUSARI_FILE=licenses.maths.ox.ac.uk:7733
Running programs
- My program's going to take a long time. How do I leave it running when I'm not logged in, and how can I find out if it's finished when I log in next?
- How can I get my program to take input from a file rather than me typing it in? How can I get it to send output to a file rather than the screen?
- How can I time how long it takes for my program to run?
- What is the autonicer?
