def _capture_showerror_for_last_julia_exception(self): msg = self.api.jl_eval_string(u""" try rethrow() catch ex sprint(showerror, ex, catch_backtrace()) end""".encode('utf-8')) return char_p(msg).value.decode("utf-8")
def BuildProgram(program, devices, options=None): if options is not None: options = char_p(options.encode('utf-8')) num_devices = len(devices) dev_array = (device * num_devices)() for i, dev in enumerate(devices): dev_array[i] = dev lib_BuildProgram(program, num_devices, dev_array, options, None, None)
def _typeof_julia_exception_in_transit(self): exception = void_p.in_dll(self.api, 'jl_exception_in_transit') msg = self.api.jl_typeof_str(exception) return char_p(msg).value
def _unwrap_exception(self, jl_exc): exception = void_p.in_dll(self.api, 'jl_exception_in_transit') msg = self.api.jl_typeof_str(exception) return char_p(msg).value
def CreateProgramWithSource(context, source): source = source.encode() return lib_CreateProgramWithSource(context, 1, char_p(source), None, byref(ERROR()))