Advertisement
Guest User

Untitled

a guest
Oct 29th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.05 KB | None | 0 0
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 2003-2013 Intel Corporation. All rights reserved.
  4. #
  5. # The information and source code contained herein is the exclusive property
  6. # of Intel Corporation and may not be disclosed, examined, or reproduced in
  7. # whole or in part without explicit written authorization from the Company.
  8. #
  9.  
  10. CPRO_PATH=/opt/intel/composer_xe_2013_sp1.0.080
  11. export MKLROOT=${CPRO_PATH}/mkl
  12.  
  13. SCRIPT_NAME=$0
  14. MOD_NAME=mod
  15.  
  16. MKL_LP64_ILP64=
  17. MKL_MOD=
  18. MKL_TARGET_ARCH=
  19. MKL_VERBOSE=
  20. MKL_MIC_ARCH=
  21.  
  22. mkl_help() {
  23.     echo ""
  24.     echo "Syntax:"
  25.     echo "  $SCRIPT_NAME <arch> [MKL_interface] [${MOD_NAME}]"
  26.     echo ""
  27.     echo "   <arch> must be one of the following"
  28.     echo "       ia32         : Setup for IA-32 architecture"
  29.     echo "       intel64      : Setup for Intel(R) 64 architecture"
  30.     echo "       mic          : Setup for Intel(R) Many Integrated Core Architecture"
  31.     echo ""
  32.     echo "   ${MOD_NAME} (optional) - set path to MKL F95 modules"
  33.     echo ""
  34.     echo "   MKL_interface (optional) - MKL programming interface for intel64"
  35.     echo "                              Not applicable without ${MOD_NAME}"
  36.     echo "       lp64         : 4 bytes integer (default)"
  37.     echo "       ilp64        : 8 bytes integer"
  38.     echo ""
  39. }
  40.  
  41. if [ -z "$1" ] ; then
  42.     mkl_help
  43. else
  44.  
  45.     MKL_BAD_SWITCH=
  46.     while [ -n "$1" ]; do
  47.        if   [ "$1" = "ia32" ]        ; then MKL_TARGET_ARCH=ia32;
  48.        elif [ "$1" = "intel64" ]     ; then MKL_TARGET_ARCH=intel64; MKL_MIC_ARCH=mic;
  49.        elif [ "$1" = "mic" ]         ; then MKL_TARGET_ARCH=mic;     MKL_MIC_ARCH=mic;
  50.        elif [ "$1" = "lp64" ]        ; then MKL_LP64_ILP64=lp64;
  51.        elif [ "$1" = "ilp64" ]       ; then MKL_LP64_ILP64=ilp64;
  52.        elif [ "$1" = "${MOD_NAME}" ] ; then MKL_MOD=${MOD_NAME};
  53.        elif [ "$1" = "verbose" ]     ; then MKL_VERBOSE=verbose;
  54.        else
  55.            MKL_BAD_SWITCH=$1
  56.            break 10
  57.        fi
  58.        shift;
  59.     done
  60.  
  61.     if [ -n "${MKL_BAD_SWITCH}" ] ; then
  62.  
  63.         echo
  64.         echo "ERROR: Unknown option '${MKL_BAD_SWITCH}'"
  65.         mkl_help
  66.  
  67.     else
  68.  
  69.         if [ -z "${MKL_TARGET_ARCH}" ] ; then
  70.  
  71.             echo
  72.             echo "ERROR: architecture is not defined. Accepted values: ia32, intel64, mic"
  73.             mkl_help
  74.  
  75.         else
  76.  
  77.             if [ -n "${LD_LIBRARY_PATH}" ] ; then OLD_LD_LIBRARY_PATH=":${LD_LIBRARY_PATH}"; fi
  78.             export LD_LIBRARY_PATH="${CPRO_PATH}/compiler/lib/${MKL_TARGET_ARCH}:${MKLROOT}/lib/${MKL_TARGET_ARCH}${OLD_LD_LIBRARY_PATH}"
  79.             if [ -n "${MKL_MIC_ARCH}" ]; then
  80.                 if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then
  81.                     export LD_LIBRARY_PATH="${CPRO_PATH}/compiler/lib/intel64:${MKLROOT}/lib/intel64:${LD_LIBRARY_PATH}"
  82.                 fi
  83.                 if [ -d "/opt/intel/mic" ]; then
  84.                     export LD_LIBRARY_PATH="/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:${LD_LIBRARY_PATH}"
  85.                 fi
  86.             fi
  87.  
  88.             if [ -n "${LIBRARY_PATH}" ] ; then OLD_LIBRARY_PATH=":${LIBRARY_PATH}"; fi
  89.             if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then
  90.                export LIBRARY_PATH="${CPRO_PATH}/compiler/lib/intel64:${MKLROOT}/lib/intel64${OLD_LIBRARY_PATH}"
  91.             else
  92.                export LIBRARY_PATH="${CPRO_PATH}/compiler/lib/${MKL_TARGET_ARCH}:${MKLROOT}/lib/${MKL_TARGET_ARCH}${OLD_LIBRARY_PATH}"
  93.             fi
  94.  
  95.             if [ -n "${MKL_MIC_ARCH}" ]; then
  96.                 if [ -n "${MIC_LD_LIBRARY_PATH}" ]; then OLD_MIC_LD_LIBRARY_PATH=":${MIC_LD_LIBRARY_PATH}"; fi
  97.                 export MIC_LD_LIBRARY_PATH="${CPRO_PATH}/compiler/lib/${MKL_MIC_ARCH}:${MKLROOT}/lib/${MKL_MIC_ARCH}${OLD_MIC_LD_LIBRARY_PATH}"
  98.                 if [ -d "/opt/intel/mic" ]; then
  99.                     export MIC_LD_LIBRARY_PATH="/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:${MIC_LD_LIBRARY_PATH}"
  100.                 fi
  101.             fi
  102.  
  103.             if [ -n "${NLSPATH}" ] ; then OLD_NLSPATH=":${NLSPATH}"; fi
  104.  
  105.             export NLSPATH="${MKLROOT}/lib/${MKL_TARGET_ARCH}/locale/%l_%t/%N${OLD_NLSPATH}"
  106.             if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then
  107.                 export NLSPATH="${MKLROOT}/lib/intel64/locale/%l_%t/%N:${NLSPATH}"
  108.             fi
  109.  
  110.             if [ -z "${MANPATH}" ] ; then
  111.                 export MANPATH="${CPRO_PATH}/man/en_US:`manpath`"
  112.             else
  113.                 export MANPATH="${CPRO_PATH}/man/en_US:${MANPATH}"
  114.             fi
  115.  
  116.             if [ -n "${INCLUDE}" ] ; then OLD_INCLUDE=":${INCLUDE}"; fi
  117.             export INCLUDE="${MKLROOT}/include${OLD_INCLUDE}"
  118.  
  119.             if  [ -n "$CPATH" ] ; then OLD_CPATH=":${CPATH}"; fi
  120.             export CPATH="${MKLROOT}/include${OLD_CPATH}"
  121.  
  122.             if [ "${MKL_MOD}" = "${MOD_NAME}" ] ; then
  123.                 if [ "${MKL_TARGET_ARCH}" = "ia32" ] ; then
  124.                     MKL_LP64_ILP64=
  125.                 else
  126.                     if [ -z "$MKL_LP64_ILP64" ] ; then
  127.                         MKL_LP64_ILP64=lp64
  128.                     fi
  129.                 fi
  130.                 export INCLUDE="${INCLUDE}:${MKLROOT}/include/${MKL_TARGET_ARCH}/${MKL_LP64_ILP64}"
  131.                 if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then
  132.                     export INCLUDE="${INCLUDE}:${MKLROOT}/include/intel64/${MKL_LP64_ILP64}"
  133.                 fi
  134.             fi
  135.  
  136.             if [ "${MKL_VERBOSE}" = "verbose" ] ; then
  137.                 echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
  138.                 echo LIBRARY_PATH=${LIBRARY_PATH}
  139.                 echo MIC_LD_LIBRARY_PATH=${MIC_LD_LIBRARY_PATH}
  140.                 echo NLSPATH=${NLSPATH}
  141.                 echo MANPATH=${MANPATH}
  142.                 echo INCLUDE=${INCLUDE}
  143.                 echo CPATH=${CPATH}
  144.             fi
  145.         fi
  146.     fi
  147. fi
  148.  
  149. # Clean up of internal settings
  150. unset CPRO_PATH
  151. unset SCRIPT_NAME
  152. unset MOD_NAME
  153. unset MKL_LP64_ILP64
  154. unset MKL_MOD
  155. unset MKL_TARGET_ARCH
  156. unset MKL_VERBOSE
  157. unset MKL_MIC_ARCH
  158. unset MKL_BAD_SWITCH
  159. unset OLD_LD_LIBRARY_PATH
  160. unset OLD_LIBRARY_PATH
  161. unset OLD_MIC_LD_LIBRARY_PATH
  162. unset OLD_NLSPATH
  163. unset OLD_INCLUDE
  164. unset OLD_CPATH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement