Created
June 10, 2013 13:58
-
-
Save bayerj/5748900 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /Users/bayerj/devel/Theano/theano/compile/function.pyc in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input) | |
| 204 allow_input_downcast=allow_input_downcast, | |
| 205 on_unused_input=on_unused_input, | |
| --> 206 profile=profile) | |
| 207 # We need to add the flag check_aliased inputs if we have any mutable or | |
| 208 # borrowed used defined inputs | |
| /Users/bayerj/devel/Theano/theano/compile/pfunc.pyc in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input) | |
| 480 return orig_function(inputs, cloned_outputs, mode, | |
| 481 accept_inplace=accept_inplace, name=name, profile=profile, | |
| --> 482 on_unused_input=on_unused_input) | |
| 483 | |
| 484 | |
| /Users/bayerj/devel/Theano/theano/compile/function_module.pyc in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input) | |
| 1425 profile=profile, | |
| 1426 on_unused_input=on_unused_input).create( | |
| -> 1427 defaults) | |
| 1428 | |
| 1429 t2 = time.time() | |
| /Users/bayerj/devel/Theano/theano/compile/function_module.pyc in create(self, input_storage, trustme) | |
| 1253 # Get a function instance | |
| 1254 start_linker = time.time() | |
| -> 1255 _fn, _i, _o = self.linker.make_thunk(input_storage=input_storage_lists) | |
| 1256 end_linker = time.time() | |
| 1257 | |
| /Users/bayerj/devel/Theano/theano/gof/link.pyc in make_thunk(self, profiler, input_storage, output_storage) | |
| 378 return self.make_all(profiler = profiler, | |
| 379 input_storage = input_storage, | |
| --> 380 output_storage = output_storage)[:3] | |
| 381 | |
| 382 def make_all(self, profiler, input_storage, output_storage): | |
| /Users/bayerj/devel/Theano/theano/gof/vm.pyc in make_all(self, profiler, input_storage, output_storage) | |
| 794 compute_map, | |
| 795 no_recycling) | |
| --> 796 for node in order] | |
| 797 | |
| 798 computed, last_user = link.gc_helper(order) | |
| /Users/bayerj/devel/Theano/theano/gof/op.pyc in make_thunk(self, node, storage_map, compute_map, no_recycling) | |
| 577 logger.debug('Trying CLinker.make_thunk') | |
| 578 outputs = cl.make_thunk(input_storage=node_input_storage, | |
| --> 579 output_storage=node_output_storage) | |
| 580 fill_storage, node_input_filters, node_output_filters = outputs | |
| 581 | |
| /Users/bayerj/devel/Theano/theano/gof/cc.pyc in make_thunk(self, input_storage, output_storage, keep_lock) | |
| 909 cthunk, in_storage, out_storage, error_storage = self.__compile__( | |
| 910 input_storage, output_storage, | |
| --> 911 keep_lock=keep_lock) | |
| 912 | |
| 913 res = _CThunk(cthunk, init_tasks, tasks, error_storage) | |
| /Users/bayerj/devel/Theano/theano/gof/cc.pyc in __compile__(self, input_storage, output_storage, keep_lock) | |
| 852 input_storage, | |
| 853 output_storage, | |
| --> 854 keep_lock=keep_lock) | |
| 855 return (thunk, | |
| 856 [link.Container(input, storage) for input, storage in | |
| /Users/bayerj/devel/Theano/theano/gof/cc.pyc in cthunk_factory(self, error_storage, in_storage, out_storage, keep_lock) | |
| 1276 else: | |
| 1277 module = get_module_cache().module_from_key( | |
| -> 1278 key=key, fn=self.compile_cmodule_by_step, keep_lock=keep_lock) | |
| 1279 | |
| 1280 vars = self.inputs + self.outputs + self.orphans | |
| /Users/bayerj/devel/Theano/theano/gof/cmodule.pyc in module_from_key(self, key, fn, keep_lock, key_data) | |
| 961 # The module should be returned by the last | |
| 962 # step of the compilation. | |
| --> 963 module = compile_steps.next() | |
| 964 except StopIteration: | |
| 965 break | |
| /Users/bayerj/devel/Theano/theano/gof/cc.pyc in compile_cmodule_by_step(self, location) | |
| 1198 lib_dirs=self.lib_dirs(), | |
| 1199 libs=libs, | |
| -> 1200 preargs=preargs) | |
| 1201 except Exception, e: | |
| 1202 e.args += (str(self.fgraph),) | |
| /Users/bayerj/devel/Theano/theano/gof/cmodule.pyc in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs) | |
| 1615 # difficult to read. | |
| 1616 raise Exception('Compilation failed (return status=%s): %s' % | |
| -> 1617 (status, compile_stderr.replace('\n', '. '))) | |
| 1618 elif config.cmodule.compilation_warning and compile_stderr: | |
| 1619 # Print errors just below the command line. | |
| Exception: ('Compilation failed (return status=1): In file included from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/ndarraytypes.h:1736,. from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/ndarrayobject.h:17,. from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/arrayobject.h:4,. from /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp:3:. /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION". /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp: In member function \xe2\x80\x98int __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0::run()\xe2\x80\x99:. /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp:258: error: pointer of type \xe2\x80\x98void *\xe2\x80\x99 used in arithmetic. ', '[Reshape{1}(<TensorType(float64, vector)>, TensorConstant{(1,) of 1})]') | |
| =============================== | |
| =============================== | |
| In file included from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/ndarraytypes.h:1736, | |
| from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/ndarrayobject.h:17, | |
| from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/arrayobject.h:4, | |
| from /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp:3: | |
| /Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" | |
| /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp: In member function ‘int __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0::run()’: | |
| /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp:258: error: pointer of type ‘void *’ used in arithmetic | |
| 00001 #include <Python.h> | |
| 00002 #include <iostream> | |
| 00003 #include <numpy/arrayobject.h> | |
| 00004 #include <math.h> | |
| 00005 #include <numpy/arrayscalars.h> | |
| 00006 ////////////////////// | |
| 00007 //// Support Code | |
| 00008 ////////////////////// | |
| 00009 | |
| 00010 | |
| 00011 struct __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0 { | |
| 00012 PyObject* __ERROR; | |
| 00013 | |
| 00014 PyObject* storage_V3; | |
| 00015 PyObject* storage_V5; | |
| 00016 PyObject* storage_V1; | |
| 00017 | |
| 00018 | |
| 00019 __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0() {} | |
| 00020 ~__struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0(void) { | |
| 00021 cleanup(); | |
| 00022 } | |
| 00023 | |
| 00024 int init(PyObject* __ERROR, PyObject* storage_V3, PyObject* storage_V5, PyObject* storage_V1) { | |
| 00025 Py_XINCREF(storage_V3); | |
| 00026 Py_XINCREF(storage_V5); | |
| 00027 Py_XINCREF(storage_V1); | |
| 00028 this->storage_V3 = storage_V3; | |
| 00029 this->storage_V5 = storage_V5; | |
| 00030 this->storage_V1 = storage_V1; | |
| 00031 int __failure = 0; | |
| 00032 | |
| 00033 { | |
| 00034 | |
| 00035 { | |
| 00036 | |
| 00037 { | |
| 00038 | |
| 00039 this->__ERROR = __ERROR; | |
| 00040 return 0; | |
| 00041 __label_5: | |
| 00042 | |
| 00043 double __DUMMY_5; | |
| 00044 | |
| 00045 } | |
| 00046 __label_3: | |
| 00047 | |
| 00048 double __DUMMY_3; | |
| 00049 | |
| 00050 } | |
| 00051 __label_1: | |
| 00052 | |
| 00053 double __DUMMY_1; | |
| 00054 | |
| 00055 } | |
| 00056 | |
| 00057 Py_XDECREF(this->storage_V3); | |
| 00058 Py_XDECREF(this->storage_V5); | |
| 00059 Py_XDECREF(this->storage_V1); | |
| 00060 | |
| 00061 if (__failure) { | |
| 00062 // When there is a failure, this code puts the exception | |
| 00063 // in __ERROR. | |
| 00064 PyObject* err_type = NULL; | |
| 00065 PyObject* err_msg = NULL; | |
| 00066 PyObject* err_traceback = NULL; | |
| 00067 PyErr_Fetch(&err_type, &err_msg, &err_traceback); | |
| 00068 if (!err_type) {err_type = Py_None;Py_INCREF(Py_None);} | |
| 00069 if (!err_msg) {err_msg = Py_None; Py_INCREF(Py_None);} | |
| 00070 if (!err_traceback) {err_traceback = Py_None; Py_INCREF(Py_None);} | |
| 00071 PyObject* old_err_type = PyList_GET_ITEM(__ERROR, 0); | |
| 00072 PyObject* old_err_msg = PyList_GET_ITEM(__ERROR, 1); | |
| 00073 PyObject* old_err_traceback = PyList_GET_ITEM(__ERROR, 2); | |
| 00074 PyList_SET_ITEM(__ERROR, 0, err_type); | |
| 00075 PyList_SET_ITEM(__ERROR, 1, err_msg); | |
| 00076 PyList_SET_ITEM(__ERROR, 2, err_traceback); | |
| 00077 {Py_XDECREF(old_err_type);} | |
| 00078 {Py_XDECREF(old_err_msg);} | |
| 00079 {Py_XDECREF(old_err_traceback);} | |
| 00080 } | |
| 00081 // The failure code is returned to index what code block failed. | |
| 00082 return __failure; | |
| 00083 | |
| 00084 } | |
| 00085 void cleanup(void) { | |
| 00086 __label_1: | |
| 00087 | |
| 00088 double __DUMMY_1; | |
| 00089 __label_3: | |
| 00090 | |
| 00091 double __DUMMY_3; | |
| 00092 __label_5: | |
| 00093 | |
| 00094 double __DUMMY_5; | |
| 00095 | |
| 00096 Py_XDECREF(this->storage_V3); | |
| 00097 Py_XDECREF(this->storage_V5); | |
| 00098 Py_XDECREF(this->storage_V1); | |
| 00099 } | |
| 00100 int run(void) { | |
| 00101 int __failure = 0; | |
| 00102 | |
| 00103 PyObject* py_V1; | |
| 00104 | |
| 00105 PyArrayObject* V1; | |
| 00106 int type_num_V1; | |
| 00107 typedef npy_float64 dtype_V1; | |
| 00108 | |
| 00109 PyObject* py_V3; | |
| 00110 | |
| 00111 PyArrayObject* V3; | |
| 00112 int type_num_V3; | |
| 00113 typedef npy_float64 dtype_V3; | |
| 00114 | |
| 00115 PyObject* py_V5; | |
| 00116 | |
| 00117 PyArrayObject* V5; | |
| 00118 int type_num_V5; | |
| 00119 typedef npy_int64 dtype_V5; | |
| 00120 | |
| 00121 { | |
| 00122 | |
| 00123 py_V1 = PyList_GET_ITEM(storage_V1, 0); | |
| 00124 {Py_XINCREF(py_V1);} | |
| 00125 | |
| 00126 if (py_V1 == Py_None) | |
| 00127 { | |
| 00128 | |
| 00129 V1 = NULL; | |
| 00130 type_num_V1 = NPY_FLOAT64; | |
| 00131 | |
| 00132 } | |
| 00133 else | |
| 00134 { | |
| 00135 | |
| 00136 V1 = NULL; | |
| 00137 if (py_V1 == Py_None) { | |
| 00138 // We can either fail here or set V1 to NULL and rely on Ops | |
| 00139 // using tensors to handle the NULL case, but if they fail to do so | |
| 00140 // they'll end up with nasty segfaults, so this is public service. | |
| 00141 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); | |
| 00142 {__failure = 2; goto __label_2;} | |
| 00143 } | |
| 00144 if (!PyArray_Check(py_V1)) { | |
| 00145 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); | |
| 00146 {__failure = 2; goto __label_2;} | |
| 00147 } | |
| 00148 // We expect NPY_FLOAT64 | |
| 00149 type_num_V1 = ((PyArrayObject*)py_V1)->descr->type_num; | |
| 00150 if (!PyArray_ISALIGNED(py_V1)) { | |
| 00151 PyErr_Format(PyExc_NotImplementedError, | |
| 00152 "expected an aligned array of type %d " | |
| 00153 "(NPY_FLOAT64), got non-aligned array of type %d", | |
| 00154 NPY_FLOAT64, type_num_V1); | |
| 00155 {__failure = 2; goto __label_2;} | |
| 00156 } | |
| 00157 // This is a TypeError to be consistent with DEBUG_MODE | |
| 00158 // Note: DEBUG_MODE also tells the name of the container | |
| 00159 if (type_num_V1 != NPY_FLOAT64) { | |
| 00160 PyErr_Format(PyExc_TypeError, | |
| 00161 "expected type_num %d (NPY_FLOAT64) got %d", | |
| 00162 NPY_FLOAT64, type_num_V1); | |
| 00163 {__failure = 2; goto __label_2;} | |
| 00164 } | |
| 00165 V1 = (PyArrayObject*)(py_V1); | |
| 00166 Py_XINCREF(V1); | |
| 00167 | |
| 00168 } | |
| 00169 | |
| 00170 { | |
| 00171 | |
| 00172 py_V3 = PyList_GET_ITEM(storage_V3, 0); | |
| 00173 {Py_XINCREF(py_V3);} | |
| 00174 | |
| 00175 V3 = NULL; | |
| 00176 if (py_V3 == Py_None) { | |
| 00177 // We can either fail here or set V3 to NULL and rely on Ops | |
| 00178 // using tensors to handle the NULL case, but if they fail to do so | |
| 00179 // they'll end up with nasty segfaults, so this is public service. | |
| 00180 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); | |
| 00181 {__failure = 4; goto __label_4;} | |
| 00182 } | |
| 00183 if (!PyArray_Check(py_V3)) { | |
| 00184 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); | |
| 00185 {__failure = 4; goto __label_4;} | |
| 00186 } | |
| 00187 // We expect NPY_FLOAT64 | |
| 00188 type_num_V3 = ((PyArrayObject*)py_V3)->descr->type_num; | |
| 00189 if (!PyArray_ISALIGNED(py_V3)) { | |
| 00190 PyErr_Format(PyExc_NotImplementedError, | |
| 00191 "expected an aligned array of type %d " | |
| 00192 "(NPY_FLOAT64), got non-aligned array of type %d", | |
| 00193 NPY_FLOAT64, type_num_V3); | |
| 00194 {__failure = 4; goto __label_4;} | |
| 00195 } | |
| 00196 // This is a TypeError to be consistent with DEBUG_MODE | |
| 00197 // Note: DEBUG_MODE also tells the name of the container | |
| 00198 if (type_num_V3 != NPY_FLOAT64) { | |
| 00199 PyErr_Format(PyExc_TypeError, | |
| 00200 "expected type_num %d (NPY_FLOAT64) got %d", | |
| 00201 NPY_FLOAT64, type_num_V3); | |
| 00202 {__failure = 4; goto __label_4;} | |
| 00203 } | |
| 00204 V3 = (PyArrayObject*)(py_V3); | |
| 00205 Py_XINCREF(V3); | |
| 00206 | |
| 00207 { | |
| 00208 | |
| 00209 py_V5 = PyList_GET_ITEM(storage_V5, 0); | |
| 00210 {Py_XINCREF(py_V5);} | |
| 00211 | |
| 00212 V5 = NULL; | |
| 00213 if (py_V5 == Py_None) { | |
| 00214 // We can either fail here or set V5 to NULL and rely on Ops | |
| 00215 // using tensors to handle the NULL case, but if they fail to do so | |
| 00216 // they'll end up with nasty segfaults, so this is public service. | |
| 00217 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); | |
| 00218 {__failure = 6; goto __label_6;} | |
| 00219 } | |
| 00220 if (!PyArray_Check(py_V5)) { | |
| 00221 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); | |
| 00222 {__failure = 6; goto __label_6;} | |
| 00223 } | |
| 00224 // We expect NPY_INT64 | |
| 00225 type_num_V5 = ((PyArrayObject*)py_V5)->descr->type_num; | |
| 00226 if (!PyArray_ISALIGNED(py_V5)) { | |
| 00227 PyErr_Format(PyExc_NotImplementedError, | |
| 00228 "expected an aligned array of type %d " | |
| 00229 "(NPY_INT64), got non-aligned array of type %d", | |
| 00230 NPY_INT64, type_num_V5); | |
| 00231 {__failure = 6; goto __label_6;} | |
| 00232 } | |
| 00233 // This is a TypeError to be consistent with DEBUG_MODE | |
| 00234 // Note: DEBUG_MODE also tells the name of the container | |
| 00235 if (type_num_V5 != NPY_INT64) { | |
| 00236 PyErr_Format(PyExc_TypeError, | |
| 00237 "expected type_num %d (NPY_INT64) got %d", | |
| 00238 NPY_INT64, type_num_V5); | |
| 00239 {__failure = 6; goto __label_6;} | |
| 00240 } | |
| 00241 V5 = (PyArrayObject*)(py_V5); | |
| 00242 Py_XINCREF(V5); | |
| 00243 | |
| 00244 { | |
| 00245 | |
| 00246 assert (PyArray_NDIM(V5) == 1); | |
| 00247 npy_intp new_dims[1]; | |
| 00248 PyArray_Dims newshape; | |
| 00249 newshape.ptr = new_dims; | |
| 00250 newshape.len = 1; | |
| 00251 for (int ii = 0; ii < 1; ++ii) | |
| 00252 { | |
| 00253 // -- We do not want an explicit cast here. the shp can be any | |
| 00254 // -- int* dtype. The compiler will explicitly upcast it, but | |
| 00255 // -- will err if this will downcast. This could happen if the | |
| 00256 // -- user pass an int64 dtype, but npy_intp endup being int32. | |
| 00257 new_dims[ii] = ((dtype_V5*)( | |
| 00258 PyArray_DATA(V5) + ii * PyArray_STRIDES(V5)[0]))[0]; | |
| 00259 } | |
| 00260 Py_XDECREF(V1); | |
| 00261 V1 = (PyArrayObject *) PyArray_Newshape(V3, &newshape, | |
| 00262 PyArray_CORDER); | |
| 00263 if (!V1) | |
| 00264 { | |
| 00265 PyErr_Format(PyExc_ValueError, | |
| 00266 "Could not reshape array."); | |
| 00267 {__failure = 7; goto __label_7;}; | |
| 00268 } | |
| 00269 __label_7: | |
| 00270 | |
| 00271 double __DUMMY_7; | |
| 00272 | |
| 00273 } | |
| 00274 __label_6: | |
| 00275 | |
| 00276 if (V5) { | |
| 00277 Py_XDECREF(V5); | |
| 00278 } | |
| 00279 | |
| 00280 {Py_XDECREF(py_V5);} | |
| 00281 | |
| 00282 double __DUMMY_6; | |
| 00283 | |
| 00284 } | |
| 00285 __label_4: | |
| 00286 | |
| 00287 if (V3) { | |
| 00288 Py_XDECREF(V3); | |
| 00289 } | |
| 00290 | |
| 00291 {Py_XDECREF(py_V3);} | |
| 00292 | |
| 00293 double __DUMMY_4; | |
| 00294 | |
| 00295 } | |
| 00296 __label_2: | |
| 00297 | |
| 00298 if (!__failure) { | |
| 00299 | |
| 00300 {Py_XDECREF(py_V1);} | |
| 00301 if (!V1) { | |
| 00302 Py_INCREF(Py_None); | |
| 00303 py_V1 = Py_None; | |
| 00304 } | |
| 00305 else if ((void*)py_V1 != (void*)V1) { | |
| 00306 py_V1 = (PyObject*)V1; | |
| 00307 } | |
| 00308 {Py_XINCREF(py_V1);} | |
| 00309 | |
| 00310 PyObject* old = PyList_GET_ITEM(storage_V1, 0); | |
| 00311 {Py_XINCREF(py_V1);} | |
| 00312 PyList_SET_ITEM(storage_V1, 0, py_V1); | |
| 00313 {Py_XDECREF(old);} | |
| 00314 } | |
| 00315 | |
| 00316 if (V1) { | |
| 00317 Py_XDECREF(V1); | |
| 00318 } | |
| 00319 | |
| 00320 {Py_XDECREF(py_V1);} | |
| 00321 | |
| 00322 double __DUMMY_2; | |
| 00323 | |
| 00324 } | |
| 00325 | |
| 00326 | |
| 00327 if (__failure) { | |
| 00328 // When there is a failure, this code puts the exception | |
| 00329 // in __ERROR. | |
| 00330 PyObject* err_type = NULL; | |
| 00331 PyObject* err_msg = NULL; | |
| 00332 PyObject* err_traceback = NULL; | |
| 00333 PyErr_Fetch(&err_type, &err_msg, &err_traceback); | |
| 00334 if (!err_type) {err_type = Py_None;Py_INCREF(Py_None);} | |
| 00335 if (!err_msg) {err_msg = Py_None; Py_INCREF(Py_None);} | |
| 00336 if (!err_traceback) {err_traceback = Py_None; Py_INCREF(Py_None);} | |
| 00337 PyObject* old_err_type = PyList_GET_ITEM(__ERROR, 0); | |
| 00338 PyObject* old_err_msg = PyList_GET_ITEM(__ERROR, 1); | |
| 00339 PyObject* old_err_traceback = PyList_GET_ITEM(__ERROR, 2); | |
| 00340 PyList_SET_ITEM(__ERROR, 0, err_type); | |
| 00341 PyList_SET_ITEM(__ERROR, 1, err_msg); | |
| 00342 PyList_SET_ITEM(__ERROR, 2, err_traceback); | |
| 00343 {Py_XDECREF(old_err_type);} | |
| 00344 {Py_XDECREF(old_err_msg);} | |
| 00345 {Py_XDECREF(old_err_traceback);} | |
| 00346 } | |
| 00347 // The failure code is returned to index what code block failed. | |
| 00348 return __failure; | |
| 00349 | |
| 00350 } | |
| 00351 }; | |
| 00352 | |
| 00353 | |
| 00354 int __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0_executor(__struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0* self) { | |
| 00355 return self->run(); | |
| 00356 } | |
| 00357 | |
| 00358 void __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0_destructor(void* executor, void* self) { | |
| 00359 //printf("doing cleanup\n"); | |
| 00360 //fflush(stdout); | |
| 00361 // ((__struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0*)self)->cleanup(); | |
| 00362 // free(self); | |
| 00363 delete ((__struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0*)self); | |
| 00364 //printf("done cleanup\n"); | |
| 00365 //fflush(stdout); | |
| 00366 } | |
| 00367 | |
| 00368 ////////////////////// | |
| 00369 //// Functions | |
| 00370 ////////////////////// | |
| 00371 static PyObject * instantiate(PyObject * self, PyObject *argtuple) { | |
| 00372 assert(PyTuple_Check(argtuple)); | |
| 00373 if (4 != PyTuple_Size(argtuple)){ | |
| 00374 PyErr_Format(PyExc_TypeError, "Wrong number of arguments, expected 4, got %i", (int)PyTuple_Size(argtuple)); | |
| 00375 return NULL; | |
| 00376 } | |
| 00377 __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0* struct_ptr = new __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0(); | |
| 00378 struct_ptr->init( PyTuple_GET_ITEM(argtuple, 0),PyTuple_GET_ITEM(argtuple, 1),PyTuple_GET_ITEM(argtuple, 2),PyTuple_GET_ITEM(argtuple, 3) ); | |
| 00379 PyObject* thunk = PyCObject_FromVoidPtrAndDesc((void*)(&__struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0_executor), struct_ptr, __struct_compiled_op_858dd591ed2d07a98d0869d94f54cca0_destructor); | |
| 00380 return thunk; } | |
| 00381 | |
| 00382 ////////////////////// | |
| 00383 //// Module init | |
| 00384 ////////////////////// | |
| 00385 static PyMethodDef MyMethods[] = { | |
| 00386 {"instantiate", instantiate, METH_VARARGS, "undocumented"} , | |
| 00387 {NULL, NULL, 0, NULL} | |
| 00388 }; | |
| 00389 PyMODINIT_FUNC init858dd591ed2d07a98d0869d94f54cca0(void){ | |
| 00390 import_array(); | |
| 00391 (void) Py_InitModule("858dd591ed2d07a98d0869d94f54cca0", MyMethods); | |
| 00392 } | |
| 00393 | |
| Problem occurred during compilation with the command line below: | |
| g++ -dynamiclib -g -O3 -Wno-write-strings -Wno-unused-label -Wno-unused-variable -fno-math-errno -fPIC -undefined dynamic_lookup -m64 -I/Library/Python/2.7/site-packages/numpy-1.8.0.dev_dff8c94_20130602-py2.7-macosx-10.8-intel.egg/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/858dd591ed2d07a98d0869d94f54cca0.so /Users/bayerj/.theano/compiledir_Darwin-12.2.0-x86_64-i386-64bit-i386-2.7.2/tmpupHBvi/mod.cpp -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment