make_cmd 3.67 KB
Newer Older
Femi Kadri's avatar
Femi Kadri committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
#!/bin/tcsh

#HERE IS HOW TO COMPILE:
#./make_cmd sooner
#or 
#./make_cmd lonestar
#(depending on the machine)

set cluster_name = "${1}"
echo 'cluster_name = '$cluster_name

set compile_for_tau_profiling = "${2}"
echo 'tau_profiling = '$compile_for_tau_profiling



if (${compile_for_tau_profiling} == "tau") then

  module load tau
  echo 'FINISHED LOADING Tau Module'
 
  setenv TAU_OPTIONS "-optVerbose -optPreProcess -optComInst"
  setenv TAU_MAKEFILE "$TACC_TAU_LIB/Makefile.tau-multiplecounters-icpc-mpi-papi-pdt"

  setenv COUNTER1 "GET_TIME_OF_DAY"
  echo 'COUNTER1 = $COUNTER1'
# setenv COUNTER1 "PAPI_TOT_CYC #(total cycle)"
  setenv COUNTER2 "PAPI_FP_INS"
#  setenv COUNTER2 "PAPI_FP_OPS"
  echo 'COUNTER2 = $COUNTER2'
# setenv COUNTER3 "PAPI_L1_TCM"
  setenv COUNTER3 "PAPI_L2_TCM"
  echo 'COUNTER3 = $COUNTER3'

  echo 'FINISHED setting Tau Environment Variables '

endif #${compile_for_tau_profiling} == "tau"

#CLEAR COMPILER VARIABLES, JUST IN CASE
setenv F90 ""
setenv CC ""
setenv MPCC ""


setenv MPI_COMPILER "intel"
#setenv MPI_COMPILER "pgi"
#setenv MPI_COMPILER "nag"
setenv MPI_INTERCONNECT "ib"
#setenv MPI_INTERCONNECT "p4"
#setenv MPI_VENDOR "openmpi"

dos2unix lsf_chain.tcsh
chmod 755 lsf_chain.tcsh 

mkdir debug
mkdir backup
mkdir results
mkdir results_LST
mkdir results_LBM
mkdir results_LBM/stresses

chmod 755 lsf* *cmd

mpicc -c timer.c

if ((${MPI_COMPILER} == "intel") || (${MPI_COMPILER} == "intel9")) then

  if( ${cluster_name} == "sooner"  ) then
      
      #make OPTFLAGS="-O3 -march=core2 -mtune=core2 -shared-intel" # Intel on sooner
      make OPTFLAGS="-warn interface -O3 -fpe0 -traceback -C -march=core2 -mtune=core2 -shared-intel" # Intel debug on sooner	
      #make OPTFLAGS="-O3 -march=core2 -mtune=core2 -shared-intel" # Intel debug on sooner
      

  else if ( ${cluster_name} == "lonestar"  ) then

        if (${compile_for_tau_profiling} == "tau") then
              
              #define Tau compilers
              setenv F90 "tau_f90.sh"
              setenv CC "tau_cc.sh"
              setenv MPCC "tau_cc.sh"
              make OPTFLAGS="-I. -g -O2 -xT" # Intel tau profiling on lonestar      
 
        else #${compile_for_tau_profiling} != "tau"

              #make OPTFLAGS="-O3 -xT -shared-intel" # Intel no debug on lonestar
              make OPTFLAGS="-warn interface -C -fpe0 -traceback -xT -shared-intel" # Intel debug on lonestar

        endif #${compile_for_tau_profiling} == "tau"
      
  else if ( ${cluster_name} == "ranger"  ) then
     module swap pgi intel
     make OPTFLAGS="-O3 -xW -shared-intel" # Intel no debug on lonestar
     #make OPTFLAGS="-warn interface -C -fpe0 -traceback -xW -shared-intel -fp-stack-check" # Intel debug on ranger
     #make OPTFLAGS="-fast -tp barcelona-64 -mp" # PGI no debug on ranger
     #make OPTFLAGS="-fast -tp barcelona-64 -mp -g -gopt -Mbounds -Mchkptr -Mchkfpstk -Mchkstk" # PGI debug on ranger

  else if ( ${cluster_name} == "stampede" ) then

     #make OPTFLAGS="-O3 -shared-intel" #Intel no debug on stampede
     make OPTFLAGS="-warn interface -C -fpe0 -traceback -shared-intel -fp-stack-check" #Intel debug on stampede

  else

      echo 'cluster_name NOT RECOGNIZED. NOTHING TO DO... EXITING'
      exit 1

  endif #${cluster_name} ==...
      
 
else if (${MPI_COMPILER} == "pgi") then
  
  #make OPTFLAGS="-fastsse -tp=core2-64" # PGI on sooner
  make OPTFLAGS="-g -gopt -Mbounds -Mchkptr -Mchkfpstk -Mchkstk -fastsse -tp=core2-64" # PGI debug on sooner

else if ((${MPI_COMPILER} == "gcc") || (${MPI_COMPILER} == "gnu")) then
  
  make OPTFLAGS="-O -ffixed-line-length-none -ffree-form " # GNU

else if (${MPI_COMPILER} == "nag") then
  
  make OPTFLAGS="-O -free -dusty" # GNU

endif # (${MPI_COMPILER == "nag")