def get_ctypes_func_and_args(self, arrays): fist_array = arrays[0] shape = fist_array.shape for variable, array in zip(self.variables, arrays): for dim, extent in enumerate(array.shape): if extent != shape[dim] and extent != 1: raise ValueError("Differing extents in dim %d (%s, %s)" % (dim, extent, shape[dim])) args = [fist_array.ctypes.shape] for variable, array in zip(self.variables, arrays): if variable.type.is_array: data_pointer = get_data_pointer(array, variable.type) args.append(data_pointer) if not self.specializer.is_contig_specializer: args.append(array.ctypes.strides) else: raise NotImplementedError return args
def get_ctypes_func_and_args(self, arrays): from ctypes_conversion import get_data_pointer fist_array = arrays[0] shape = fist_array.shape for variable, array in zip(self.variables, arrays): for dim, extent in enumerate(array.shape): if extent != shape[dim] and extent != 1: raise ValueError("Differing extents in dim %d (%s, %s)" % (dim, extent, shape[dim])) args = [fist_array.ctypes.shape] for variable, array in zip(self.variables, arrays): if variable.type.is_array: data_pointer = get_data_pointer(array, variable.type) args.append(data_pointer) if not self.specializer.is_contig_specializer: args.append(array.ctypes.strides) else: raise NotImplementedError return args
def getfunc(self): ctypes_func, variables, specializer, llvm_func = self.map() fist_array = variables[0].value shape = fist_array.shape for variable in variables: for dim, extent in enumerate(variable.value.shape): if extent != shape[dim] and extent != 1: raise ValueError("Differing extents in dim %d (%s, %s)" % (dim, extent, shape[dim])) args = [fist_array.ctypes.shape] for variable in variables: if variable.type.is_array: numpy_array = variable.value data_pointer = get_data_pointer(numpy_array, variable.type) args.append(data_pointer) if not specializer.is_contig_specializer: args.append(numpy_array.ctypes.strides) else: raise NotImplementedError return ctypes_func, args