def c_cleanup(self, name, sub): """ Return C code to clean up after `c_extract`. This returns C code that should deallocate whatever `c_extract` allocated or decrease the reference counts. Do not decrease py_%(name)s's reference count. WRITEME Parameters ---------- name : WRITEME WRITEME sub : WRITEME WRITEME Raises ------ MethodNotDefined Subclass does not implement this method. """ raise MethodNotDefined()
def c_code_cleanup(self, node, name, inputs, outputs, sub): """ Stitches all the macros and "code_cleanup" together """ if "code_cleanup" in self.code_sections: op_code = self.code_sections["code_cleanup"] def_macros, undef_macros = self.get_c_macros(node, name) def_sub, undef_sub = self.get_sub_macros(sub) def_io, undef_io = self.get_io_macros(inputs, outputs) return "\n".join( [ def_macros, def_sub, def_io, op_code, undef_io, undef_sub, undef_macros, ] ) else: raise MethodNotDefined("c_code_cleanup", type(self), type(self).__name__)
def __hide(*args): raise MethodNotDefined()
def c_headers(self): if pygpu.get_default_context().kind == 'opencl': raise MethodNotDefined('cuda only') return ['cuda.h', '<numpy_compat.h>', '<gpuarray_helper.h>', '<gpuarray/types.h>']
def f(self): if tag in self.code_sections: return self.code_sections[tag] else: raise MethodNotDefined("c_" + tag, type(self), type(self).__name__)