Running python scripts with snipersim

36 views
Skip to first unread message

khyati

unread,
Jan 1, 2025, 4:18:59 AMJan 1
to Sniper simulator
Hi,

I am trying to run a python program that imports torch through snipersim, but getting some errors. If anyone has faced something similar and figured a way out, it would be helpful.

Please find the details below:

Here is an example program and the command I used to run it:

test.py  
 import torch
 a = torch.zeros(10000)
 torch.set_num_threads(4)
 a += 1
 print(sum(a))


sniper command
run-sniper -n 4 -c gainestown --no-cache-warming   --roi  -- python  test.py

Error I :
[SNIPER] Start
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Sniper using SIFT/trace-driven frontend
[SNIPER] Running pre-ROI region in  FAST_FORWARD mode
[SNIPER] Running application ROI in DETAILED mode
[SNIPER] Running post-ROI region in FAST_FORWARD mode
[SNIPER] --------------------------------------------------------------------------------
[RECORD-TRACE] Using the SDE frontend (sift/recorder)
[SIFT_RECORDER] Failed to print backtrace.
[SIFT_RECORDER] Internal exception:Exception Code: ACCESS_INVALID_ADDRESS. Exception Address = 0x7f982c425de4. Access Type: UNKNOWN. Access Address = 0x000000001
In:
Thread: 0
PID: 532700
SYSTEM TID: 532700
Exception code: ACCESS_INVALID_ADDRESS
Exception Class: 2
Faulty AccessType : 0
Exception address: 0x7f982c425de4
C: [tid:532700] Tool (or Pin) caused signal 11 at PC 0x7f982c425de4
[SIFT:0] Error: No such file or directory
[TRACE:0] -- DONE --

Now, If I try putting BeginROI() after import torch, I get the following error :

Error II:
[SNIPER] Setting instrumentation mode to DETAILED
[SIFT_RECORDER] Failed to print backtrace.
[SIFT_RECORDER] Internal exception:Exception Code: ACCESS_INVALID_ADDRESS. Exception Address = 0x7f452197bde4. Access Type: UNKNOWN. Access Address = 0x000000001
In:
Thread: 0
PID: 474490
SYSTEM TID: 474490
Exception code: ACCESS_INVALID_ADDRESS
Exception Class: 2
Faulty AccessType : 0
Exception address: 0x7f452197bde4
C: [tid:474490] Tool (or Pin) caused signal 11 at PC 0x7f452197bde4
[SIFT] sift_reader.cc:687: const Sift::StaticInstruction* Sift::Reader::getStaticInstruction(uint64_t, uint8_t): Assertion `sinst->size == size' failed.

Thank you!

-Khyati

Abhishek kumar

unread,
Jan 1, 2025, 7:29:09 AMJan 1
to Sniper simulator
Hi Khyati

you are using python script , so how you have added ROI() markers in .py file that matters , as these APIs are written in C++ files so in order to use them in your .py file, you need to use some sort of binding proprly.

khyati

unread,
Jan 3, 2025, 12:52:58 AMJan 3
to Sniper simulator

Thanks Abhishek. I have verified that my BeginROI() works properly with python codes that don't use torch. The issue is with "import torch". 
The other discussions in the group related to similar issue are from Sniper 7.3, wondering if there are any latest updates to sniper that makes it easier to run python programs with torch in a given conda environment.

-Khyati

Reply all
Reply to author
Forward
0 new messages