JEANZAY.cpu_info.sh 6.41 KB
Newer Older
1 2 3
#!/bin/bash


4 5 6
#===============================================================================
#   Commandes suivi de job   (Partie commune IRENE & IRENE-AMD)
#===============================================================================
7

8
# argument:  jobid
9 10 11 12 13 14 15 16 17

verbose=false

if [ -z ${SLURM_JOB_ID+x} ]; then
   running=false
else
   running=true
fi

18
printf "running = ${running}\n"
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
printf "verbose = ${verbose}\n"


printf "\n\n  pour avoir des infos sur un job en cours d'execution : \n"
printf "               sacct - displays accounting data for all jobs and job steps in the Slurm job accounting log or Slurm database\n"
printf "                    avec 'sacct -e' et 'man sacct' pour la liste des infos disponibles\n"
printf "               scontrol show job JOBID\n"


printf "\n\n  pour avoir des infos sur un job pendant ou après : \n"
printf "               sstat - Display various status information of a running job/step\n"
printf "                    avec 'sstat -e' et 'man sstat' pour la liste des infos disponibles\n"


if [ "$#" == "1" ]; then 
   JOBID2=$1
   printf  "\n\nJOBID = ${JOBID2}\n\n"

   echo""
   get_Jobname=`sacct  -j ${JOBID2}  -X -n -P --format="Jobname"`
   echo "Jobname : ${get_Jobname}"

   echo""
   get_WorkDir=`sacct  -j ${JOBID2}  -X -n -P --format="WorkDir"`
   echo "WorkDir : ${get_WorkDir}"

   printf "\n\n> sacct -j ${JOBID2}\n\n"
                 sacct -j ${JOBID2}

   printf "\n\n> sacct -j ${JOBID2} -X --format='Cluster,JobID,JobName,State,Partition,QOS%%14,Account,User,ReqCPUS,AllocCPUS,AllocNodes,NodeList'\n\n"
                 sacct -j ${JOBID2} -X --format="Cluster,JobID,JobName,State,Partition,QOS%14,Account,User,ReqCPUS,AllocCPUS,AllocNodes,NodeList%25"

   printf "\n\n> sacct -j ${JOBID2} -X --format='CPUTime,CPUTimeRAW,Elapsed,Timelimit,TimelimitRaw,Submit%%22,Start%%22,End%%22'\n\n"
                 sacct -j ${JOBID2} -X --format="CPUTime,CPUTimeRAW,Elapsed,Timelimit,TimelimitRaw,Submit%22,Start%22,End%22"

   printf "\n\n> sacct -j ${JOBID2} -X -n -P --format='AllocTRES'\n\n"
                 sacct -j ${JOBID2} -X -n -P --format="AllocTRES"

   echo""
   echo""


   if ${verbose}; then
      printf "\n\n\nListe exhaustive des infos sur un jobid avec la commande sacct\n" 
      for option in "Account" \
      "AdminComment" \
      "AllocCPUS" \
      "AllocGRES" \
      "AllocNodes" \
      "AllocTRES" \
      "AssocID" \
      "AveCPU" \
      "AveCPUFreq" \
      "AveDiskRead" \
      "AveDiskWrite" \
      "AvePages" \
      "AveRSS" \
      "AveVMSize" \
      "BlockID" \
      "Cluster" \
      "Comment" \
      "ConsumedEnergy" \
      "ConsumedEnergyRaw" \
      "CPUTime" \
      "CPUTimeRAW" \
      "DerivedExitCode" \
      "Elapsed" \
      "ElapsedRaw" \
      "Eligible" \
      "End" \
      "ExitCode" \
      "GID" \
      "Group" \
      "JobID" \
      "JobIDRaw" \
      "JobName" \
      "Layout" \
      "MaxDiskRead" \
      "MaxDiskReadNode" \
      "MaxDiskReadTask" \
      "MaxDiskWrite" \
      "MaxDiskWriteNode" \
      "MaxDiskWriteTask" \
      "MaxPages" \
      "MaxPagesNode" \
      "MaxPagesTask" \
      "MaxRSS" \
      "MaxRSSNode" \
      "MaxRSSTask" \
      "MaxVMSize" \
      "MaxVMSizeNode" \
      "MaxVMSizeTask" \
      "McsLabel" \
      "MinCPU" \
      "MinCPUNode" \
      "MinCPUTask" \
      "NCPUS" \
      "NNodes" \
      "NodeList" \
      "NTasks" \
      "Priority" \
      "Partition" \
      "QOS" \
      "QOSRAW" \
      "ReqCPUFreq" \
      "ReqCPUFreqMin" \
      "ReqCPUFreqMax" \
      "ReqCPUFreqGov" \
      "ReqCPUS" \
      "ReqGRES" \
      "ReqMem" \
      "ReqNodes" \
      "ReqTRES" \
      "Reservation" \
      "ReservationId" \
      "Reserved" \
      "ResvCPU" \
      "ResvCPURAW" \
      "Start" \
      "State" \
      "Submit" \
      "Suspended" \
      "SystemCPU" \
      "SystemComment" \
      "Timelimit" \
      "TimelimitRaw" \
      "TotalCPU" \
      "TRESUsageInAve" \
      "TRESUsageInMax" \
      "TRESUsageInMaxNode" \
      "TRESUsageInMaxTask" \
      "TRESUsageInMin" \
      "TRESUsageInMinNode" \
      "TRESUsageInMinTask" \
      "TRESUsageInTot" \
      "TRESUsageOutAve" \
      "TRESUsageOutMax" \
      "TRESUsageOutMaxNode" \
      "TRESUsageOutMaxTask" \
      "TRESUsageOutMin" \
      "TRESUsageOutMinNode" \
      "TRESUsageOutMinTask" \
      "TRESUsageOutTot" \
      "UID" \
      "User" \
      "UserCPU" \
      "WCKey" \
      "WCKeyID" \
      "WorkDir";
      do
         get1=`sacct  -j ${JOBID2} -X -n -P --format="${option}"`
         echo "${option} : ${get1}"
      done
   fi

#  Pour un job en cours d'execution :
   if ${running}; then

177 178
      printf "\n> scontrol show job ${JOBID2}\n\n"
                  scontrol show job ${JOBID2}
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
   
#     printf "\n\n> sstat  -j ${JOBID2}\n\n"
#                   sstat  -j ${JOBID2}
   
   
      if ${verbose}; then
         printf "\n\n\nListe exhaustive des infos sur un jobid en cours d'execution avec la commande sstat\n"
         for option in "AveCPU" \
         "AveCPUFreq" \
         "AveDiskRead" \
         "AveDiskWrite" \
         "AvePages" \
         "AveRSS" \
         "AveVMSize" \
         "ConsumedEnergy" \
         "ConsumedEnergyRaw" \
         "JobID" \
         "MaxDiskRead" \
         "MaxDiskReadNode" \
         "MaxDiskReadTask" \
         "MaxDiskWrite" \
         "MaxDiskWriteNode" \
         "MaxDiskWriteTask" \
         "MaxPages" \
         "MaxPagesNode" \
         "MaxPagesTask" \
         "MaxRSS" \
         "MaxRSSNode" \
         "MaxRSSTask" \
         "MaxVMSize" \
         "MaxVMSizeNode" \
         "MaxVMSizeTask" \
         "MinCPU" \
         "MinCPUNode" \
         "MinCPUTask" \
         "Nodelist" \
         "NTasks" \
         "Pids" \
         "ReqCPUFreq" \
         "ReqCPUFreqMin" \
         "ReqCPUFreqMax" \
         "ReqCPUFreqGov" \
         "TRESUsageInAve" \
         "TRESUsageInMax" \
         "TRESUsageInMaxNode" \
         "TRESUsageInMaxTask" \
         "TRESUsageInMin" \
         "TRESUsageInMinNode" \
         "TRESUsageInMinTask" \
         "TRESUsageInTot" \
         "TRESUsageOutAve" \
         "TRESUsageOutMax" \
         "TRESUsageOutMaxNode" \
         "TRESUsageOutMaxTask" \
         "TRESUsageOutMin" \
         "TRESUsageOutMinNode" \
         "TRESUsageOutMinTask" \
         "TRESUsageOutTot";
         do
            get1=`sstat  -j ${JOBID2} -n -P --format="${option}"`
            echo "${option} : ${get1}"
         done
      fi
   fi


else
   printf "\n\n\n Passez le jobid en argument \n\n\n\n"
fi