Exemplo n.º 1
0
 def run(self):
     for case, plan in self.plan.items():
         tag_list = plan['tags']
         MetricType.init_taichi(self.arch, tag_list)
         _ms = self.funcs.get_func(tag_list)(self.arch,
                                             self.basic_repeat_times,
                                             **self._get_kwargs(tag_list))
         plan['result'] = _ms
         print(f'{tag_list}={_ms}')
         ti.reset()
     rdict = {'results': self.plan, 'info': self.info}
     return rdict
Exemplo n.º 2
0
 def __init__(self, arch: str):
     super().__init__('math_ops', arch, basic_repeat_times=10)
     math_dtype = DataType()
     math_dtype.remove_integer()
     self.create_plan(MathOps(), math_dtype, ElementNum(), ForLoopCycle(),
                      MetricType())
     self.add_func(['element16384'], unary_ops_throughput_default)
Exemplo n.º 3
0
 def __init__(self, arch: str):
     super().__init__('matrix_ops', arch, basic_repeat_times=10)
     dtype = DataType()
     dtype.remove(['i64', 'f64'])
     self.create_plan(MatrixOps(), BlockMN(), ElementNum(), dtype,
                      MetricType())
     self.add_func(['element16384'], matrix_operations_default)
Exemplo n.º 4
0
 def __init__(self, arch: str):
     super().__init__('fill', arch, basic_repeat_times=10)
     fill_container = Container()
     fill_container.update({'sparse': None})  # None: implement by feature
     self.create_plan(fill_container, DataType(), DataSize(), MetricType())
     # use tag_list to label the customized implementation (funcs).
     self.add_func(['field'], fill_default)
     self.add_func(['ndarray'], fill_default)
     self.add_func(['sparse'], fill_sparse)
Exemplo n.º 5
0
 def __init__(self, arch: str):
     super().__init__('atomic_ops', arch, basic_repeat_times=10)
     atomic_ops = AtomicOps()
     atomic_ops.remove(
         ['atomic_sub', 'atomic_and', 'atomic_xor', 'atomic_max'])
     self.create_plan(atomic_ops, Container(), DataType(), DataSize(),
                      MetricType())
     self.add_func(['field'], reduction_default)
     self.add_func(['ndarray'], reduction_default)
Exemplo n.º 6
0
 def __init__(self, arch: str):
     super().__init__('stencil_2d', arch, basic_repeat_times=10)
     container = Container()
     container.update({'sparse': None})  # None: implement by feature
     self.create_plan(Scatter(), BloclLocalStorage(), container, DataType(),
                      DataSize2D(), MetricType())
     # no use for field & ndarray
     self.remove_cases_with_tags(['field', 'bls1'])
     self.remove_cases_with_tags(['ndarray', 'bls1'])
     self.add_func(['field'], stencil_2d_default)
     self.add_func(['ndarray'], stencil_2d_default)
     self.add_func(['sparse'], stencil_2d_sparse_bls)
Exemplo n.º 7
0
 def __init__(self, arch: str):
     super().__init__('memcpy', arch, basic_repeat_times=10)
     self.create_plan(Container(), DataType(), DataSize(), MetricType())
     self.add_func(['field'], memcpy_default)
     self.add_func(['ndarray'], memcpy_default)