The goal of the previous lab was to run an executable in batch mode. In this
section we will take a slight detour and use function calls to the Intel Math Kernel
Library (MKL) in a program. The codes in this section of the lab will not be used
for the remaining lab sections.
Prerequisites:
- Read the
Software module.
- You will need the following files, all copied from /ctc/vwlabs/Progressive
to $HOME/lab or ~<your_userid>/lab
in the first lab section:
- make file: makemklc or makemklf
- input file: cblas_dgemmx.d or dgemmx.d
- batch scripts:
- mklc.xml and mklc.sh or
- mklf.xml and mklf.sh
- source files:
- cblas_dgemmx.c and common_func.c or
- dgemmx.f and common_func.f
- .so files: libguide.so libimf.so libirc.so
Compiling and linking for Intel C/C++:
- Set up the environment for the Intel C compiler
- in bash: source /opt/intel/cc/9.1.045/bin/iccvars.sh
- in tcsh: source /opt/intel/cc/9.1.045/bin/iccvars.csh
- make -f makemklc
- You should have an executable cblas_dgemmx
Compiling and linking for Intel Fortran:
- Set up the environment for the Intel Fortran compiler
- in bash: source /opt/intel/fc/9.1.032/bin/ifortvars.sh
- in tcsh: source /opt/intel/fc/9.1.032/bin/ifortvars.csh
- make -f makemklf
- You should have an executable dgemmx
Run in Batch
- Review the script, mklc.sh or mklf.sh
- Submit batch job:
vsched -s mklc.xml or
vsched -s mklf.xml
Results
The batch scripts create a directory $HOME/lab/output into which
the output is copied.
C
Stdout and stderr are directed to cblas_dgemmx.stdout,
which should contain:
C B L A S _ D G E M M EXAMPLE PROGRAM
INPUT DATA
M=2 N=5 K=4
ALPHA= 0.5 BETA= -1.2
TRANSA = CblasTrans TRANSB = CblasTrans
ORDER = CblasRowMajor
ARRAY A LDA=2
1.500 2.220
6.300 9.000
1.000 -4.000
0.200 7.500
ARRAY B LDB=4
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
ARRAY C LDC=5
0.000 0.000 1.000 1.000 1.000
0.000 0.000 1.000 1.000 1.000
OUTPUT DATA
ARRAY C LDC=5
8.950 8.950 7.750 7.750 7.750
19.110 19.110 17.910 17.910 17.910
Fortran
Stdout and stderr are directed to dgemmx.stdout, which should contain:
D G E M M EXAMPLE PROGRAM
INPUT DATA
M=2 N=5 K=4
ALPHA= 0.50 BETA=-1.20
TRANSA=T TRANSB=T
ARRAY A LDA=4
1.500 2.220
6.300 9.000
1.000 -4.000
0.200 7.500
ARRAY B LDB=5
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
ARRAY C LDC=4
0.000 0.000 1.000 1.000 1.000
0.000 0.000 1.000 1.000 1.000
OUTPUT DATA
ARRAY C
8.950 8.950 7.750 7.750 7.750
19.110 19.110 17.910 17.910 17.910