matthiasdiener / numalize

Detect memory access patterns of parallel applications
GNU General Public License v2.0
19 stars 7 forks source link

not found libelf.a #2

Open ZYX223 opened 4 years ago

ZYX223 commented 4 years ago

my pin version is pin-3.11-97998-g7ecce2dac-gcc-linux, and I don't find the libelf.a in /intel64/lib-ext/libelf.a

as the makefile is

TOOL_CXXFLAGS += -Wall -g -std=c++0x -Wno-error -Wextra -Wno-unused-parameter -pedantic -lelf
# TOOL_LIBS += -lelf
TOOL_LIBS += /opt/pin-2.14-67254-gcc.4.4.7-linux/intel64/lib-ext/libelf.a

TOOL_ROOTS := numalize

include $(TOOLS_ROOT)/Config/makefile.default.rules
matthiasdiener commented 4 years ago

I think you have to install libelf on your system.

I.e., you should uncomment the # TOOL_LIBS += -lelf line, and remove the TOOL_LIBS += /opt/pin-2.14-67254-gcc.4.4.7-linux/intel64/lib-ext/libelf.a line. Then install libelf on your system.

ZYX223 commented 4 years ago

include

include

int main() { // insert code here... int b = 3; int a = 0;

pragma omp parallel private(a)

a = b;
return 0;

} I tested the example using the above code. And I got the result is 2377 | 192093 | 159938 | 159501 | 243496 | 0 4945 | 221325 | 184076 | 216486 | 0 | 243496 4505 | 215635 | 205506 | 0 | 216486 | 159501 1965 | 220351 | 0 | 205506 | 184076 | 159938 5788 | 0 | 220351 | 215635 | 221325 | 192093 0 | 5788 | 1965 | 4505 | 4945 | 2377

I think this communication value is too large , and how to define communication between threads?

ZYX223 commented 4 years ago

Excuse me

// adjust thread ID for extra internal Pin thread that this tool creates static inline THREADID real_tid(THREADID tid) { return tid >= 2 ? tid-1 : tid; }

What does the "real_tid" mean, why tid hasn't the value 1?

matthiasdiener commented 4 years ago

Excuse me

// adjust thread ID for extra internal Pin thread that this tool creates static inline THREADID real_tid(THREADID tid) { return tid >= 2 ? tid-1 : tid; }

What does the "real_tid" mean, why tid hasn't the value 1?

As indicated in the comment, numalize creates an extra Pin thread for the periodic output of data. This extra thread always has TID 1 and is not instrumented. real_tid converts the TID reported by Pin to the TID as seen by the application, by adjusting the TID, ie.:

TID 0 -> real_tid 0
TID 2 -> real_tid 1
TID 3 -> real_tid 2

etc.

matthiasdiener commented 4 years ago

include

include

int main() { // insert code here... int b = 3; int a = 0;

pragma omp parallel private(a)

a = b; return 0; } I tested the example using the above code. And I got the result is 2377 | 192093 | 159938 | 159501 | 243496 | 0 4945 | 221325 | 184076 | 216486 | 0 | 243496 4505 | 215635 | 205506 | 0 | 216486 | 159501 1965 | 220351 | 0 | 205506 | 184076 | 159938 5788 | 0 | 220351 | 215635 | 221325 | 192093 0 | 5788 | 1965 | 4505 | 4945 | 2377

I think this communication value is too large , and how to define communication between threads?

I think thats fine. The communication probably comes from memory accesses inside the external libraries (e.g. libomp). Note that depending on your value for comm_shift, you might also count false sharing here.

ZYX223 commented 4 years ago

Thanks for your answer.And now I want to know a communication's timestamp between threads, and how to implement it?

ZYX223 commented 4 years ago

static inline UINT64 get_tsc() {

if defined(i386) || defined(x86_64__)

    unsigned int lo, hi;
    __asm__ __volatile__ (
        "cpuid \n"
        "rdtsc"
        : "=a"(lo), "=d"(hi) /* outputs */
        : "a"(0)             /* inputs */
        : "%ebx", "%ecx");   /* clobbers*/
  return ((UINT64)lo) | (((UINT64)hi) << 32);
#elif defined(__ia64)
    UINT64 r;
    __asm__ __volatile__ ("mov %0=ar.itc" : "=r" (r) :: "memory");
    return r;
#elif defined(__powerpc__)
    UINT64 hi, lo, tmp;
    __asm__ volatile(
        "0:\n"
        "mftbu   %0 \n"
        "mftb    %1 \n"
        "mftbu   %2 \n"
        "cmpw    %2,%0 \n"
        "bne     0b \n"
        : "=r"(hi),"=r"(lo),"=r"(tmp) );
    return ((UINT64)lo) | (((UINT64)hi) << 32);
#else
    #error "architecture not supported"
#endif

}

Is the "get_tsc()" function count the timestamp?

matthiasdiener commented 4 years ago

Yes, you could use the output of get_tsc as a way to maintain timestamps.

ZYX223 commented 4 years ago

KNOB COMMSIZE(KNOB_MODE_WRITEONCE, "pintool", "cs", "6", "comm shift in bits");

I read your paper "Communication in Shared Memory: Concepts, Definitions, and Efficient Detection" recently, and I want to know that if I want to set the cache line to 64 bytes ,I should set the COMMSIZE to 6 as the above code shown.Is that right?

And another question is how to use the CacheSim at https://github.com/matthiasdiener/CacheSim, I have make it.

Thanks.

matthiasdiener commented 4 years ago

KNOB COMMSIZE(KNOB_MODE_WRITEONCE, "pintool", "cs", "6", "comm shift in bits");

I read your paper "Communication in Shared Memory: Concepts, Definitions, and Efficient Detection" recently, and I want to know that if I want to set the cache line to 64 bytes ,I should set the COMMSIZE to 6 as the above code shown.Is that right?

Yes, that's right, since 2^6=64.

And another question is how to use the CacheSim at https://github.com/matthiasdiener/CacheSim, I have make it.

I think you can run it in the same way as numalize.

ZYX223 commented 4 years ago

Ok,I have run the CacheSIm,it seems not to trace communication between threads.I think I should modify it. What's value "get_tsc()" returned represents, how much will it increase in one second?

matthiasdiener commented 4 years ago

get_tsc() just returns the value of the CPU's time stamp counter (e.g. https://en.wikipedia.org/wiki/Time_Stamp_Counter)

For CacheSim, you probably need to use the comm branch.

ZYX223 commented 4 years ago

Thanks,I have run the CacheSim using the comm branch, and do you know how to count the communications between threads using a INTERVAL as the same in numalize?

KNOB INTERVAL(KNOB_MODE_WRITEONCE, "pintool", "i", "1", "print interval (ms) (0=disable)");

When I try to use the INTERVAL in CacheSim, I meet the problem: C: Tool (or Pin) caused signal 11 at PC 0x7f3e8c8fc594 Command terminated by signal 11

matthiasdiener commented 4 years ago

Thanks,I have run the CacheSim using the comm branch, and do you know how to count the communications between threads using a INTERVAL as the same in numalize?

KNOB INTERVAL(KNOB_MODE_WRITEONCE, "pintool", "i", "1", "print interval (ms) (0=disable)");

When I try to use the INTERVAL in CacheSim, I meet the problem: C: Tool (or Pin) caused signal 11 at PC 0x7f3e8c8fc594 Command terminated by signal 11

I don't think this interval feature is implemented in CacheSim, only in numalize.