Demonstrating instruction level parallelism at work
Question: I'm trying to show instruction level parallelism at work. What I was
originally doing was using python (willing to change) and doing the following:

    
    
    def test():
        for i in range(5000):
            j = 0
            k = 0
            l = 0
    
    def test2():
        for i in range(5000):
            j = i * i
            k = j * 2
            l = k * i
    
    if __name__=='__main__':
        from timeit import Timer
        t = Timer("test()", "from __main__ import test")
        print t.timeit()
        t2 = Timer("test2()", "from __main__ import test2")
        print t2.timeit()
    

However a professor tells me that this doesn't demonstrate ILP, rather it
shows whether the python interpreter is optimized or not.

What is it that I can do to demonstrate working ILP?


Answer: Your professor is correct. I think an acceptable demonstration would have to
be written in assembler, or at most C/C++, possibly using something like the
MMX instruction set.

