(gdb) bt #0 0x00002af6047e4a4b in fgets () from /lib64/libc.so.6 #1 0x000000000040450a in LoadPPM (filename=0x407e63 "input_image.ppm", data=0x7ffecda55cc8, width=0x7ffecda55cc4, height=0x7ffecda55cc0) at SLIC_raw.cpp:692 #2 0x00000000004049e1 in main (argc=1, argv=0x7ffecda55de8) at SLIC_raw.cpp:794
python 程序
1 2 3 4 5 6 7
# add debug file for gdb cd /compile_path/build cp dbg/libtorch_npu.so.debug /path2conda/site-packages/torch_npu/lib # gdb need the same python env conda activate xxx gdb python core_xxx # bt
send but the same, more crazy thing is the -v and -d flag is not supported. and --debug-level=trace0 isn’t recognized. many same question in StackOverflow
sudo tail -n 30 /var/log/mail.log or mail.error show more info.
Create a Bash Script: Create a Bash script that checks the CPU usage and sends an email if it’s below 30%. For example, create a file named cpu_check.sh:
1 2 3 4 5 6 7 8 9 10 11
#!/bin/bash
# Get CPU usage percentage cpu_usage=$(top -b -n 1 | grep '%Cpu(s):' | awk '{print $2}' | cut -d'.' -f1) echo"cpu_usage : ${cpu_usage} on $(hostname)" # Check if CPU usage is below 30% if [ "$cpu_usage" -lt 30 ]; then echo"beyond threshold : ${cpu_usage} on " # Send an email echo"CPU usage is ${cpu_usage} below 30% on $(hostname)" | mail -s "Low CPU Usage Alert on $(hostname)"[email protected] fi
Schedule the Script: Use the cron scheduler to run the script at regular intervals. Edit your crontab by running:
1
crontab -e
Add an entry to run the script, for example, every 5 minutes:
1 2 3
*/5 * * * * /staff/shaojiemike/test/cpu_check.sh >> /staff/shaojiemike/test/cpu_check.log # Run every 15 minutes during working hours (9 am to 7 pm) */15 9-19 * * * /path/to/your/script.sh
Replace /path/to/cpu_check.sh with the actual path to your Bash script.
Save and Exit: Save the crontab file and exit the text editor.
Now, the script will run every 5 minutes (adjust the cron schedule as needed) and send an email notification if the CPU usage is below 50%. You should receive an email when the condition is met.
Please note that this is a basic example, and you can modify the script to include more details or customize the notification further as needed. Additionally, ensure that your server is configured to send emails; you may need to configure SMTP settings for the mail or sendmail command to work correctly.
pinbin: build/opt/zsim.cpp:816: LEVEL_BASE::VOID VdsoCallPoint(LEVEL_VM::THREADID): Assertion `vdsoPatchData[tid].level' failed. Pin app terminated abnormally due to signal 6.
vDSO (virtual dynamic shared object) is a kernel machanism for exporting a carefully set kernel space routines (eg. not secret api, gettid() and gettimeofday()) to user spapce to eliminate the performance penalty of user-kernel mode switch according to wiki. vDSO
// Instrumentation function, called for EVERY instruction VOID VdsoInstrument(INS ins) { ADDRINT insAddr = INS_Address(ins); //get ins addr if (unlikely(insAddr >= vdsoStart && insAddr < vdsoEnd)) { //INS is vdso syscall if (vdsoEntryMap.find(insAddr) != vdsoEntryMap.end()) { VdsoFunc func = vdsoEntryMap[insAddr]; //call VdsoEntryPoint function //argv are: tid ,func(IARG_UINT32),arg0(LEVEL_BASE::REG_RDI),arg1(LEVEL_BASE::REG_RSI) INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoEntryPoint, IARG_THREAD_ID, IARG_UINT32, (uint32_t)func, IARG_REG_VALUE, LEVEL_BASE::REG_RDI, IARG_REG_VALUE, LEVEL_BASE::REG_RSI, IARG_END); } elseif (INS_IsCall(ins)) { //call instruction INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoCallPoint, IARG_THREAD_ID, IARG_END); } elseif (INS_IsRet(ins)) { //Ret instruction INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR) VdsoRetPoint, IARG_THREAD_ID, IARG_REG_REFERENCE, LEVEL_BASE::REG_RAX /* return val */, IARG_END); } }
//Warn on the first vsyscall code translation if (unlikely(insAddr >= vsyscallStart && insAddr < vsyscallEnd && !vsyscallWarned)) { warn("Instrumenting vsyscall page code --- this process executes vsyscalls, which zsim does not virtualize!"); vsyscallWarned = true; } }
INS_Address is from pin-kit, but INS_InsertCall is pin api.
try:
.level is just show the level of nested vsyscall. I think comment the assert which trigerd when callfunc before entryfunc is just fun.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh # choose local path to install, maybe ~/.local # init = yes, will auto modified the .zshrc to add the miniconda to PATH
# If you'd prefer that conda's base environment not be activated on startup, # set the auto_activate_base parameter to false: conda config --set auto_activate_base false
you need to close all terminal(all windows in one section including all split windows), and reopen a terminal will take effect;
The double pipe (“||”) is a control operator that represents the logical OR operation. It is used to execute a command or series of commands only if the previous command or pipeline has failed or has returned a non-zero status code.