Open GoingMyWay opened 7 years ago
Hi, I tried to install Theano followed by the instructions provided in the environment.yml.
environment.yml
$ pip install git+https://github.com/Theano/Theano.git@adfe319ce6b781083d8dc3200fb4481b00853791#egg=Theano Collecting Theano from git+https://github.com/Theano/Theano.git@adfe319ce6b781083d8dc3200fb4481b00853791#egg=Theano Cloning https://github.com/Theano/Theano.git (to adfe319ce6b781083d8dc3200fb4481b00853791) to /tmp/pip-build-k9injqf7/Theano Could not find a tag or branch 'adfe319ce6b781083d8dc3200fb4481b00853791', assuming commit. Requirement already satisfied: numpy>=1.7.1 in ./anaconda3/envs/rllab3/lib/python3.5/site-packages (from Theano) Requirement already satisfied: scipy>=0.11 in ./anaconda3/envs/rllab3/lib/python3.5/site-packages (from Theano) Requirement already satisfied: six>=1.9.0 in ./anaconda3/envs/rllab3/lib/python3.5/site-packages (from Theano) Installing collected packages: Theano Running setup.py install for Theano ... done Successfully installed Theano-0.9.0.dev1
However when I ran the example code, it reported the following issues
WARNING (theano.tensor.blas): We did not found a dynamic library into the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library. 00001 #include <Python.h> 00002 #include <iostream> 00003 #include "theano_mod_helper.h" 00004 #include <math.h> 00005 #include <numpy/arrayobject.h> 00006 #include <numpy/arrayscalars.h> 00007 #include <iostream> 00008 #include <time.h> 00009 #include <sys/time.h> 00010 ////////////////////// 00011 //// Support Code 00012 ////////////////////// 00013 00014 00015 extern "C" 00016 { 00017 00018 void xerbla_(char*, void *); 00019 00020 /***********/ 00021 /* Level 1 */ 00022 /***********/ 00023 00024 /* Single Precision */ 00025 00026 void srot_(const int*, float *, const int*, float *, const int*, const float *, const float *); 00027 void srotg_(float *,float *,float *,float *); 00028 void srotm_( const int*, float *, const int*, float *, const int*, const float *); 00029 void srotmg_(float *,float *,float *,const float *, float *); 00030 void sswap_( const int*, float *, const int*, float *, const int*); 00031 void scopy_( const int*, const float *, const int*, float *, const int*); 00032 void saxpy_( const int*, const float *, const float *, const int*, float *, const int*); 00033 float sdot_(const int*, const float *, const int*, const float *, const int*); 00034 void sdot_sub_(const int*, const float *, const int*, const float *, const int*, float *); 00035 void sdsdot_sub_( const int*, const float *, const float *, const int*, const float *, const int*, float *); 00036 void sscal_( const int*, const float *, float *, const int*); 00037 void snrm2_sub_( const int*, const float *, const int*, float *); 00038 void sasum_sub_( const int*, const float *, const int*, float *); 00039 void isamax_sub_( const int*, const float * , const int*, const int*); 00040 00041 /* Double Precision */ 00042 00043 void drot_(const int*, double *, const int*, double *, const int*, const double *, const double *); 00044 void drotg_(double *,double *,double *,double *); 00045 void drotm_( const int*, double *, const int*, double *, const int*, const double *); 00046 void drotmg_(double *,double *,double *,const double *, double *); 00047 void dswap_( const int*, double *, const int*, double *, const int*); 00048 void dcopy_( const int*, const double *, const int*, double *, const int*); 00049 void daxpy_( const int*, const double *, const double *, const int*, double *, const int*); 00050 void dswap_( const int*, double *, const int*, double *, const int*); 00051 double ddot_(const int*, const double *, const int*, const double *, const int*); 00052 void dsdot_sub_(const int*, const float *, const int*, const float *, const int*, double *); 00053 void ddot_sub_( const int*, const double *, const int*, const double *, const int*, double *); 00054 void dscal_( const int*, const double *, double *, const int*); 00055 void dnrm2_sub_( const int*, const double *, const int*, double *); 00056 void dasum_sub_( const int*, const double *, const int*, double *); 00057 void idamax_sub_( const int*, const double * , const int*, const int*); 00058 00059 /* Single Complex Precision */ 00060 00061 void cswap_( const int*, void *, const int*, void *, const int*); 00062 void ccopy_( const int*, const void *, const int*, void *, const int*); 00063 void caxpy_( const int*, const void *, const void *, const int*, void *, const int*); 00064 void cswap_( const int*, void *, const int*, void *, const int*); 00065 void cdotc_sub_( const int*, const void *, const int*, const void *, const int*, void *); 00066 void cdotu_sub_( const int*, const void *, const int*, const void *, const int*, void *); 00067 void cscal_( const int*, const void *, void *, const int*); 00068 void icamax_sub_( const int*, const void *, const int*, const int*); 00069 void csscal_( const int*, const float *, void *, const int*); 00070 void scnrm2_sub_( const int*, const void *, const int*, float *); 00071 void scasum_sub_( const int*, const void *, const int*, float *); 00072 00073 /* Double Complex Precision */ 00074 00075 void zswap_( const int*, void *, const int*, void *, const int*); 00076 void zcopy_( const int*, const void *, const int*, void *, const int*); 00077 void zaxpy_( const int*, const void *, const void *, const int*, void *, const int*); 00078 void zswap_( const int*, void *, const int*, void *, const int*); 00079 void zdotc_sub_( const int*, const void *, const int*, const void *, const int*, void *); 00080 void zdotu_sub_( const int*, const void *, const int*, const void *, const int*, void *); 00081 void zdscal_( const int*, const double *, void *, const int*); 00082 void zscal_( const int*, const void *, void *, const int*); 00083 void dznrm2_sub_( const int*, const void *, const int*, double *); 00084 void dzasum_sub_( const int*, const void *, const int*, double *); 00085 void izamax_sub_( const int*, const void *, const int*, const int*); 00086 00087 /***********/ 00088 /* Level 2 */ 00089 /***********/ 00090 00091 /* Single Precision */ 00092 00093 void sgemv_(char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00094 void sgbmv_(char*, const int*, const int*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00095 void ssymv_(char*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00096 void ssbmv_(char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00097 void sspmv_(char*, const int*, const float *, const float *, const float *, const int*, const float *, float *, const int*); 00098 void strmv_( char*, char*, char*, const int*, const float *, const int*, float *, const int*); 00099 void stbmv_( char*, char*, char*, const int*, const int*, const float *, const int*, float *, const int*); 00100 void strsv_( char*, char*, char*, const int*, const float *, const int*, float *, const int*); 00101 void stbsv_( char*, char*, char*, const int*, const int*, const float *, const int*, float *, const int*); 00102 void stpmv_( char*, char*, char*, const int*, const float *, float *, const int*); 00103 void stpsv_( char*, char*, char*, const int*, const float *, float *, const int*); 00104 void sger_( const int*, const int*, const float *, const float *, const int*, const float *, const int*, float *, const int*); 00105 void ssyr_(char*, const int*, const float *, const float *, const int*, float *, const int*); 00106 void sspr_(char*, const int*, const float *, const float *, const int*, float *); 00107 void sspr2_(char*, const int*, const float *, const float *, const int*, const float *, const int*, float *); 00108 void ssyr2_(char*, const int*, const float *, const float *, const int*, const float *, const int*, float *, const int*); 00109 00110 /* Double Precision */ 00111 00112 void dgemv_(char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00113 void dgbmv_(char*, const int*, const int*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00114 void dsymv_(char*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00115 void dsbmv_(char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00116 void dspmv_(char*, const int*, const double *, const double *, const double *, const int*, const double *, double *, const int*); 00117 void dtrmv_( char*, char*, char*, const int*, const double *, const int*, double *, const int*); 00118 void dtbmv_( char*, char*, char*, const int*, const int*, const double *, const int*, double *, const int*); 00119 void dtrsv_( char*, char*, char*, const int*, const double *, const int*, double *, const int*); 00120 void dtbsv_( char*, char*, char*, const int*, const int*, const double *, const int*, double *, const int*); 00121 void dtpmv_( char*, char*, char*, const int*, const double *, double *, const int*); 00122 void dtpsv_( char*, char*, char*, const int*, const double *, double *, const int*); 00123 void dger_( const int*, const int*, const double *, const double *, const int*, const double *, const int*, double *, const int*); 00124 void dsyr_(char*, const int*, const double *, const double *, const int*, double *, const int*); 00125 void dspr_(char*, const int*, const double *, const double *, const int*, double *); 00126 void dspr2_(char*, const int*, const double *, const double *, const int*, const double *, const int*, double *); 00127 void dsyr2_(char*, const int*, const double *, const double *, const int*, const double *, const int*, double *, const int*); 00128 00129 /* Single Complex Precision */ 00130 00131 void cgemv_(char*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00132 void cgbmv_(char*, const int*, const int*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00133 void chemv_(char*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00134 void chbmv_(char*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00135 void chpmv_(char*, const int*, const void *, const void *, const void *, const int*, const void *, void *, const int*); 00136 void ctrmv_( char*, char*, char*, const int*, const void *, const int*, void *, const int*); 00137 void ctbmv_( char*, char*, char*, const int*, const int*, const void *, const int*, void *, const int*); 00138 void ctpmv_( char*, char*, char*, const int*, const void *, void *, const int*); 00139 void ctrsv_( char*, char*, char*, const int*, const void *, const int*, void *, const int*); 00140 void ctbsv_( char*, char*, char*, const int*, const int*, const void *, const int*, void *, const int*); 00141 void ctpsv_( char*, char*, char*, const int*, const void *, void *,const int*); 00142 void cgerc_( const int*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00143 void cgeru_( const int*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00144 void cher_(char*, const int*, const float *, const void *, const int*, void *, const int*); 00145 void cher2_(char*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00146 void chpr_(char*, const int*, const float *, const void *, const int*, void *); 00147 void chpr2_(char*, const int*, const float *, const void *, const int*, const void *, const int*, void *); 00148 00149 /* Double Complex Precision */ 00150 00151 void zgemv_(char*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00152 void zgbmv_(char*, const int*, const int*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00153 void zhemv_(char*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00154 void zhbmv_(char*, const int*, const int*, const void *, const void *, const int*, const void *, const int*, const void *, void *, const int*); 00155 void zhpmv_(char*, const int*, const void *, const void *, const void *, const int*, const void *, void *, const int*); 00156 void ztrmv_( char*, char*, char*, const int*, const void *, const int*, void *, const int*); 00157 void ztbmv_( char*, char*, char*, const int*, const int*, const void *, const int*, void *, const int*); 00158 void ztpmv_( char*, char*, char*, const int*, const void *, void *, const int*); 00159 void ztrsv_( char*, char*, char*, const int*, const void *, const int*, void *, const int*); 00160 void ztbsv_( char*, char*, char*, const int*, const int*, const void *, const int*, void *, const int*); 00161 void ztpsv_( char*, char*, char*, const int*, const void *, void *,const int*); 00162 void zgerc_( const int*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00163 void zgeru_( const int*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00164 void zher_(char*, const int*, const double *, const void *, const int*, void *, const int*); 00165 void zher2_(char*, const int*, const void *, const void *, const int*, const void *, const int*, void *, const int*); 00166 void zhpr_(char*, const int*, const double *, const void *, const int*, void *); 00167 void zhpr2_(char*, const int*, const double *, const void *, const int*, const void *, const int*, void *); 00168 00169 /***********/ 00170 /* Level 3 */ 00171 /***********/ 00172 00173 /* Single Precision */ 00174 00175 void sgemm_(char*, char*, const int*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00176 void ssymm_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00177 void ssyrk_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, float *, const int*); 00178 void ssyr2k_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00179 void strmm_(char*, char*, char*, char*, const int*, const int*, const float *, const float *, const int*, float *, const int*); 00180 void strsm_(char*, char*, char*, char*, const int*, const int*, const float *, const float *, const int*, float *, const int*); 00181 00182 /* Double Precision */ 00183 00184 void dgemm_(char*, char*, const int*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00185 void dsymm_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00186 void dsyrk_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, double *, const int*); 00187 void dsyr2k_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00188 void dtrmm_(char*, char*, char*, char*, const int*, const int*, const double *, const double *, const int*, double *, const int*); 00189 void dtrsm_(char*, char*, char*, char*, const int*, const int*, const double *, const double *, const int*, double *, const int*); 00190 00191 /* Single Complex Precision */ 00192 00193 void cgemm_(char*, char*, const int*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00194 void csymm_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00195 void chemm_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00196 void csyrk_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, float *, const int*); 00197 void cherk_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, float *, const int*); 00198 void csyr2k_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00199 void cher2k_(char*, char*, const int*, const int*, const float *, const float *, const int*, const float *, const int*, const float *, float *, const int*); 00200 void ctrmm_(char*, char*, char*, char*, const int*, const int*, const float *, const float *, const int*, float *, const int*); 00201 void ctrsm_(char*, char*, char*, char*, const int*, const int*, const float *, const float *, const int*, float *, const int*); 00202 00203 /* Double Complex Precision */ 00204 00205 void zgemm_(char*, char*, const int*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00206 void zsymm_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00207 void zhemm_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00208 void zsyrk_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, double *, const int*); 00209 void zherk_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, double *, const int*); 00210 void zsyr2k_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00211 void zher2k_(char*, char*, const int*, const int*, const double *, const double *, const int*, const double *, const int*, const double *, double *, const int*); 00212 void ztrmm_(char*, char*, char*, char*, const int*, const int*, const double *, const double *, const int*, double *, const int*); 00213 void ztrsm_(char*, char*, char*, char*, const int*, const int*, const double *, const double *, const int*, double *, const int*); 00214 00215 } 00216 00217 #ifndef MOD 00218 #define MOD % 00219 #endif 00220 static double time_time() // a time function like time.time() 00221 { 00222 struct timeval tv; 00223 gettimeofday(&tv, 0); 00224 return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0; 00225 } 00226 00227 00228 namespace { 00229 struct __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8 { 00230 PyObject* __ERROR; 00231 00232 PyObject* storage_V3; 00233 PyObject* storage_V5; 00234 PyObject* storage_V1; 00235 00236 00237 __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8() { 00238 // This is only somewhat safe because we: 00239 // 1) Are not a virtual class 00240 // 2) Do not use any virtual classes in the members 00241 // 3) Deal with mostly POD and pointers 00242 00243 // If this changes, we would have to revise this, but for 00244 // now I am tired of chasing segfaults because 00245 // initialization code had an error and some pointer has 00246 // a junk value. 00247 memset(this, 0, sizeof(*this)); 00248 } 00249 ~__struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8(void) { 00250 cleanup(); 00251 } 00252 00253 int init(PyObject* __ERROR, PyObject* storage_V3, PyObject* storage_V5, PyObject* storage_V1) { 00254 Py_XINCREF(storage_V3); 00255 Py_XINCREF(storage_V5); 00256 Py_XINCREF(storage_V1); 00257 this->storage_V3 = storage_V3; 00258 this->storage_V5 = storage_V5; 00259 this->storage_V1 = storage_V1; 00260 00261 00262 00263 00264 00265 this->__ERROR = __ERROR; 00266 return 0; 00267 } 00268 void cleanup(void) { 00269 __label_1: 00270 00271 double __DUMMY_1; 00272 __label_3: 00273 00274 double __DUMMY_3; 00275 __label_5: 00276 00277 double __DUMMY_5; 00278 __label_8: 00279 00280 double __DUMMY_8; 00281 00282 Py_XDECREF(this->storage_V3); 00283 Py_XDECREF(this->storage_V5); 00284 Py_XDECREF(this->storage_V1); 00285 } 00286 int run(void) { 00287 int __failure = 0; 00288 00289 PyObject* py_V1; 00290 00291 PyArrayObject* V1; 00292 00293 typedef npy_float64 dtype_V1; 00294 00295 PyObject* py_V3; 00296 00297 PyArrayObject* V3; 00298 00299 typedef npy_float64 dtype_V3; 00300 00301 PyObject* py_V5; 00302 00303 PyArrayObject* V5; 00304 00305 typedef npy_float64 dtype_V5; 00306 00307 { 00308 00309 py_V1 = PyList_GET_ITEM(storage_V1, 0); 00310 {Py_XINCREF(py_V1);} 00311 00312 if (py_V1 == Py_None) 00313 { 00314 00315 V1 = NULL; 00316 00317 } 00318 else 00319 { 00320 00321 V1 = NULL; 00322 if (py_V1 == Py_None) { 00323 // We can either fail here or set V1 to NULL and rely on Ops 00324 // using tensors to handle the NULL case, but if they fail to do so 00325 // they'll end up with nasty segfaults, so this is public service. 00326 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); 00327 { 00328 __failure = 2; 00329 if (!PyErr_Occurred()) { 00330 PyErr_SetString(PyExc_RuntimeError, 00331 "Unexpected error in an Op's C code. " 00332 "No Python exception was set."); 00333 } 00334 goto __label_2;} 00335 } 00336 if (!PyArray_Check(py_V1)) { 00337 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); 00338 { 00339 __failure = 2; 00340 if (!PyErr_Occurred()) { 00341 PyErr_SetString(PyExc_RuntimeError, 00342 "Unexpected error in an Op's C code. " 00343 "No Python exception was set."); 00344 } 00345 goto __label_2;} 00346 } 00347 // We expect NPY_FLOAT64 00348 if (!PyArray_ISALIGNED((PyArrayObject*) py_V1)) { 00349 PyArrayObject * tmp = (PyArrayObject*) py_V1; 00350 PyErr_Format(PyExc_NotImplementedError, 00351 "expected an aligned array of type %ld " 00352 "(NPY_FLOAT64), got non-aligned array of type %ld" 00353 " with %ld dimensions, with 3 last dims " 00354 "%ld, %ld, %ld" 00355 " and 3 last strides %ld %ld, %ld.", 00356 (long int) NPY_FLOAT64, 00357 (long int) PyArray_TYPE((PyArrayObject*) py_V1), 00358 (long int) PyArray_NDIM(tmp), 00359 (long int) PyArray_NDIM(tmp) >= 3 ? 00360 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1, 00361 (long int) PyArray_NDIM(tmp) >= 2 ? 00362 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1, 00363 (long int) PyArray_NDIM(tmp) >= 1 ? 00364 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1, 00365 (long int) PyArray_NDIM(tmp) >= 3 ? 00366 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1, 00367 (long int) PyArray_NDIM(tmp) >= 2 ? 00368 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1, 00369 (long int) PyArray_NDIM(tmp) >= 1 ? 00370 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1 00371 ); 00372 { 00373 __failure = 2; 00374 if (!PyErr_Occurred()) { 00375 PyErr_SetString(PyExc_RuntimeError, 00376 "Unexpected error in an Op's C code. " 00377 "No Python exception was set."); 00378 } 00379 goto __label_2;} 00380 } 00381 // This is a TypeError to be consistent with DEBUG_MODE 00382 // Note: DEBUG_MODE also tells the name of the container 00383 if (PyArray_TYPE((PyArrayObject*) py_V1) != NPY_FLOAT64) { 00384 PyErr_Format(PyExc_TypeError, 00385 "expected type_num %d (NPY_FLOAT64) got %d", 00386 NPY_FLOAT64, PyArray_TYPE((PyArrayObject*) py_V1)); 00387 { 00388 __failure = 2; 00389 if (!PyErr_Occurred()) { 00390 PyErr_SetString(PyExc_RuntimeError, 00391 "Unexpected error in an Op's C code. " 00392 "No Python exception was set."); 00393 } 00394 goto __label_2;} 00395 } 00396 00397 V1 = (PyArrayObject*)(py_V1); 00398 Py_XINCREF(V1); 00399 00400 } 00401 00402 { 00403 00404 py_V3 = PyList_GET_ITEM(storage_V3, 0); 00405 {Py_XINCREF(py_V3);} 00406 00407 V3 = NULL; 00408 if (py_V3 == Py_None) { 00409 // We can either fail here or set V3 to NULL and rely on Ops 00410 // using tensors to handle the NULL case, but if they fail to do so 00411 // they'll end up with nasty segfaults, so this is public service. 00412 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); 00413 { 00414 __failure = 4; 00415 if (!PyErr_Occurred()) { 00416 PyErr_SetString(PyExc_RuntimeError, 00417 "Unexpected error in an Op's C code. " 00418 "No Python exception was set."); 00419 } 00420 goto __label_4;} 00421 } 00422 if (!PyArray_Check(py_V3)) { 00423 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); 00424 { 00425 __failure = 4; 00426 if (!PyErr_Occurred()) { 00427 PyErr_SetString(PyExc_RuntimeError, 00428 "Unexpected error in an Op's C code. " 00429 "No Python exception was set."); 00430 } 00431 goto __label_4;} 00432 } 00433 // We expect NPY_FLOAT64 00434 if (!PyArray_ISALIGNED((PyArrayObject*) py_V3)) { 00435 PyArrayObject * tmp = (PyArrayObject*) py_V3; 00436 PyErr_Format(PyExc_NotImplementedError, 00437 "expected an aligned array of type %ld " 00438 "(NPY_FLOAT64), got non-aligned array of type %ld" 00439 " with %ld dimensions, with 3 last dims " 00440 "%ld, %ld, %ld" 00441 " and 3 last strides %ld %ld, %ld.", 00442 (long int) NPY_FLOAT64, 00443 (long int) PyArray_TYPE((PyArrayObject*) py_V3), 00444 (long int) PyArray_NDIM(tmp), 00445 (long int) PyArray_NDIM(tmp) >= 3 ? 00446 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1, 00447 (long int) PyArray_NDIM(tmp) >= 2 ? 00448 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1, 00449 (long int) PyArray_NDIM(tmp) >= 1 ? 00450 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1, 00451 (long int) PyArray_NDIM(tmp) >= 3 ? 00452 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1, 00453 (long int) PyArray_NDIM(tmp) >= 2 ? 00454 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1, 00455 (long int) PyArray_NDIM(tmp) >= 1 ? 00456 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1 00457 ); 00458 { 00459 __failure = 4; 00460 if (!PyErr_Occurred()) { 00461 PyErr_SetString(PyExc_RuntimeError, 00462 "Unexpected error in an Op's C code. " 00463 "No Python exception was set."); 00464 } 00465 goto __label_4;} 00466 } 00467 // This is a TypeError to be consistent with DEBUG_MODE 00468 // Note: DEBUG_MODE also tells the name of the container 00469 if (PyArray_TYPE((PyArrayObject*) py_V3) != NPY_FLOAT64) { 00470 PyErr_Format(PyExc_TypeError, 00471 "expected type_num %d (NPY_FLOAT64) got %d", 00472 NPY_FLOAT64, PyArray_TYPE((PyArrayObject*) py_V3)); 00473 { 00474 __failure = 4; 00475 if (!PyErr_Occurred()) { 00476 PyErr_SetString(PyExc_RuntimeError, 00477 "Unexpected error in an Op's C code. " 00478 "No Python exception was set."); 00479 } 00480 goto __label_4;} 00481 } 00482 00483 V3 = (PyArrayObject*)(py_V3); 00484 Py_XINCREF(V3); 00485 00486 { 00487 00488 py_V5 = PyList_GET_ITEM(storage_V5, 0); 00489 {Py_XINCREF(py_V5);} 00490 00491 V5 = NULL; 00492 if (py_V5 == Py_None) { 00493 // We can either fail here or set V5 to NULL and rely on Ops 00494 // using tensors to handle the NULL case, but if they fail to do so 00495 // they'll end up with nasty segfaults, so this is public service. 00496 PyErr_SetString(PyExc_ValueError, "expected an ndarray, not None"); 00497 { 00498 __failure = 6; 00499 if (!PyErr_Occurred()) { 00500 PyErr_SetString(PyExc_RuntimeError, 00501 "Unexpected error in an Op's C code. " 00502 "No Python exception was set."); 00503 } 00504 goto __label_6;} 00505 } 00506 if (!PyArray_Check(py_V5)) { 00507 PyErr_SetString(PyExc_ValueError, "expected an ndarray"); 00508 { 00509 __failure = 6; 00510 if (!PyErr_Occurred()) { 00511 PyErr_SetString(PyExc_RuntimeError, 00512 "Unexpected error in an Op's C code. " 00513 "No Python exception was set."); 00514 } 00515 goto __label_6;} 00516 } 00517 // We expect NPY_FLOAT64 00518 if (!PyArray_ISALIGNED((PyArrayObject*) py_V5)) { 00519 PyArrayObject * tmp = (PyArrayObject*) py_V5; 00520 PyErr_Format(PyExc_NotImplementedError, 00521 "expected an aligned array of type %ld " 00522 "(NPY_FLOAT64), got non-aligned array of type %ld" 00523 " with %ld dimensions, with 3 last dims " 00524 "%ld, %ld, %ld" 00525 " and 3 last strides %ld %ld, %ld.", 00526 (long int) NPY_FLOAT64, 00527 (long int) PyArray_TYPE((PyArrayObject*) py_V5), 00528 (long int) PyArray_NDIM(tmp), 00529 (long int) PyArray_NDIM(tmp) >= 3 ? 00530 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1, 00531 (long int) PyArray_NDIM(tmp) >= 2 ? 00532 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1, 00533 (long int) PyArray_NDIM(tmp) >= 1 ? 00534 PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1, 00535 (long int) PyArray_NDIM(tmp) >= 3 ? 00536 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1, 00537 (long int) PyArray_NDIM(tmp) >= 2 ? 00538 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1, 00539 (long int) PyArray_NDIM(tmp) >= 1 ? 00540 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1 00541 ); 00542 { 00543 __failure = 6; 00544 if (!PyErr_Occurred()) { 00545 PyErr_SetString(PyExc_RuntimeError, 00546 "Unexpected error in an Op's C code. " 00547 "No Python exception was set."); 00548 } 00549 goto __label_6;} 00550 } 00551 // This is a TypeError to be consistent with DEBUG_MODE 00552 // Note: DEBUG_MODE also tells the name of the container 00553 if (PyArray_TYPE((PyArrayObject*) py_V5) != NPY_FLOAT64) { 00554 PyErr_Format(PyExc_TypeError, 00555 "expected type_num %d (NPY_FLOAT64) got %d", 00556 NPY_FLOAT64, PyArray_TYPE((PyArrayObject*) py_V5)); 00557 { 00558 __failure = 6; 00559 if (!PyErr_Occurred()) { 00560 PyErr_SetString(PyExc_RuntimeError, 00561 "Unexpected error in an Op's C code. " 00562 "No Python exception was set."); 00563 } 00564 goto __label_6;} 00565 } 00566 00567 V5 = (PyArrayObject*)(py_V5); 00568 Py_XINCREF(V5); 00569 00570 { 00571 // Op class Dot22 00572 00573 int unit = 0; 00574 00575 int type_num = PyArray_DESCR(V3)->type_num; 00576 int type_size = PyArray_DESCR(V3)->elsize; // in bytes 00577 00578 npy_intp* Nx = PyArray_DIMS(V3); 00579 npy_intp* Ny = PyArray_DIMS(V5); 00580 npy_intp* Nz = 0; //PyArray_DIMS(V1); 00581 00582 npy_intp* Sx = PyArray_STRIDES(V3); 00583 npy_intp* Sy = PyArray_STRIDES(V5); 00584 npy_intp* Sz = 0; //PyArray_STRIDES(V1); 00585 00586 //strides for x, y, z in dimensions 0, 1 00587 int sx_0, sx_1, sy_0, sy_1, sz_0, sz_1; 00588 00589 if (PyArray_NDIM(V3) != 2) { 00590 PyErr_Format(PyExc_NotImplementedError, 00591 "rank(x) != 2. rank(x) is %d.", 00592 PyArray_NDIM(V3)); 00593 { 00594 __failure = 7; 00595 if (!PyErr_Occurred()) { 00596 PyErr_SetString(PyExc_RuntimeError, 00597 "Unexpected error in an Op's C code. " 00598 "No Python exception was set."); 00599 } 00600 goto __label_7;}; 00601 } 00602 if (PyArray_NDIM(V5) != 2) { 00603 PyErr_Format(PyExc_NotImplementedError, 00604 "rank(y) != 2. rank(y) is %d.", PyArray_NDIM(V5)); 00605 { 00606 __failure = 7; 00607 if (!PyErr_Occurred()) { 00608 PyErr_SetString(PyExc_RuntimeError, 00609 "Unexpected error in an Op's C code. " 00610 "No Python exception was set."); 00611 } 00612 goto __label_7;}; 00613 } 00614 if (V1 && PyArray_NDIM(V1) != 2) { 00615 PyErr_Format(PyExc_NotImplementedError, 00616 "rank(z) != 2. rank(z) is %d.", PyArray_NDIM(V1)); 00617 { 00618 __failure = 7; 00619 if (!PyErr_Occurred()) { 00620 PyErr_SetString(PyExc_RuntimeError, 00621 "Unexpected error in an Op's C code. " 00622 "No Python exception was set."); 00623 } 00624 goto __label_7;}; 00625 } 00626 00627 if ((NULL == V1) 00628 || (PyArray_DIMS(V1)[0] != PyArray_DIMS(V3)[0]) 00629 || (PyArray_DIMS(V1)[1] != PyArray_DIMS(V5)[1])) 00630 { 00631 if (NULL != V1) Py_XDECREF(V1); 00632 npy_intp dims[2]; 00633 dims[0] = PyArray_DIMS(V3)[0]; 00634 dims[1] = PyArray_DIMS(V5)[1]; 00635 V1 = (PyArrayObject*)PyArray_SimpleNew(2, dims, 00636 PyArray_TYPE(V3)); 00637 //fprintf(stderr, "Dot Allocating %i %i\n", dims[0], dims[1]); 00638 if(!V1) { 00639 PyErr_SetString(PyExc_MemoryError, 00640 "failed to alloc dot22 output"); 00641 { 00642 __failure = 7; 00643 if (!PyErr_Occurred()) { 00644 PyErr_SetString(PyExc_RuntimeError, 00645 "Unexpected error in an Op's C code. " 00646 "No Python exception was set."); 00647 } 00648 goto __label_7;} 00649 } 00650 } 00651 Nz = PyArray_DIMS(V1); 00652 Sz = PyArray_STRIDES(V1); 00653 00654 00655 if ((PyArray_DESCR(V3)->type_num != NPY_DOUBLE) 00656 && (PyArray_DESCR(V3)->type_num != NPY_FLOAT)) 00657 {PyErr_SetString(PyExc_NotImplementedError, "type(x) is not double or float"); { 00658 __failure = 7; 00659 if (!PyErr_Occurred()) { 00660 PyErr_SetString(PyExc_RuntimeError, 00661 "Unexpected error in an Op's C code. " 00662 "No Python exception was set."); 00663 } 00664 goto __label_7;};} 00665 00666 if ((PyArray_DESCR(V5)->type_num != NPY_DOUBLE) 00667 && (PyArray_DESCR(V5)->type_num != NPY_FLOAT)) 00668 {PyErr_SetString(PyExc_NotImplementedError, "type(y) is not double or float"); { 00669 __failure = 7; 00670 if (!PyErr_Occurred()) { 00671 PyErr_SetString(PyExc_RuntimeError, 00672 "Unexpected error in an Op's C code. " 00673 "No Python exception was set."); 00674 } 00675 goto __label_7;};} 00676 00677 if ((PyArray_DESCR(V1)->type_num != NPY_DOUBLE) 00678 && (PyArray_DESCR(V1)->type_num != NPY_FLOAT)) 00679 {PyErr_SetString(PyExc_NotImplementedError, "type(z) is not double or float"); { 00680 __failure = 7; 00681 if (!PyErr_Occurred()) { 00682 PyErr_SetString(PyExc_RuntimeError, 00683 "Unexpected error in an Op's C code. " 00684 "No Python exception was set."); 00685 } 00686 goto __label_7;};} 00687 00688 if ((PyArray_DESCR(V3)->type_num != PyArray_DESCR(V5)->type_num) 00689 ||(PyArray_DESCR(V3)->type_num != PyArray_DESCR(V1)->type_num)) 00690 { PyErr_SetString(PyExc_NotImplementedError, "type(x), type(y), type(z) are not all the same"); { 00691 __failure = 7; 00692 if (!PyErr_Occurred()) { 00693 PyErr_SetString(PyExc_RuntimeError, 00694 "Unexpected error in an Op's C code. " 00695 "No Python exception was set."); 00696 } 00697 goto __label_7;}; } 00698 00699 if (Nx[0] != Nz[0]) 00700 { 00701 PyErr_Format(PyExc_ValueError, 00702 "Shape mismatch: x has %ld rows but z has %ld rows", 00703 (long int)Nx[0], (long int)Nz[0]); 00704 { 00705 __failure = 7; 00706 if (!PyErr_Occurred()) { 00707 PyErr_SetString(PyExc_RuntimeError, 00708 "Unexpected error in an Op's C code. " 00709 "No Python exception was set."); 00710 } 00711 goto __label_7;}; 00712 } 00713 if (Nx[1] != Ny[0]) 00714 { 00715 PyErr_Format(PyExc_ValueError, 00716 "Shape mismatch: x has %ld cols (and %ld rows) but y has %ld rows (and %ld cols)", 00717 (long int)Nx[1], (long int)Nx[0], (long int)Ny[0], (long int)Ny[1]); 00718 { 00719 __failure = 7; 00720 if (!PyErr_Occurred()) { 00721 PyErr_SetString(PyExc_RuntimeError, 00722 "Unexpected error in an Op's C code. " 00723 "No Python exception was set."); 00724 } 00725 goto __label_7;}; 00726 } 00727 if (Ny[1] != Nz[1]) 00728 { 00729 PyErr_Format(PyExc_ValueError, 00730 "Shape mismatch: y has %ld cols but z has %ld cols", 00731 (long int)Ny[1], (long int)Nz[1]); 00732 { 00733 __failure = 7; 00734 if (!PyErr_Occurred()) { 00735 PyErr_SetString(PyExc_RuntimeError, 00736 "Unexpected error in an Op's C code. " 00737 "No Python exception was set."); 00738 } 00739 goto __label_7;}; 00740 } 00741 00742 // We must not raise an error when Nx[1] == 0. This would disable cases 00743 // that numpy.dot accept. 00744 00745 /* 00746 If some matrices are not contiguous on either dimensions, 00747 or have invalid strides, copy their content into a contiguous one 00748 */ 00749 if ((Sx[0] < 1) || (Sx[1] < 1) || (Sx[0] MOD type_size) || (Sx[1] MOD type_size) 00750 || ((Sx[0] != type_size) && (Sx[1] != type_size))) 00751 { 00752 PyArrayObject * _x_copy = (PyArrayObject *) PyArray_Copy(V3); 00753 if (!_x_copy) 00754 { 00755 __failure = 7; 00756 if (!PyErr_Occurred()) { 00757 PyErr_SetString(PyExc_RuntimeError, 00758 "Unexpected error in an Op's C code. " 00759 "No Python exception was set."); 00760 } 00761 goto __label_7;} 00762 Py_XDECREF(V3); 00763 V3 = _x_copy; 00764 Sx = PyArray_STRIDES(V3); 00765 } 00766 00767 if ((Sy[0] < 1) || (Sy[1] < 1) || (Sy[0] MOD type_size) || (Sy[1] MOD type_size) 00768 || ((Sy[0] != type_size) && (Sy[1] != type_size))) 00769 { 00770 PyArrayObject * _y_copy = (PyArrayObject *) PyArray_Copy(V5); 00771 if (!_y_copy) 00772 { 00773 __failure = 7; 00774 if (!PyErr_Occurred()) { 00775 PyErr_SetString(PyExc_RuntimeError, 00776 "Unexpected error in an Op's C code. " 00777 "No Python exception was set."); 00778 } 00779 goto __label_7;} 00780 Py_XDECREF(V5); 00781 V5 = _y_copy; 00782 Sy = PyArray_STRIDES(V5); 00783 } 00784 00785 if ((Sz[0] < 1) || (Sz[1] < 1) || (Sz[0] MOD type_size) || (Sz[1] MOD type_size) 00786 || ((Sz[0] != type_size) && (Sz[1] != type_size))) 00787 { 00788 PyArrayObject * _z_copy = (PyArrayObject *) PyArray_Copy(V1); 00789 if (!_z_copy) 00790 { 00791 __failure = 7; 00792 if (!PyErr_Occurred()) { 00793 PyErr_SetString(PyExc_RuntimeError, 00794 "Unexpected error in an Op's C code. " 00795 "No Python exception was set."); 00796 } 00797 goto __label_7;} 00798 Py_XDECREF(V1); 00799 V1 = _z_copy; 00800 Sz = PyArray_STRIDES(V1); 00801 } 00802 00803 /* 00804 encode the stride structure of _x,_y,_zout into a single integer 00805 */ 00806 unit |= ((Sx[1] == type_size || Nx[1]==1) ? 0x0 : (Sx[0] == type_size || Nx[0]==1) ? 0x1 : 0x2) << 8; 00807 unit |= ((Sy[1] == type_size || Ny[1]==1) ? 0x0 : (Sy[0] == type_size || Ny[0]==1) ? 0x1 : 0x2) << 4; 00808 unit |= ((Sz[1] == type_size || Nz[1]==1) ? 0x0 : (Sz[0] == type_size || Nz[0]==1) ? 0x1 : 0x2) << 0; 00809 00810 /* create appropriate strides for malformed matrices that are row or column 00811 * vectors, or empty matrices. 00812 * In that case, the value of the stride does not really matter, but 00813 * some versions of BLAS insist that: 00814 * - they are not smaller than the number of elements in the array, 00815 * - they are not 0. 00816 */ 00817 sx_0 = (Nx[0] > 1) ? Sx[0]/type_size : (Nx[1] + 1); 00818 sx_1 = (Nx[1] > 1) ? Sx[1]/type_size : (Nx[0] + 1); 00819 sy_0 = (Ny[0] > 1) ? Sy[0]/type_size : (Ny[1] + 1); 00820 sy_1 = (Ny[1] > 1) ? Sy[1]/type_size : (Ny[0] + 1); 00821 sz_0 = (Nz[0] > 1) ? Sz[0]/type_size : (Nz[1] + 1); 00822 sz_1 = (Nz[1] > 1) ? Sz[1]/type_size : (Nz[0] + 1); 00823 00824 switch (type_num) 00825 { 00826 00827 case NPY_FLOAT: 00828 { 00829 00830 float a = 1.0; 00831 float b = 0.0; 00832 00833 float* x = (float*)PyArray_DATA(V3); 00834 float* y = (float*)PyArray_DATA(V5); 00835 float* z = (float*)PyArray_DATA(V1); 00836 char N = 'N'; 00837 char T = 'T'; 00838 int Nz0 = Nz[0], Nz1 = Nz[1], Nx1 = Nx[1]; 00839 //std::cerr << (unit/256) MOD 16 << (unit / 16) MOD 16 << unit MOD 16<< '\n'; 00840 //double t0 = time_time(); 00841 switch(unit) 00842 { 00843 case 0x000: sgemm_(&N, &N, &Nz1, &Nz0, &Nx1, &a, y, &sy_0, x, &sx_0, &b, z, &sz_0); break; 00844 case 0x100: sgemm_(&N, &T, &Nz1, &Nz0, &Nx1, &a, y, &sy_0, x, &sx_1, &b, z, &sz_0); break; 00845 case 0x010: sgemm_(&T, &N, &Nz1, &Nz0, &Nx1, &a, y, &sy_1, x, &sx_0, &b, z, &sz_0); break; 00846 case 0x110: sgemm_(&T, &T, &Nz1, &Nz0, &Nx1, &a, y, &sy_1, x, &sx_1, &b, z, &sz_0); break; 00847 case 0x001: sgemm_(&T, &T, &Nz0, &Nz1, &Nx1, &a, x, &sx_0, y, &sy_0, &b, z, &sz_1); break; 00848 case 0x101: sgemm_(&N, &T, &Nz0, &Nz1, &Nx1, &a, x, &sx_1, y, &sy_0, &b, z, &sz_1); break; 00849 case 0x011: sgemm_(&T, &N, &Nz0, &Nz1, &Nx1, &a, x, &sx_0, y, &sy_1, &b, z, &sz_1); break; 00850 case 0x111: sgemm_(&N, &N, &Nz0, &Nz1, &Nx1, &a, x, &sx_1, y, &sy_1, &b, z, &sz_1); break; 00851 default: PyErr_SetString(PyExc_ValueError, "some matrix has no unit stride"); { 00852 __failure = 7; 00853 if (!PyErr_Occurred()) { 00854 PyErr_SetString(PyExc_RuntimeError, 00855 "Unexpected error in an Op's C code. " 00856 "No Python exception was set."); 00857 } 00858 goto __label_7;}; 00859 }; 00860 //fprintf(stderr, "Calling sgemm %i %i %i %i took %f\n", unit, Nz1, Nz0, Nx1, time_time() - t0); 00861 00862 } 00863 break; 00864 case NPY_DOUBLE: 00865 { 00866 00867 double a = 1.0; 00868 double b = 0.0; 00869 00870 double* x = (double*)PyArray_DATA(V3); 00871 double* y = (double*)PyArray_DATA(V5); 00872 double* z = (double*)PyArray_DATA(V1); 00873 char N = 'N'; 00874 char T = 'T'; 00875 int Nz0 = Nz[0], Nz1 = Nz[1], Nx1 = Nx[1]; 00876 //std::cerr << (unit/256) MOD 16 << (unit / 16) MOD 16 << unit MOD 16<< '\n'; 00877 //double t0 = time_time(); 00878 //fprintf(stderr, "unit=%x N= %i %i %i S = %i %i %i %i %i %i\n", unit, 00879 //Nz1, Nz0, Nx1, 00880 //sy_0, sy_1, 00881 //sx_0, sx_1, 00882 //sz_0, sz_1 00883 //); 00884 switch(unit) 00885 { 00886 case 0x000: dgemm_(&N, &N, &Nz1, &Nz0, &Nx1, &a, y, 00887 &sy_0, x, &sx_0, &b, z, &sz_0); break; 00888 case 0x100: dgemm_(&N, &T, &Nz1, &Nz0, &Nx1, &a, y, 00889 &sy_0, x, &sx_1, &b, z, &sz_0); break; 00890 case 0x010: dgemm_(&T, &N, &Nz1, &Nz0, &Nx1, &a, y, 00891 &sy_1, x, &sx_0, &b, z, &sz_0); break; 00892 case 0x110: dgemm_(&T, &T, &Nz1, &Nz0, &Nx1, &a, y, 00893 &sy_1, x, &sx_1, &b, z, &sz_0); break; 00894 case 0x001: dgemm_(&T, &T, &Nz0, &Nz1, &Nx1, &a, x, 00895 &sx_0, y, &sy_0, &b, z, &sz_1); break; 00896 case 0x101: dgemm_(&N, &T, &Nz0, &Nz1, &Nx1, &a, x, 00897 &sx_1, y, &sy_0, &b, z, &sz_1); break; 00898 case 0x011: dgemm_(&T, &N, &Nz0, &Nz1, &Nx1, &a, x, 00899 &sx_0, y, &sy_1, &b, z, &sz_1); break; 00900 case 0x111: dgemm_(&N, &N, &Nz0, &Nz1, &Nx1, &a, x, 00901 &sx_1, y, &sy_1, &b, z, &sz_1); break; 00902 default: PyErr_SetString(PyExc_ValueError, 00903 "some matrix has no unit stride"); 00904 { 00905 __failure = 7; 00906 if (!PyErr_Occurred()) { 00907 PyErr_SetString(PyExc_RuntimeError, 00908 "Unexpected error in an Op's C code. " 00909 "No Python exception was set."); 00910 } 00911 goto __label_7;}; 00912 }; 00913 //fprintf(stderr, "Calling dgemm %i %i %i %i took %f\n", 00914 // unit, Nz1, Nz0, Nx1, time_time()- t0); 00915 00916 } 00917 break; 00918 } 00919 __label_7: 00920 00921 double __DUMMY_7; 00922 00923 } 00924 __label_6: 00925 00926 if (V5) { 00927 Py_XDECREF(V5); 00928 } 00929 00930 {Py_XDECREF(py_V5);} 00931 00932 double __DUMMY_6; 00933 00934 } 00935 __label_4: 00936 00937 if (V3) { 00938 Py_XDECREF(V3); 00939 } 00940 00941 {Py_XDECREF(py_V3);} 00942 00943 double __DUMMY_4; 00944 00945 } 00946 __label_2: 00947 00948 if (!__failure) { 00949 00950 {Py_XDECREF(py_V1);} 00951 if (!V1) { 00952 Py_INCREF(Py_None); 00953 py_V1 = Py_None; 00954 } 00955 else if ((void*)py_V1 != (void*)V1) { 00956 py_V1 = (PyObject*)V1; 00957 } 00958 00959 {Py_XINCREF(py_V1);} 00960 00961 if (V1 && !PyArray_ISALIGNED((PyArrayObject*) py_V1)) { 00962 PyErr_Format(PyExc_NotImplementedError, 00963 "c_sync: expected an aligned array, got non-aligned array of type %ld" 00964 " with %ld dimensions, with 3 last dims " 00965 "%ld, %ld, %ld" 00966 " and 3 last strides %ld %ld, %ld.", 00967 (long int) PyArray_TYPE((PyArrayObject*) py_V1), 00968 (long int) PyArray_NDIM(V1), 00969 (long int) PyArray_NDIM(V1) >= 3 ? 00970 PyArray_DIMS(V1)[PyArray_NDIM(V1)-3] : -1, 00971 (long int) PyArray_NDIM(V1) >= 2 ? 00972 PyArray_DIMS(V1)[PyArray_NDIM(V1)-2] : -1, 00973 (long int) PyArray_NDIM(V1) >= 1 ? 00974 PyArray_DIMS(V1)[PyArray_NDIM(V1)-1] : -1, 00975 (long int) PyArray_NDIM(V1) >= 3 ? 00976 PyArray_STRIDES(V1)[PyArray_NDIM(V1)-3] : -1, 00977 (long int) PyArray_NDIM(V1) >= 2 ? 00978 PyArray_STRIDES(V1)[PyArray_NDIM(V1)-2] : -1, 00979 (long int) PyArray_NDIM(V1) >= 1 ? 00980 PyArray_STRIDES(V1)[PyArray_NDIM(V1)-1] : -1 00981 ); 00982 { 00983 __failure = 2; 00984 if (!PyErr_Occurred()) { 00985 PyErr_SetString(PyExc_RuntimeError, 00986 "Unexpected error in an Op's C code. " 00987 "No Python exception was set."); 00988 } 00989 goto __label_2;} 00990 } 00991 00992 PyObject* old = PyList_GET_ITEM(storage_V1, 0); 00993 {Py_XINCREF(py_V1);} 00994 PyList_SET_ITEM(storage_V1, 0, py_V1); 00995 {Py_XDECREF(old);} 00996 } 00997 00998 if (V1) { 00999 Py_XDECREF(V1); 01000 } 01001 01002 {Py_XDECREF(py_V1);} 01003 01004 double __DUMMY_2; 01005 01006 } 01007 01008 01009 if (__failure) { 01010 // When there is a failure, this code puts the exception 01011 // in __ERROR. 01012 PyObject* err_type = NULL; 01013 PyObject* err_msg = NULL; 01014 PyObject* err_traceback = NULL; 01015 PyErr_Fetch(&err_type, &err_msg, &err_traceback); 01016 if (!err_type) {err_type = Py_None;Py_INCREF(Py_None);} 01017 if (!err_msg) {err_msg = Py_None; Py_INCREF(Py_None);} 01018 if (!err_traceback) {err_traceback = Py_None; Py_INCREF(Py_None);} 01019 PyObject* old_err_type = PyList_GET_ITEM(__ERROR, 0); 01020 PyObject* old_err_msg = PyList_GET_ITEM(__ERROR, 1); 01021 PyObject* old_err_traceback = PyList_GET_ITEM(__ERROR, 2); 01022 PyList_SET_ITEM(__ERROR, 0, err_type); 01023 PyList_SET_ITEM(__ERROR, 1, err_msg); 01024 PyList_SET_ITEM(__ERROR, 2, err_traceback); 01025 {Py_XDECREF(old_err_type);} 01026 {Py_XDECREF(old_err_msg);} 01027 {Py_XDECREF(old_err_traceback);} 01028 } 01029 // The failure code is returned to index what code block failed. 01030 return __failure; 01031 01032 } 01033 }; 01034 } 01035 01036 01037 static int __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8_executor(__struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8 *self) { 01038 return self->run(); 01039 } 01040 01041 static void __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8_destructor(PyObject *capsule) { 01042 __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8 *self = (__struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8 *)PyCapsule_GetContext(capsule); 01043 delete self; 01044 } 01045 01046 ////////////////////// 01047 //// Functions 01048 ////////////////////// 01049 static PyObject * instantiate(PyObject * self, PyObject *argtuple) { 01050 assert(PyTuple_Check(argtuple)); 01051 if (4 != PyTuple_Size(argtuple)){ 01052 PyErr_Format(PyExc_TypeError, "Wrong number of arguments, expected 4, got %i", (int)PyTuple_Size(argtuple)); 01053 return NULL; 01054 } 01055 __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8* struct_ptr = new __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8(); 01056 if (struct_ptr->init( PyTuple_GET_ITEM(argtuple, 0),PyTuple_GET_ITEM(argtuple, 1),PyTuple_GET_ITEM(argtuple, 2),PyTuple_GET_ITEM(argtuple, 3) ) != 0) { 01057 delete struct_ptr; 01058 return NULL; 01059 } 01060 PyObject* thunk = PyCapsule_New((void*)(&__struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8_executor), NULL, __struct_compiled_op_mc5f5cd0a775ddf65c3076967cfc93ba8_destructor); 01061 if (thunk != NULL && PyCapsule_SetContext(thunk, struct_ptr) != 0) { 01062 PyErr_Clear(); 01063 Py_DECREF(thunk); 01064 thunk = NULL; 01065 } 01066 01067 return thunk; } 01068 01069 ////////////////////// 01070 //// Module init 01071 ////////////////////// 01072 static PyMethodDef MyMethods[] = { 01073 {"instantiate", instantiate, METH_VARARGS, "undocumented"} , 01074 {NULL, NULL, 0, NULL} 01075 }; 01076 static struct PyModuleDef moduledef = { 01077 PyModuleDef_HEAD_INIT, 01078 "mc5f5cd0a775ddf65c3076967cfc93ba8", 01079 NULL, 01080 -1, 01081 MyMethods, 01082 }; 01083 01084 PyMODINIT_FUNC PyInit_mc5f5cd0a775ddf65c3076967cfc93ba8(void) { 01085 import_array(); 01086 PyObject *m = PyModule_Create(&moduledef); 01087 return m; 01088 } 01089 Problem occurred during compilation with the command line below: /usr/bin/g++ -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wl,-rpath,/usr/local/lib -march=core-avx-i -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=25600 -mtune=core-avx-i -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/numpy/core/include -I/home/zeqi/anaconda3/envs/rllab3/include/python3.5m -I/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof -fvisibility=hidden -o /home/zeqi/.theano/compiledir_Linux-3.13--generic-x86_64-with-debian-jessie-sid-x86_64-3.5.2-64/tmps3dq9p27/mc5f5cd0a775ddf65c3076967cfc93ba8.so /home/zeqi/.theano/compiledir_Linux-3.13--generic-x86_64-with-debian-jessie-sid-x86_64-3.5.2-64/tmps3dq9p27/mod.cpp -L/usr/local/lib -L/home/zeqi/anaconda3/envs/rllab3/lib -lopenblas -lpython3.5m =============================== =============================== /usr/bin/ld: /usr/local/lib/libpython3.5m.a(exceptions.o): relocation R_X86_64_32S against `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.5m.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status Traceback (most recent call last): File "trpo_cartpole.py", line 12, in <module> hidden_sizes=(32, 32) File "/home/zeqi/zijie/rllab/rllab/policies/gaussian_mlp_policy.py", line 115, in __init__ outputs=[mean_var, log_std_var], File "/home/zeqi/zijie/rllab/rllab/misc/ext.py", line 135, in compile_function **kwargs File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/compile/function.py", line 322, in function output_keys=output_keys) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/compile/pfunc.py", line 480, in pfunc output_keys=output_keys) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/compile/function_module.py", line 1784, in orig_function defaults) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/compile/function_module.py", line 1648, in create input_storage=input_storage_lists, storage_map=storage_map) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/link.py", line 693, in make_thunk storage_map=storage_map)[:3] File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/vm.py", line 1034, in make_all no_recycling)) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/op.py", line 969, in make_thunk no_recycling) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/op.py", line 872, in make_c_thunk output_storage=node_output_storage) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cc.py", line 1200, in make_thunk keep_lock=keep_lock) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cc.py", line 1143, in __compile__ keep_lock=keep_lock) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cc.py", line 1591, in cthunk_factory key=key, lnk=self, keep_lock=keep_lock) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cmodule.py", line 1145, in module_from_key module = lnk.compile_cmodule(location) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cc.py", line 1502, in compile_cmodule preargs=preargs) File "/home/zeqi/anaconda3/envs/rllab3/lib/python3.5/site-packages/theano/gof/cmodule.py", line 2282, in compile_str (status, compile_stderr.replace('\n', '. '))) Exception: ('The following error happened while compiling the node', Dot22(input, hidden_0.W), '\n', "Compilation failed (return status=1): /usr/bin/ld: /usr/local/lib/libpython3.5m.a(exceptions.o): relocation R_X86_64_32S against `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC. /usr/local/lib/libpython3.5m.a: error adding symbols: Bad value. collect2: error: ld returned 1 exit status. ", '[Dot22(input, hidden_0.W)]')
Hmm sorry I don't have much clue about this error. Maybe it's better to submit to the Theano repo?
Hi, I tried to install Theano followed by the instructions provided in the
environment.yml
.However when I ran the example code, it reported the following issues