Error of record-trace

316 views
Skip to first unread message

Xiaohang Wang

unread,
Nov 23, 2013, 8:16:09 AM11/23/13
to snip...@googlegroups.com
Hi there,

I have some problem when trying to record traces from pthread programs.
I'm using
./record-trace -o hellotrace -- ./helloworld

And get the following error
In main: creating thread 0
[SIFT_RECORDER] recorder_control.cc:172: void openFile(LEVEL_VM::THREADID): Assertion `KnobUseResponseFiles.Value() != 0' failed.
Pin app terminated abnormally due to signal 6.


I used the following command to compilation.
 g++ -o helloworld helloworld.cpp -I/home/w/Qin/sniper/sniper-5.2/include -L/home/w/Qin/sniper/sniper-5.2/lib -lm -pthread -static

The helloworld.cpp is listed as follows.

Thanks
BR
Xiaohang


/******************************************************************************
 * FILE: hello.c
 * DESCRIPTION:
 *   A "hello world" Pthreads program.  Demonstrates thread creation and
 *   termination.
 * AUTHOR: Blaise Barney
 * LAST REVISED: 08/09/11
 ******************************************************************************/

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "sim_api.h"
using namespace std;
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
  long tid;
  tid = (long)threadid;
  printf("Hello World! It's me, thread #%ld!\n", tid);
  pthread_exit(NULL);
}

int main(int argc, char *argv[])
{
  pthread_t threads[NUM_THREADS];
  int rc;
  long t;
  vector <int> ss;
  ss.push_back(33);
  printf("number is %d \n", ss[0]);
  SimRoiStart();
  for(t=0;t<NUM_THREADS;t++){
    printf("In main: creating thread %ld\n", t);
    rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
    //SimRoiStart();
    if (rc){
      printf("ERROR; return code from pthread_create() is %d\n", rc);
      exit(-1);
    }
// SimRoiEnd();
  }

  /* Last thing that main() should do */
  //pthread_exit(NULL);
   SimRoiEnd();

}

Wim Heirman

unread,
Nov 23, 2013, 8:39:46 AM11/23/13
to snip...@googlegroups.com
Xiaohang,

We do not currently support recording traces from multithreaded programs. This is because on playback, traces will not be synchronized, leading to thread interleaving that does not correspond to what is representative for the original application. You can only use stored traces for single-threaded applications, for multi-threading you have to use execution-driven simulation with the regular Pin front-end.

Regards,
Wim




--
--
--
You received this message because you are subscribed to the Google
Groups "Sniper simulator" group.
To post to this group, send email to snip...@googlegroups.com
To unsubscribe from this group, send email to
snipersim+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/snipersim?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Sniper simulator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snipersim+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Trevor Carlson

unread,
Nov 23, 2013, 8:45:58 AM11/23/13
to baik...@gmail.com, snip...@googlegroups.com
Xiaohang,

     Unfortunately, we do not support recording trace files of multi-threaded programs, only single-threaded ones are supported. There is a good reason for this: recording a trace of a multi-threaded program would enforce a particular thread ordering and, while architecturally valid, it would also prevent timing-related thread reordering. This would be bad if you created a new micro-architectural tweak, but the application didn't get any faster because the thread ordering was fixed (while it might have seen a speedup if you allowed thread reordering). Therefore, we only support replaying multi-threaded applications in pin-mode, and not recording them.

Trevor
--

Xiaohang Wang

unread,
Nov 23, 2013, 8:58:12 AM11/23/13
to snip...@googlegroups.com, baik...@gmail.com

Thanks Trevor.
My concern is how we debug and develop (e.g., hack into) the simulator. Since gdb  cannot be attached with the pin frontend, how do I know if I'm writing something correct? :)
BR
Xiaohang

Trevor E. Carlson

unread,
Nov 23, 2013, 9:08:23 AM11/23/13
to baik...@gmail.com, snip...@googlegroups.com
Xiaohang,

GDB is supported in Sniper, as it is supported in the by the pin front-end. We have made it easy to get started with debugging Sniper. If you want to use GDB, then add the --gdb or --gdb-wait option to your Sniper command line. In addition, you can also add printouts to the code to monitor the progress of your application and print out the status as you develop. That usually works for me while I am developing new code.

Trevor

Xiaohang Wang

unread,
Nov 23, 2013, 9:17:13 AM11/23/13
to snip...@googlegroups.com, baik...@gmail.com
But when I tried with --gdb, pin does stop in the gdb prompt. However, the program finishes already, :(

Trevor E. Carlson

unread,
Nov 23, 2013, 9:22:41 AM11/23/13
to baik...@gmail.com, snip...@googlegroups.com

Xiaohang,

I would recommend that you take a look at the Sniper user manual [1], as all of the GDB options, and details one how to use it are listed there. You probably want to use the --gdb-wait option, to halt at the start of the program.

Trevor


Chapter 8.1.1 -- run-sniper

--gdb           Enable Pin tool debugging. Start executing the Pin tool right away
--gdb-wait      Enable Pin tool debugging. Halt when first attaching to the debugger
--gdb-quit      Enable Pin tool debugging. Automatically quit if no errors were detected
Reply all
Reply to author
Forward
0 new messages