On Libra, how can I link a C job to the IMSL C Library and execute it?
Define environment variables
Before compiling, linking, and running a C program using the IMSL C/Stat or C/Math Library on the Libra Cluster at Indiana University, you must define several environment variables, as follows:
- If you are using
csh, enter the following at the Unix system prompt: source /software/libapps/imsl50/imsl.csh - If you are using
kshorbash, enter the following at the Unix system prompt: . /software/libapps/imsl50/imsl.sh
You can add these lines to your .login file (for
csh users) or .profile file (for
ksh or bash users) to automatically activate
the environment variables every time you log in.
Link and run
To link and run your C program invoking a C function from the IMSL C/Library (Stat or Math), at the system prompt, enter:
$CC -o filename filename.c $IMSLC ./filenameReplace filename.c with the name of the file that
contains your C code that invokes the IMSL C/Library. Replace
filename with an appropriate name to store the compiled
and executable programs. To run the program, enter the name of the
executable program (i.e., filename). For example, if you
have a file named imslcstat1.c which contains codes to
invoke the IMSL C/Library, at the system prompt, enter:
You will see the output on the screen. If you want to save the output to a file, replace the last line with the following:
./imslcstat1 > imslcstat1.outSample programs
The IMSL installation on Libra comes bundled with example programs. To try them, enter one of the following:
$CC $CFLAGS -o cmath /software/libapps/imsl50/CTT5.0/examples/rs6000/cnl/validate/cmath.c $LINK_CNL ./cmath $CC $CFLAGS -o cstat /software/libapps/imsl50/CTT5.0/examples/rs6000/cnl/validate/cstat.c $LINK_CNL ./cstatThe expected output is explained in
/software/libapps/imsl50/CTT5.0/examples/rs6000/cnl/validate/README.
Note: For more details about the IMSL, NAG, and other subroutine libraries (including information about how to compile, link to, and run programs that invoke them), see the IU High Performance Applications subroutine library page.
For a list of research software available on UITS research computing systems, see:
- Big Red: http://rc.uits.iu.edu/hps/research/bigred/software.shtml
- Libra: http://rc.uits.iu.edu/hps/research/libra/Libra_software.shtml
- Quarry: http://rc.uits.iu.edu/hps/research/quarry/software.shtml
Also see:
- In Unix, how should I submit CPU-intensive jobs?
- How do I run stat/math jobs, including SAS and SPSS, under AIX LoadLeveler?
- When compiling a C program in Unix, why do I get "ld: Unresolved:"?
- At IU, what software is available on the research computing systems, and how may I request that software be added?
- On Libra, how can I access IMSL online help?
- In Unix, what is chsh, and how do I use it to change my shell?
Last modified on January 15, 2008.






