#!/usr/bin/perl -w
################################################################################
# Perl script to compile F90 code with Intel MKL_VSL support. The command line
# is a bit complicated. This script is to make it clear so that I can manage it
# later on.
# by qtl Yu
# May 21, 2009
################################################################################
use strict;
my $cmd="ifort";
my $oopt=" -xK -w -w95 -fpp1 -vec-report0";
#Path names
my $mklpath="/opt/intel/Compiler/11.0/081/mkl";
my $mkllib="$mklpath/lib/32";
my $mklinc="$mklpath/include";
#I put the mod files below, so that no need to include 'mkl_vml.fi' every time
my $module="-module /pathto/mod";
#It was recommended to link dynamically, so included *.so here
my $leading="-Wl,--start-group";
my $intel="$mkllib/libmkl_intel.so";
my $thread="$mkllib/libmkl_intel_thread.so";
my $core="$mkllib/libmkl_core.so";
my $ending="-Wl,--end-group";
my $so="$leading $intel $thread $core $ending";
my $lm="-lm"; #link in the math support system library
my $pthread="-lpthread"; #For Linux, and must be the last option
my $linux="-liomp5 $pthread $lm";
system "$cmd @ARGV $oopt $module -I$mklinc $so -L$mkllib $linux";
################################################################################
# References: Use mkl example complile command line info
# Will do a 64 version later on. Changing the path name would be enough.
################################################################################