Пример #1
0
    def _test_df_binary_operations(self,
                                   pyfunc,
                                   name,
                                   total_data_length,
                                   test_name=None,
                                   input_data=test_global_input_data_float64):
        np.random.seed(0)
        hpat_func = sdc.jit(pyfunc)
        for data_length in total_data_length:
            # TODO: replace with generic function to generate random sequence of floats
            data1 = np.random.ranf(data_length)
            data2 = np.random.ranf(data_length)
            A = pandas.DataFrame({f"f{i}": data1 for i in range(3)})
            B = pandas.DataFrame({f"f{i}": data2 for i in range(3)})

            compile_results = calc_compilation(pyfunc,
                                               A,
                                               B,
                                               iter_number=self.iter_number)

            # Warming up
            hpat_func(A, B)

            exec_times, boxing_times = get_times(hpat_func,
                                                 A,
                                                 B,
                                                 iter_number=self.iter_number)
            self.test_results.add(name,
                                  'JIT',
                                  A.size,
                                  exec_times,
                                  boxing_times,
                                  compile_results=compile_results,
                                  num_threads=self.num_threads)
            exec_times, _ = get_times(pyfunc,
                                      A,
                                      B,
                                      iter_number=self.iter_number)
            self.test_results.add(name,
                                  'Reference',
                                  A.size,
                                  exec_times,
                                  num_threads=self.num_threads)
Пример #2
0
    def _test_jitted(self, pyfunc, record, *args, **kwargs):
        # compilation time
        record["compile_results"] = calc_compilation(pyfunc, *args, **kwargs)

        cfunc = numba.njit(pyfunc)

        # Warming up
        cfunc(*args, **kwargs)

        # execution and boxing time
        record["test_results"], record["boxing_results"] = \
            get_times(cfunc, *args, **kwargs)
Пример #3
0
 def _test_python(self, pyfunc, record, *args, **kwargs):
     record["test_results"], _ = \
         get_times(pyfunc, *args, **kwargs)