nschloe/perfplot

number of kernels cannot exceed 6

Closed this issue · 3 comments

When I try to do 7 kernels together.

import numpy
import perfplot

perfplot.show(
    setup=numpy.random.rand,
    kernels=[
        lambda a: numpy.c_[a, a],
        lambda a: numpy.stack([a, a]).T,
        lambda a: numpy.vstack([a, a]).T,
        lambda a: numpy.column_stack([a, a]),
        lambda a: numpy.concatenate([a[:, None], a[:, None]], axis=1),
        lambda a: numpy.c_[a, a],
        lambda a: numpy.stack([a, a]).T
        ],
    labels=['c_', 'stack', 'vstack', 'column_stack', 'concat', 'c_1', 'stack1'],
    n_range=[2**k for k in range(5)],
    xlabel='len(a)'
    )

I get this error:

IndexError                                Traceback (most recent call last)
<ipython-input-26-2c6678d2791b> in <module>()
     15     labels=['c_', 'stack', 'vstack', 'column_stack', 'concat', 'c_1', 'stack1'],
     16     n_range=[2**k for k in range(5)],
---> 17     xlabel='len(a)'
     18     )

/usr/local/lib/python3.6/dist-packages/perfplot/main.py in show(*args, **kwargs)
    208 
    209 def show(*args, **kwargs):
--> 210     out = bench(*args, **kwargs)
    211     out.show()
    212     return

/usr/local/lib/python3.6/dist-packages/perfplot/main.py in bench(setup, kernels, n_range, labels, colors, xlabel, title, target_time_per_measurement, logx, logy, automatic_order, equality_check)
    152 
    153     data = PerfplotData(
--> 154         n_range, timings, labels, colors, xlabel, title, logx, logy, automatic_order
    155     )
    156     return data

/usr/local/lib/python3.6/dist-packages/perfplot/main.py in __init__(self, n_range, timings, labels, colors, xlabel, title, logx, logy, automatic_order)
     50             self.timings = self.timings[order]
     51             self.labels = [self.labels[i] for i in order]
---> 52             self.colors = [self.colors[i] for i in order]
     53         return
     54 

/usr/local/lib/python3.6/dist-packages/perfplot/main.py in <listcomp>(.0)
     50             self.timings = self.timings[order]
     51             self.labels = [self.labels[i] for i in order]
---> 52             self.colors = [self.colors[i] for i in order]
     53         return
     54 

IndexError: list index out of range

If I use automatic_order = False, the error would not happen, but the result plot only show 6 of them.

I cannot reproduce the problem, and looking at the code I cannot see what this should occur. Are you running an old version of perfplot?

Closing for lack of feedback. Feel free to reopen at any time.

Sorry for the late feedback. You are right, I can't reproduce this error locally, including local Jubyter notebook. The error only happens on the colab.research.google.com platform. I install the perfplot using !pip install -U perfplot. I'm sharing this notebook:
https://colab.research.google.com/drive/1P_c8gI3sVjP30-bH0ezcs87USAOvb39I