From a4b75de60dcec0621812df5edb22985fc9a28165 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 16 Aug 2022 15:50:05 -0700 Subject: [PATCH 01/15] First stab at using new numpy version. Perhaps the problem is using deprecated API? Updating this turned out to just involve a lot of casting PyObjects to PyArrayObjects. Which seems a little ham-fisted, but hey. --- wrappers/Python/roadrunner/PyUtils.cpp | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index f769c24471..ea126d8354 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -45,7 +45,7 @@ #define NO_IMPORT_ARRAY #define PY_ARRAY_UNIQUE_SYMBOL RoadRunner_ARRAY_API //Still using some of deprecated wrappers -//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include #include @@ -490,9 +490,9 @@ namespace rr { if (pyres) { - assert(PyArray_NBYTES(pyres) == rows * cols * sizeof(double) && "invalid array size"); + assert(PyArray_NBYTES((PyArrayObject*) pyres) == rows * cols * sizeof(double) && "invalid array size"); - double *data = (double *) PyArray_BYTES(pyres); + double *data = (double *) PyArray_BYTES((PyArrayObject*)pyres); memcpy(data, mData, sizeof(double) * rows * cols); } @@ -535,10 +535,10 @@ namespace rr { pArray = NamedArray_New(nd, dims, nullptr, 0, mat); } - VERIFY_PYARRAY(pArray); + VERIFY_PYARRAY((PyArrayObject*)pArray); // copy our data into the numpy array - double *data = static_cast(PyArray_DATA(pArray)); + double *data = static_cast(PyArray_DATA((PyArrayObject*)pArray)); memcpy(data, mat->getArray(), sizeof(double) * rows * cols); } else { @@ -559,7 +559,7 @@ namespace rr { NPY_ARRAY_CARRAY, mat); } - VERIFY_PYARRAY(pArray); + VERIFY_PYARRAY((PyArrayObject*)pArray); } rrLogDebug << "Done" << std::endl; @@ -656,7 +656,7 @@ namespace rr { */ static PyObject *NammedArray_subscript(NamedArrayObject *self, PyObject *op) { binaryfunc PyArray_subscript = PyArray_Type.tp_as_mapping->mp_subscript; - int dim = PyArray_NDIM(self); + int dim = PyArray_NDIM((PyArrayObject*)self); # if PY_MAJOR_VERSION == 3 if (dim == 2 && PyUnicode_Check(op)) { @@ -673,16 +673,16 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { - npy_intp rows = PyArray_DIM(self, 0); - npy_intp cols = PyArray_DIM(self, 1); + npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); + npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {rows}; PyObject *result = PyArray_New(&PyArray_Type, 1, dims, NPY_DOUBLE, NULL, NULL, 0, NPY_ARRAY_CARRAY, NULL); // copy data to result array - double *data = (double *) PyArray_DATA(self); - double *newData = (double *) PyArray_DATA(result); + double *data = (double *) PyArray_DATA((PyArrayObject*)self); + double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < rows; ++i) { newData[i] = data[(i * cols) + col]; @@ -709,16 +709,16 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { - npy_intp rows = PyArray_DIM(self, 0); - npy_intp cols = PyArray_DIM(self, 1); + npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); + npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {cols}; PyObject *result = PyArray_New(&PyArray_Type, 1, dims, NPY_DOUBLE, NULL, NULL, 0, NPY_ARRAY_CARRAY, NULL); // copy data to result array - double *data = (double *) PyArray_DATA(self); - double *newData = (double *) PyArray_DATA(result); + double *data = (double *) PyArray_DATA((PyArrayObject*)self); + double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < cols; ++i) { newData[i] = data[(row * cols) + i]; @@ -830,7 +830,7 @@ namespace rr { return nullptr; } // number of dimensions - int nDims = PyArray_NDIM(self); + int nDims = PyArray_NDIM((PyArrayObject*)self); std::int64_t dim1 = 0; std::int64_t dim2 = 0; @@ -1445,9 +1445,9 @@ namespace rr { unsigned selfNdim = PyArray_NDIM(&self->array); npy_intp selfNRows = selfNdim > 0 ? PyArray_DIM(&self->array, 0) : -1; npy_intp selfNCols = selfNdim > 1 ? PyArray_DIM(&self->array, 1) : -1; - unsigned rhsfNdim = PyArray_NDIM(rhs); - npy_intp rhsNRows = rhsfNdim > 0 ? PyArray_DIM(rhs, 0) : -1; - npy_intp rhsNCols = rhsfNdim > 1 ? PyArray_DIM(rhs, 1) : -1; + unsigned rhsfNdim = PyArray_NDIM((PyArrayObject*)rhs); + npy_intp rhsNRows = rhsfNdim > 0 ? PyArray_DIM((PyArrayObject*)rhs, 0) : -1; + npy_intp rhsNCols = rhsfNdim > 1 ? PyArray_DIM((PyArrayObject*)rhs, 1) : -1; rrLogDebug << "Self address: " << self << " rhs addr : " << rhs; rrLogDebug << "selfNdim: " << selfNdim; From 5fd23f3c63c1c60c6dc971b90b9109c17c4d666e Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Fri, 19 Aug 2022 14:14:34 -0700 Subject: [PATCH 02/15] Lots more print statements for debugging. --- wrappers/Python/roadrunner/PyUtils.cpp | 64 ++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index ea126d8354..1575ba5213 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -45,7 +45,7 @@ #define NO_IMPORT_ARRAY #define PY_ARRAY_UNIQUE_SYMBOL RoadRunner_ARRAY_API //Still using some of deprecated wrappers -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#define NPY_NO_DEPRECATED_API NPY_1_23_API_VERSION #include #include @@ -434,6 +434,7 @@ namespace rr { PyObject *doublematrix_to_py(const ls::DoubleMatrix *m, bool structured_result, bool copy_result) { rrLogDebug << __FUNC__; ls::DoubleMatrix *mat = const_cast(m); + std::cout << "DM2p" << endl; // a valid array descriptor: // In [87]: b = array(array([0,1,2,3]), @@ -444,6 +445,7 @@ namespace rr { if (structured_result) { rrLogDebug << "Structured result path"; + std::cout << "DM2p structured" << endl; std::vector names = mat->getColNames(); unsigned int rows = mat->numRows(); @@ -488,10 +490,10 @@ namespace rr { PyObject *pyres = PyArray_SimpleNewFromDescr(1, dims, descr); // VERIFY_PYARRAY(pyres); - if (pyres) { - - assert(PyArray_NBYTES((PyArrayObject*) pyres) == rows * cols * sizeof(double) && "invalid array size"); + if (PyArray_Check(pyres)) { + assert(PyArray_NBYTES(pyres) == rows * cols * sizeof(double) && "invalid array size"); + std::cout << "Use #1" << endl; double *data = (double *) PyArray_BYTES((PyArrayObject*)pyres); memcpy(data, mData, sizeof(double) * rows * cols); @@ -502,6 +504,7 @@ namespace rr { // standard array result. // this version just wraps the roadrunner owned data. else { + std::cout << "DM2p 0" << endl; int rows = mat->numRows(); int cols = mat->numCols(); PyObject *pArray = NULL; @@ -532,12 +535,15 @@ namespace rr { rrLogDebug << "2D array"; int nd = 2; npy_intp dims[2] = {rows, cols}; + std::cout << "DM2p 01" << endl; pArray = NamedArray_New(nd, dims, nullptr, 0, mat); + std::cout << "DM2p 02" << endl; } - VERIFY_PYARRAY((PyArrayObject*)pArray); + VERIFY_PYARRAY(pArray); // copy our data into the numpy array + std::cout << "Use #2" << endl; double *data = static_cast(PyArray_DATA((PyArrayObject*)pArray)); memcpy(data, mat->getArray(), sizeof(double) * rows * cols); @@ -559,7 +565,7 @@ namespace rr { NPY_ARRAY_CARRAY, mat); } - VERIFY_PYARRAY((PyArrayObject*)pArray); + VERIFY_PYARRAY(pArray); } rrLogDebug << "Done" << std::endl; @@ -656,6 +662,7 @@ namespace rr { */ static PyObject *NammedArray_subscript(NamedArrayObject *self, PyObject *op) { binaryfunc PyArray_subscript = PyArray_Type.tp_as_mapping->mp_subscript; + std::cout << "Use #3" << endl; int dim = PyArray_NDIM((PyArrayObject*)self); # if PY_MAJOR_VERSION == 3 @@ -673,7 +680,9 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { + std::cout << "Use #4" << endl; npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); + std::cout << "Use #5" << endl; npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {rows}; @@ -681,7 +690,9 @@ namespace rr { NPY_ARRAY_CARRAY, NULL); // copy data to result array + std::cout << "Use #6" << endl; double *data = (double *) PyArray_DATA((PyArrayObject*)self); + std::cout << "Use #7" << endl; double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < rows; ++i) { @@ -709,7 +720,9 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { + std::cout << "Use #8" << endl; npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); + std::cout << "Use #9" << endl; npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {cols}; @@ -717,7 +730,9 @@ namespace rr { NPY_ARRAY_CARRAY, NULL); // copy data to result array + std::cout << "Use #10" << endl; double *data = (double *) PyArray_DATA((PyArrayObject*)self); + std::cout << "Use #11" << endl; double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < cols; ++i) { @@ -830,6 +845,7 @@ namespace rr { return nullptr; } // number of dimensions + std::cout << "Use #12" << endl; int nDims = PyArray_NDIM((PyArrayObject*)self); std::int64_t dim1 = 0; std::int64_t dim2 = 0; @@ -1119,6 +1135,7 @@ namespace rr { // and this is the implementation that we are using, but note // its harder to trace the memory footprint and may contain bugs. self->rowNames = getItemFromDictWithErrChecking(state, "rownames"); + std::cout << "rownames new ref from dict " << self->rowNames << endl; Py_IncRef(self->rowNames); for (int i = 0; i < PyList_Size(self->rowNames); i++) Py_IncRef(PyList_GetItem(self->rowNames, i)); @@ -1193,6 +1210,7 @@ namespace rr { */ // PyArray_New calls finalizeObject twice, once for the pyarray and // again for the subtype + std::cout << "NA_N 0" << endl; NamedArrayObject *array = (NamedArrayObject *) PyArray_New( &NamedArray_Type, // PyTypeObject* subtype, nd, // int nd @@ -1204,6 +1222,7 @@ namespace rr { pyFlags, // int flags, nullptr // PyObject* obj ); + std::cout << "NA_N 01" << endl; if (array == NULL) { const char *error = rrGetPyErrMessage(); rrLog(Logger::LOG_CRITICAL) << error; @@ -1211,17 +1230,26 @@ namespace rr { return NULL; } - if (PyList_Size(array->rowNames) != 0) { + std::cout << "NA_N 02" << endl; + std::cout << "array:" << endl; + std::cout << array << endl; + std::cout << "rowNames:" << array->rowNames << endl; + if (!array->rowNames || PyList_Size(array->rowNames) != 0) { + std::cout << "NA_N err 02" << endl; PyErr_SetString(PyExc_ValueError, "Expecting empty initialized list for array->rowNames."); return nullptr; } + std::cout << "NA_N 03" << endl; if (PyList_Size(array->colNames) != 0) { PyErr_SetString(PyExc_ValueError, "Expecting empty initialized list for array->colNames."); return nullptr; } + std::cout << "NA_N 04" << endl; array->rowNames = stringvector_to_py(mat->getRowNames()); + std::cout << "NA_N 05" << endl; array->colNames = stringvector_to_py(mat->getColNames()); + std::cout << "NA_N 06" << endl; return (PyObject *) array; @@ -1344,13 +1372,20 @@ namespace rr { return nullptr; } namedArrayObject->rowNames = PyList_New(0); + std::cout << "rownames new ref " << namedArrayObject->rowNames << endl; + std::cout << "rownames added to object " << namedArrayObject << endl; + std::cout << "rownames size " << PyList_Size(namedArrayObject->rowNames) << endl; + Py_IncRef(namedArrayObject->rowNames); namedArrayObject->colNames = PyList_New(0); PyObject *obj = PyObject_Init((PyObject *) namedArrayObject, type); if (!obj) { PyErr_SetString(PyExc_MemoryError, "Could not initialize object of type 'NamedArray'"); return nullptr; } + std::cout << "rownames ref " << ((NamedArrayObject*)obj)->rowNames << endl; + std::cout << "rownames size " << PyList_Size(((NamedArrayObject*) obj)->rowNames) << endl; rrLogDebug << "namedArrayObject allocated: " << namedArrayObject; + rrLogDebug << "namedArrayObject returned obj: " << obj; rrLogDebug << "Done" << std::endl; return obj; } @@ -1362,6 +1397,8 @@ namespace rr { PyObject *NamedArrayObject_Finalize_FromConstructor(NamedArrayObject *self) { rrLogDebug << __FUNC__; + std::cout << "rownames ref " << self->rowNames << endl; + //std::cout << "At start: rownames size " << PyList_Size(self->rowNames) << endl; if (!self->rowNames) { rrLogDebug << "No rownames in self, using empty list instead"; PyObject *rows = PyList_New(0); @@ -1370,6 +1407,7 @@ namespace rr { Py_RETURN_NONE; } self->rowNames = rows; + std::cout << "rownames new ref " << self->rowNames << endl; } if (!self->colNames) { rrLogDebug << "No colnames in self, using empty list instead"; @@ -1382,6 +1420,8 @@ namespace rr { } // Note it seems that we do not need to increment the ref count // for these new lists. + std::cout << "rownames ref " << self->rowNames << endl; + //std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; // and assign rrLogDebug << "Done" << std::endl; @@ -1445,6 +1485,7 @@ namespace rr { unsigned selfNdim = PyArray_NDIM(&self->array); npy_intp selfNRows = selfNdim > 0 ? PyArray_DIM(&self->array, 0) : -1; npy_intp selfNCols = selfNdim > 1 ? PyArray_DIM(&self->array, 1) : -1; + std::cout << "Use #13" << endl; unsigned rhsfNdim = PyArray_NDIM((PyArrayObject*)rhs); npy_intp rhsNRows = rhsfNdim > 0 ? PyArray_DIM((PyArrayObject*)rhs, 0) : -1; npy_intp rhsNCols = rhsfNdim > 1 ? PyArray_DIM((PyArrayObject*)rhs, 1) : -1; @@ -1579,6 +1620,7 @@ namespace rr { // Some docs on why this is needed: https://numpy.org/devdocs/user/basics.subclassing.html // when self is passed, the ref count of array goes up. rrLogDebug << __FUNC__; + std::cout << "rownames ref " << self->rowNames << endl; PyObject *rhs; if (PyArg_ParseTuple(args, "O", &rhs) < 0) { @@ -1586,7 +1628,9 @@ namespace rr { return nullptr; } rrLogDebug << "finalizing object self: " << self << "; args " << rhs; -// rrLogDebug << "rhs->ob_type->ob_base.ob_base.ob_type: " << rhs->; + std::cout << "rownames ref " << self->rowNames << endl; + //std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; + // rrLogDebug << "rhs->ob_type->ob_base.ob_base.ob_type: " << rhs->; // when NamedArray instantiated with constructor // >>> n = NamedArray((3, 4)) # 1 @@ -1599,6 +1643,7 @@ namespace rr { // the isSubclass part was added to patch issue 873 // It may not be ideal, but it does fix the problem. if (rhs == Py_None || isSubclassOfPyArray(rhs)) { + //std::cout << "rownames size almost exiting " << PyList_Size(self->rowNames) << endl; rrLogDebug << "NamedArrayObject initialized from constructor. 'None' path taken"; return NamedArrayObject_Finalize_FromConstructor(self); } else if (rhs->ob_type == &PyArray_Type) { @@ -1614,8 +1659,11 @@ namespace rr { "Unexpected type passed to NamedArrayObject_Finalize for the args parameter"); } // decrement the refcount as we're done with this scope + std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; Py_DecRef((PyObject *) &self->array); rrLogDebug << "Done" << std::endl; + std::cout << "rownames ref " << self->rowNames << endl; + std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; Py_RETURN_NONE; } From 3447736266352070aa2d296f3d90e608ae2fdd0c Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 6 Sep 2022 12:15:46 -0700 Subject: [PATCH 03/15] Add buffer. --- wrappers/Python/roadrunner/PyUtils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wrappers/Python/roadrunner/PyUtils.h b/wrappers/Python/roadrunner/PyUtils.h index 25fbbe5117..7e832a2603 100644 --- a/wrappers/Python/roadrunner/PyUtils.h +++ b/wrappers/Python/roadrunner/PyUtils.h @@ -123,6 +123,10 @@ namespace rr { Dictionary *Dictionary_from_py(PyObject *py); + struct numpy_space { + void* future_space_reserved_for_numpy[2]; + }; + // docs: https://numpy.org/devdocs/user/c-info.beyond-basics.html#subtyping-the-ndarray-in-c struct NamedArrayObject { /** @@ -130,6 +134,7 @@ namespace rr { * See PyArrayObject_fields in numpy ndarraytypes.h */ PyArrayObject array; + numpy_space reserved_for_numpy; PyObject *rowNames = nullptr; PyObject *colNames = nullptr; From 0bb8499c002795d6e707bef745f57da87f74afaf Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 6 Sep 2022 13:14:48 -0700 Subject: [PATCH 04/15] Remove print statements. --- wrappers/Python/roadrunner/PyUtils.cpp | 51 +------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index 1575ba5213..27d52d9f33 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -434,7 +434,6 @@ namespace rr { PyObject *doublematrix_to_py(const ls::DoubleMatrix *m, bool structured_result, bool copy_result) { rrLogDebug << __FUNC__; ls::DoubleMatrix *mat = const_cast(m); - std::cout << "DM2p" << endl; // a valid array descriptor: // In [87]: b = array(array([0,1,2,3]), @@ -445,14 +444,13 @@ namespace rr { if (structured_result) { rrLogDebug << "Structured result path"; - std::cout << "DM2p structured" << endl; std::vector names = mat->getColNames(); unsigned int rows = mat->numRows(); unsigned int cols = mat->numCols(); - std::cout << "num rows: " << rows; - std::cout << "num cols: " << cols; + //std::cout << "num rows: " << rows; + //std::cout << "num cols: " << cols; if (cols == 0) { rrLogDebug << "No columns, returning None"; @@ -493,7 +491,6 @@ namespace rr { if (PyArray_Check(pyres)) { assert(PyArray_NBYTES(pyres) == rows * cols * sizeof(double) && "invalid array size"); - std::cout << "Use #1" << endl; double *data = (double *) PyArray_BYTES((PyArrayObject*)pyres); memcpy(data, mData, sizeof(double) * rows * cols); @@ -504,7 +501,6 @@ namespace rr { // standard array result. // this version just wraps the roadrunner owned data. else { - std::cout << "DM2p 0" << endl; int rows = mat->numRows(); int cols = mat->numCols(); PyObject *pArray = NULL; @@ -535,15 +531,12 @@ namespace rr { rrLogDebug << "2D array"; int nd = 2; npy_intp dims[2] = {rows, cols}; - std::cout << "DM2p 01" << endl; pArray = NamedArray_New(nd, dims, nullptr, 0, mat); - std::cout << "DM2p 02" << endl; } VERIFY_PYARRAY(pArray); // copy our data into the numpy array - std::cout << "Use #2" << endl; double *data = static_cast(PyArray_DATA((PyArrayObject*)pArray)); memcpy(data, mat->getArray(), sizeof(double) * rows * cols); @@ -662,7 +655,6 @@ namespace rr { */ static PyObject *NammedArray_subscript(NamedArrayObject *self, PyObject *op) { binaryfunc PyArray_subscript = PyArray_Type.tp_as_mapping->mp_subscript; - std::cout << "Use #3" << endl; int dim = PyArray_NDIM((PyArrayObject*)self); # if PY_MAJOR_VERSION == 3 @@ -680,9 +672,7 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { - std::cout << "Use #4" << endl; npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); - std::cout << "Use #5" << endl; npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {rows}; @@ -690,9 +680,7 @@ namespace rr { NPY_ARRAY_CARRAY, NULL); // copy data to result array - std::cout << "Use #6" << endl; double *data = (double *) PyArray_DATA((PyArrayObject*)self); - std::cout << "Use #7" << endl; double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < rows; ++i) { @@ -720,9 +708,7 @@ namespace rr { if (strcmp(keyName, itemStr) == 0) { - std::cout << "Use #8" << endl; npy_intp rows = PyArray_DIM((PyArrayObject*)self, 0); - std::cout << "Use #9" << endl; npy_intp cols = PyArray_DIM((PyArrayObject*)self, 1); npy_intp dims[1] = {cols}; @@ -730,9 +716,7 @@ namespace rr { NPY_ARRAY_CARRAY, NULL); // copy data to result array - std::cout << "Use #10" << endl; double *data = (double *) PyArray_DATA((PyArrayObject*)self); - std::cout << "Use #11" << endl; double *newData = (double *) PyArray_DATA((PyArrayObject*)result); for (int i = 0; i < cols; ++i) { @@ -845,7 +829,6 @@ namespace rr { return nullptr; } // number of dimensions - std::cout << "Use #12" << endl; int nDims = PyArray_NDIM((PyArrayObject*)self); std::int64_t dim1 = 0; std::int64_t dim2 = 0; @@ -1135,7 +1118,6 @@ namespace rr { // and this is the implementation that we are using, but note // its harder to trace the memory footprint and may contain bugs. self->rowNames = getItemFromDictWithErrChecking(state, "rownames"); - std::cout << "rownames new ref from dict " << self->rowNames << endl; Py_IncRef(self->rowNames); for (int i = 0; i < PyList_Size(self->rowNames); i++) Py_IncRef(PyList_GetItem(self->rowNames, i)); @@ -1210,7 +1192,6 @@ namespace rr { */ // PyArray_New calls finalizeObject twice, once for the pyarray and // again for the subtype - std::cout << "NA_N 0" << endl; NamedArrayObject *array = (NamedArrayObject *) PyArray_New( &NamedArray_Type, // PyTypeObject* subtype, nd, // int nd @@ -1222,7 +1203,6 @@ namespace rr { pyFlags, // int flags, nullptr // PyObject* obj ); - std::cout << "NA_N 01" << endl; if (array == NULL) { const char *error = rrGetPyErrMessage(); rrLog(Logger::LOG_CRITICAL) << error; @@ -1230,26 +1210,17 @@ namespace rr { return NULL; } - std::cout << "NA_N 02" << endl; - std::cout << "array:" << endl; - std::cout << array << endl; - std::cout << "rowNames:" << array->rowNames << endl; if (!array->rowNames || PyList_Size(array->rowNames) != 0) { - std::cout << "NA_N err 02" << endl; PyErr_SetString(PyExc_ValueError, "Expecting empty initialized list for array->rowNames."); return nullptr; } - std::cout << "NA_N 03" << endl; if (PyList_Size(array->colNames) != 0) { PyErr_SetString(PyExc_ValueError, "Expecting empty initialized list for array->colNames."); return nullptr; } - std::cout << "NA_N 04" << endl; array->rowNames = stringvector_to_py(mat->getRowNames()); - std::cout << "NA_N 05" << endl; array->colNames = stringvector_to_py(mat->getColNames()); - std::cout << "NA_N 06" << endl; return (PyObject *) array; @@ -1372,9 +1343,6 @@ namespace rr { return nullptr; } namedArrayObject->rowNames = PyList_New(0); - std::cout << "rownames new ref " << namedArrayObject->rowNames << endl; - std::cout << "rownames added to object " << namedArrayObject << endl; - std::cout << "rownames size " << PyList_Size(namedArrayObject->rowNames) << endl; Py_IncRef(namedArrayObject->rowNames); namedArrayObject->colNames = PyList_New(0); PyObject *obj = PyObject_Init((PyObject *) namedArrayObject, type); @@ -1382,8 +1350,6 @@ namespace rr { PyErr_SetString(PyExc_MemoryError, "Could not initialize object of type 'NamedArray'"); return nullptr; } - std::cout << "rownames ref " << ((NamedArrayObject*)obj)->rowNames << endl; - std::cout << "rownames size " << PyList_Size(((NamedArrayObject*) obj)->rowNames) << endl; rrLogDebug << "namedArrayObject allocated: " << namedArrayObject; rrLogDebug << "namedArrayObject returned obj: " << obj; rrLogDebug << "Done" << std::endl; @@ -1397,8 +1363,6 @@ namespace rr { PyObject *NamedArrayObject_Finalize_FromConstructor(NamedArrayObject *self) { rrLogDebug << __FUNC__; - std::cout << "rownames ref " << self->rowNames << endl; - //std::cout << "At start: rownames size " << PyList_Size(self->rowNames) << endl; if (!self->rowNames) { rrLogDebug << "No rownames in self, using empty list instead"; PyObject *rows = PyList_New(0); @@ -1407,7 +1371,6 @@ namespace rr { Py_RETURN_NONE; } self->rowNames = rows; - std::cout << "rownames new ref " << self->rowNames << endl; } if (!self->colNames) { rrLogDebug << "No colnames in self, using empty list instead"; @@ -1420,8 +1383,6 @@ namespace rr { } // Note it seems that we do not need to increment the ref count // for these new lists. - std::cout << "rownames ref " << self->rowNames << endl; - //std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; // and assign rrLogDebug << "Done" << std::endl; @@ -1485,7 +1446,6 @@ namespace rr { unsigned selfNdim = PyArray_NDIM(&self->array); npy_intp selfNRows = selfNdim > 0 ? PyArray_DIM(&self->array, 0) : -1; npy_intp selfNCols = selfNdim > 1 ? PyArray_DIM(&self->array, 1) : -1; - std::cout << "Use #13" << endl; unsigned rhsfNdim = PyArray_NDIM((PyArrayObject*)rhs); npy_intp rhsNRows = rhsfNdim > 0 ? PyArray_DIM((PyArrayObject*)rhs, 0) : -1; npy_intp rhsNCols = rhsfNdim > 1 ? PyArray_DIM((PyArrayObject*)rhs, 1) : -1; @@ -1620,7 +1580,6 @@ namespace rr { // Some docs on why this is needed: https://numpy.org/devdocs/user/basics.subclassing.html // when self is passed, the ref count of array goes up. rrLogDebug << __FUNC__; - std::cout << "rownames ref " << self->rowNames << endl; PyObject *rhs; if (PyArg_ParseTuple(args, "O", &rhs) < 0) { @@ -1628,8 +1587,6 @@ namespace rr { return nullptr; } rrLogDebug << "finalizing object self: " << self << "; args " << rhs; - std::cout << "rownames ref " << self->rowNames << endl; - //std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; // rrLogDebug << "rhs->ob_type->ob_base.ob_base.ob_type: " << rhs->; // when NamedArray instantiated with constructor @@ -1643,7 +1600,6 @@ namespace rr { // the isSubclass part was added to patch issue 873 // It may not be ideal, but it does fix the problem. if (rhs == Py_None || isSubclassOfPyArray(rhs)) { - //std::cout << "rownames size almost exiting " << PyList_Size(self->rowNames) << endl; rrLogDebug << "NamedArrayObject initialized from constructor. 'None' path taken"; return NamedArrayObject_Finalize_FromConstructor(self); } else if (rhs->ob_type == &PyArray_Type) { @@ -1659,11 +1615,8 @@ namespace rr { "Unexpected type passed to NamedArrayObject_Finalize for the args parameter"); } // decrement the refcount as we're done with this scope - std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; Py_DecRef((PyObject *) &self->array); rrLogDebug << "Done" << std::endl; - std::cout << "rownames ref " << self->rowNames << endl; - std::cout << "rownames size " << PyList_Size(self->rowNames) << endl; Py_RETURN_NONE; } From d6b6879388d5ec332e4fa8be9672c94327c24fc1 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 6 Sep 2022 13:35:25 -0700 Subject: [PATCH 05/15] Cast objects for checks. --- wrappers/Python/roadrunner/PyUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index 27d52d9f33..15d97ff04c 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -490,7 +490,7 @@ namespace rr { if (PyArray_Check(pyres)) { - assert(PyArray_NBYTES(pyres) == rows * cols * sizeof(double) && "invalid array size"); + assert(PyArray_NBYTES((PyArrayObject*)pyres) == rows * cols * sizeof(double) && "invalid array size"); double *data = (double *) PyArray_BYTES((PyArrayObject*)pyres); memcpy(data, mData, sizeof(double) * rows * cols); @@ -534,7 +534,7 @@ namespace rr { pArray = NamedArray_New(nd, dims, nullptr, 0, mat); } - VERIFY_PYARRAY(pArray); + VERIFY_PYARRAY((PyArrayObject*)pArray); // copy our data into the numpy array double *data = static_cast(PyArray_DATA((PyArrayObject*)pArray)); @@ -558,7 +558,7 @@ namespace rr { NPY_ARRAY_CARRAY, mat); } - VERIFY_PYARRAY(pArray); + VERIFY_PYARRAY((PyArrayObject*)pArray); } rrLogDebug << "Done" << std::endl; From ab527f4a9894b1ae8000fdbcb021f6a67d502b6a Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 6 Sep 2022 13:43:39 -0700 Subject: [PATCH 06/15] Remove experimental addref. Also, make other changes more compatible with original. --- wrappers/Python/roadrunner/PyUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index 15d97ff04c..0a09d802cc 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -491,6 +491,7 @@ namespace rr { if (PyArray_Check(pyres)) { assert(PyArray_NBYTES((PyArrayObject*)pyres) == rows * cols * sizeof(double) && "invalid array size"); + double *data = (double *) PyArray_BYTES((PyArrayObject*)pyres); memcpy(data, mData, sizeof(double) * rows * cols); @@ -1343,7 +1344,6 @@ namespace rr { return nullptr; } namedArrayObject->rowNames = PyList_New(0); - Py_IncRef(namedArrayObject->rowNames); namedArrayObject->colNames = PyList_New(0); PyObject *obj = PyObject_Init((PyObject *) namedArrayObject, type); if (!obj) { @@ -1587,7 +1587,7 @@ namespace rr { return nullptr; } rrLogDebug << "finalizing object self: " << self << "; args " << rhs; - // rrLogDebug << "rhs->ob_type->ob_base.ob_base.ob_type: " << rhs->; + //rrLogDebug << "rhs->ob_type->ob_base.ob_base.ob_type: " << rhs->; // when NamedArray instantiated with constructor // >>> n = NamedArray((3, 4)) # 1 From 171a2822622d1da164d464f64868fd2587ebfbb6 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Wed, 7 Sep 2022 09:26:40 -0700 Subject: [PATCH 07/15] Comment out the NPY_NO_DEPRECATED_API define again. --- wrappers/Python/roadrunner/PyUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/Python/roadrunner/PyUtils.cpp b/wrappers/Python/roadrunner/PyUtils.cpp index 0a09d802cc..fd98ffe2cd 100644 --- a/wrappers/Python/roadrunner/PyUtils.cpp +++ b/wrappers/Python/roadrunner/PyUtils.cpp @@ -45,7 +45,7 @@ #define NO_IMPORT_ARRAY #define PY_ARRAY_UNIQUE_SYMBOL RoadRunner_ARRAY_API //Still using some of deprecated wrappers -#define NPY_NO_DEPRECATED_API NPY_1_23_API_VERSION +//#define NPY_NO_DEPRECATED_API NPY_1_23_API_VERSION #include #include From 0b159a23ec7582c4317ab7923f847ce7461cb969 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Wed, 25 Jan 2023 10:48:19 -0800 Subject: [PATCH 08/15] Update README.txt --- rrplugins/examples/python/bifurcation/README.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rrplugins/examples/python/bifurcation/README.txt b/rrplugins/examples/python/bifurcation/README.txt index adcd491860..8deee1e0c2 100644 --- a/rrplugins/examples/python/bifurcation/README.txt +++ b/rrplugins/examples/python/bifurcation/README.txt @@ -3,7 +3,7 @@ Folder containing example/demo scripts demonstrating usage of the bifurcation pl Any questions about the examples can be addressed to Totte Karlsson (totte@dunescientific.com) ============================================================================================== -OBSERVE: Make sure you have properly installed Tellurium plugins in your python environment -before running any of these scripts. A good test is to execute 'import telplugins', with no quotes, at your python -prompt. It should come back with no message. +NOTE: Make sure you have properly installed Tellurium plugins in your python environment +before running any of these scripts. A good test is to execute 'import rrplugins', with no quotes, +at your python prompt. It should come back with no message. ============================================================================================== From f6b46843d8fee21a369bf2324afd1994e5577fc6 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Fri, 3 Feb 2023 16:46:09 -0800 Subject: [PATCH 09/15] Fix events being able to fire at t0 in level 2. Also, update version number. --- CMakeLists.txt | 2 +- source/llvm/LLVMModelDataSymbols.cpp | 2 +- test/models/SBMLFeatures/t0_firing_l2v1.xml | 52 +++++++++++++++++++++ test/models/SBMLFeatures/t0_firing_l3v1.xml | 52 +++++++++++++++++++++ test/sbml_features/CMakeLists.txt | 1 + test/sbml_features/events.cpp | 52 +++++++++++++++++++++ 6 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 test/models/SBMLFeatures/t0_firing_l2v1.xml create mode 100644 test/models/SBMLFeatures/t0_firing_l3v1.xml create mode 100644 test/sbml_features/events.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c9d349e9..d44e839f52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16) set(ROADRUNNER_VERSION_MAJOR 2) set(ROADRUNNER_VERSION_MINOR 3) -set(ROADRUNNER_VERSION_PATCH 1) +set(ROADRUNNER_VERSION_PATCH 2) set(ROADRUNNER_VERSION "${ROADRUNNER_VERSION_MAJOR}.${ROADRUNNER_VERSION_MINOR}.${ROADRUNNER_VERSION_PATCH}") diff --git a/source/llvm/LLVMModelDataSymbols.cpp b/source/llvm/LLVMModelDataSymbols.cpp index fbf0a26850..b82c3df8fc 100644 --- a/source/llvm/LLVMModelDataSymbols.cpp +++ b/source/llvm/LLVMModelDataSymbols.cpp @@ -1577,7 +1577,7 @@ void LLVMModelDataSymbols::initEvents(const libsbml::Model* model) const Trigger *trigger = event->getTrigger(); assert(trigger && "must have trigger"); - if (trigger->isSetInitialValue() && trigger->getInitialValue()) + if (trigger->getInitialValue() || !trigger->isSetInitialValue()) { attr = attr | EventInitialValue; } diff --git a/test/models/SBMLFeatures/t0_firing_l2v1.xml b/test/models/SBMLFeatures/t0_firing_l2v1.xml new file mode 100644 index 0000000000..d42312e032 --- /dev/null +++ b/test/models/SBMLFeatures/t0_firing_l2v1.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + a + 3 + + + + + + + 7 + + + + + + + + + + b + 4 + + + + + + + 8 + + + + + + + diff --git a/test/models/SBMLFeatures/t0_firing_l3v1.xml b/test/models/SBMLFeatures/t0_firing_l3v1.xml new file mode 100644 index 0000000000..fd32512ffe --- /dev/null +++ b/test/models/SBMLFeatures/t0_firing_l3v1.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + a + 3 + + + + + + + 7 + + + + + + + + + + b + 4 + + + + + + + 8 + + + + + + + diff --git a/test/sbml_features/CMakeLists.txt b/test/sbml_features/CMakeLists.txt index 05bdb81b71..469652fdb7 100644 --- a/test/sbml_features/CMakeLists.txt +++ b/test/sbml_features/CMakeLists.txt @@ -4,6 +4,7 @@ add_test_executable( boolean_delay.cpp invalid_sbml.cpp valid_sbml.cpp + events.cpp ) # make test_targets list global to all tests diff --git a/test/sbml_features/events.cpp b/test/sbml_features/events.cpp new file mode 100644 index 0000000000..c6bdc7dae6 --- /dev/null +++ b/test/sbml_features/events.cpp @@ -0,0 +1,52 @@ +#include "gtest/gtest.h" +#include "rrRoadRunner.h" +#include "rrException.h" +#include "rrUtils.h" +#include "rrTestSuiteModelSimulation.h" +#include "sbml/SBMLTypes.h" +#include "sbml/SBMLReader.h" +#include "../test_util.h" +#include +#include "RoadRunnerTest.h" + +using namespace testing; +using namespace rr; +using namespace std; +using std::filesystem::path; + +class SBMLFeatures : public RoadRunnerTest { +public: + path SBMLFeaturesDir = rrTestModelsDir_ / "SBMLFeatures"; + SBMLFeatures() = default; +}; + +TEST_F(SBMLFeatures, EVENT_T0_FIRING_L2) +{ + try + { + RoadRunner rri((SBMLFeaturesDir / "t0_firing_l2v1.xml").string()); + rri.simulate(); + EXPECT_EQ(rri.getValue(rri.createSelection("d")), 6.0); + } + catch (std::exception& ex) + { + std::cout << "Exception: " << ex.what() << std::endl; + EXPECT_TRUE(false); + } +} + +TEST_F(SBMLFeatures, EVENT_T0_FIRING_L3) +{ + try + { + RoadRunner rri((SBMLFeaturesDir / "t0_firing_l3v1.xml").string()); + rri.simulate(); + EXPECT_EQ(rri.getValue(rri.createSelection("d")), 6.0); + } + catch (std::exception& ex) + { + std::cout << "Exception: " << ex.what() << std::endl; + EXPECT_TRUE(false); + } +} + From a4e6ad27c52ed6419faf8defc7df343f5fb68431 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Mon, 13 Feb 2023 15:47:11 -0800 Subject: [PATCH 10/15] Update the docker image build system. The files in here have now been used to build new docker images, and the azure-pipelines.yml file updated to point to the new image. --- azure-pipelines.yml | 4 +- .../Dockerfile | 35 +++++ .../roadrunner-manylinux2014-base/Dockerfile | 44 ------ .../roadrunner-manylinux2014-build/Dockerfile | 139 ------------------ docker/roadrunner-manylinux2014/Dockerfile | 19 +++ 5 files changed, 56 insertions(+), 185 deletions(-) create mode 100644 docker/roadrunner-manylinux2014-add-deps/Dockerfile delete mode 100644 docker/roadrunner-manylinux2014-build/Dockerfile create mode 100644 docker/roadrunner-manylinux2014/Dockerfile diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 31e6cfb5ed..70c796745b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -973,7 +973,7 @@ stages: PythonName: py311 pool: vmImage: 'ubuntu-20.04' - container: sysbiouw/roadrunner-manylinux2014-base:latest + container: sysbiouw/roadrunner-manylinux2014:latest variables: CCACHE_DIR: '$(Pipeline.Workspace)/ccache' BUILD_DIRECTORY: '$(System.DefaultWorkingDirectory)/build' @@ -1068,7 +1068,7 @@ stages: $(PipExecutable) install -r $(SOURCE_DIR)/requirements.txt $(PipExecutable) install -r $(SOURCE_DIR)/test-requirements.txt - echo "cmake command: cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .." + echo "cmake command: cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .." cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .. cmake --build . --target install --config Release -j 12 diff --git a/docker/roadrunner-manylinux2014-add-deps/Dockerfile b/docker/roadrunner-manylinux2014-add-deps/Dockerfile new file mode 100644 index 0000000000..9f267b33ae --- /dev/null +++ b/docker/roadrunner-manylinux2014-add-deps/Dockerfile @@ -0,0 +1,35 @@ +# This dockerfile contains commands for a base environment suitable for +# building manylinux pip wheels. +# The default gcc/g++ is 9.3 +# Conda is used to manage Python versions. +# +# This dockerfile installs roadrunner dependencies and llvm package +# But does not build roadrunner, which is the subject of another dockerfile + +FROM sysbiouw/roadrunner-manylinux2014-base + +#RUN git clone https://github.com/sys-bio/llvm-13.x.git \ +# && cd llvm-13.x +#RUN cd /llvm-13.x/llvm && mkdir build && cd build \ +# && cmake -DCMAKE_INSTALL_PREFIX=/install-llvm-13.x -DCMAKE_BUILD_TYPE=Release .. +#RUN cd /llvm-13.x/llvm/build \ +# && cmake --build . --target install --config Release -j 12 +#RUN rm -rf /llvm-13.x +# +#RUN git clone https://github.com/sys-bio/libroadrunner-deps.git --recurse-submodules +#RUN cd libroadrunner-deps && mkdir build && cd build \ +# && cmake -DCMAKE_INSTALL_PREFIX=../install-libroadrunner-deps -DCMAKE_BUILD_TYPE=Release .. \ +# && cmake --build . --target install --config Release -j 12 + +#Run above to re-create build; for now, just use pre-built: + +RUN wget https://github.com/sys-bio/llvm-13.x/releases/download/llvmorg-13.0.0/llvm-13.x-manylinux2014.tgz \ + && tar -xvf llvm-13.x-manylinux2014.tgz \ + && rm llvm-13.x-manylinux2014.tgz + +RUN wget https://github.com/sys-bio/libroadrunner-deps/releases/download/v2.1/libroadrunner-deps-manylinux2014-Release.zip \ + && unzip libroadrunner-deps-manylinux2014-Release.zip \ + && rm libroadrunner-deps-manylinux2014-Release.zip \ + && mv libroadrunner-deps-manylinux2014-Release/install-azure/Release install-libroadrunner-deps + + diff --git a/docker/roadrunner-manylinux2014-base/Dockerfile b/docker/roadrunner-manylinux2014-base/Dockerfile index 181828ab9a..c1691289b6 100644 --- a/docker/roadrunner-manylinux2014-base/Dockerfile +++ b/docker/roadrunner-manylinux2014-base/Dockerfile @@ -21,23 +21,6 @@ RUN cd .. && rm -rf gcc-11.1.0 RUN yum install -y nano -RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /Miniconda3 - -RUN /Miniconda3/bin/conda create -y --name py37 python=3.7 pytest -RUN /Miniconda3/bin/conda create -y --name py38 python=3.8 pytest -RUN /Miniconda3/bin/conda create -y --name py39 python=3.9 pytest - -RUN /Miniconda3/bin/conda init && bash ~/.bashrc && . ~/.bashrc - -RUN git clone https://github.com/sys-bio/llvm-13.x.git \ - && cd llvm-13.x -RUN cd /llvm-13.x/llvm && mkdir build && cd build \ - && cmake -DCMAKE_INSTALL_PREFIX=/install-llvm-13.x -DCMAKE_BUILD_TYPE=Release .. -RUN cd /llvm-13.x/llvm/build \ - && cmake --build . --target install --config Release -j 12 -RUN rm -rf /llvm-13.x - RUN yum install -y pcre-devel.x86_64 ENV swig_source_dir /swig-4.0.2 @@ -73,31 +56,4 @@ RUN useradd -m user \ && yes password | passwd user RUN yum install -y initscripts -RUN git clone https://github.com/sys-bio/libroadrunner-deps.git --recurse-submodules -RUN cd libroadrunner-deps && mkdir build && cd build \ - && cmake -DCMAKE_INSTALL_PREFIX=../install-libroadrunner-deps -DCMAKE_BUILD_TYPE=Release .. \ - && cmake --build . --target install --config Release -j 12 - - -RUN printf "#!bin/bash \n\ -/Miniconda3/envs/py39/bin/pip install numpy\n\ -if [ ! -d /roadrunner ]; then\n\ - git clone https://github.com/sys-bio/roadrunner.git\n\ -fi\n\ -cd /roadrunner\n\ -mkdir build\n\ -cd build\n\ -cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_RR_PLUGINS=ON -DCMAKE_INSTALL_PREFIX=../../Roadrunner-release -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DBUILD_TESTS=ON -DBUILD_PYTHON=ON -DSWIG_EXECUTABLE=/swig-4.0.2/swig -DPython_ROOT_DIR=/Miniconda3/envs/py39 ..\n\ -cmake --build . --target install --config Release -j 16\n" > /build-roadrunner.sh - -# install valgrind -RUN wget https://sourceware.org/pub/valgrind/valgrind-3.18.1.tar.bz2 --no-check-certificate \ - && tar -xvf valgrind-3.18.1.tar.bz2\ - && cd valgrind-3.18.1/\ - && mkdir build\ - && cd build\ - && ../configure \ - && make -j 12\ - && make install - RUN yum install -y qt5-qtbase-devel check diff --git a/docker/roadrunner-manylinux2014-build/Dockerfile b/docker/roadrunner-manylinux2014-build/Dockerfile deleted file mode 100644 index fcaf682d2f..0000000000 --- a/docker/roadrunner-manylinux2014-build/Dockerfile +++ /dev/null @@ -1,139 +0,0 @@ -# This dockerfile contains commands for a base environment suitable for -# building manylinux pip wheels. -# The default gcc/g++ is 9.3 -# Conda is used to manage Python versions. -# -# This dockerfile installs roadrunner dependencies and llvm package -# But does not build roadrunner, which is the subject of another dockerfile -# -# When looking for bugs in the many linux build: -# 1) Ensure you have the docker dependencies image: -# - docker pull ciaranwelsh/roadrunner-manylinux2014-base:latest -# 2) Change git branch to the one you want to build (the one where your tests are failing): -# - RUN cd $roadrunnerSource && git pull && git checkout expand-unittests -# 3) Run docker build . inside the "docker/roadrunner-manylinux2014-build" folder -# -# -###################################################### -# Commands to get docker working with clion -# -# Build: -# docker build -t ciaranwelsh/roadrunner-manylinux2014-build:latest -f Dockerfile . -# Once built, run with -# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 --name clion_remote_env clion/remote-cpp-env:0.5 -# Where: -# -d runs the container as a daemon, so control returns back to you. -# --cap-add sys_ptrace adds the ptrace capability, which is necessary for debugging. Docker containers are usually very minimal, by default, so you sometimes need to enable fundamental things. -# -p2222:22 specifies a port mapping. Port 22 (the default SSH port) inside the container is mapped to outside the container as port 2222 on the host environment. -# There’s nothing special about 2222. Doubling up, or multiplying by 10 are common ways of expressing mapped ports, -# but you could specify any available port number, here. That can be useful if you intend to run multiple containers side-by-side (e.g. to support alternate toolchains). -# Whatever port number you chose, since it’s only temporarily mapped, and may be reused, it’s usually worth clearing any cached SSH keys: -# - -# CLion remote docker environment (How to build docker container, run and stop it) -# -# Build and run: -# docker build -t clion/centos7-cpp-env:0.1 -f Dockerfile.centos7-cpp-env . -# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 clion/centos7-cpp-env:0.1 -# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222" -# -# stop: -# docker stop clion_remote_env -# -# ssh credentials (test user): -# user@password - -FROM ciaranwelsh/roadrunner-manylinux2014-base - -ENV conda /Miniconda3/bin/conda -ENV bashrc /root/.bashrc -ENV roadrunnerSource /roadrunner -ENV roadrunnerBuild37 /roadrunner/build37 -ENV roadrunnerBuild38 /roadrunner/build38 -ENV roadrunnerBuild39 /roadrunner/build39 -ENV roadrunnerInstall37 /roadrunner/install37 -ENV roadrunnerInstall38 /roadrunner/install38 -ENV roadrunnerInstall39 /roadrunner/install39 -ENV swigExec /swig-4.0.2/install-swig-4.0.2/bin/swig - -# install numpy in all conda envs -RUN $conda init && . $bashrc \ - && conda activate py37 \ - && pip install numpy \ - && conda activate py38 \ - && pip install numpy \ - && conda activate py39 \ - && pip install numpy - -# install a dependency -RUN yum install -y ncurses-devel openssh-server - -RUN git clone https://github.com/sys-bio/roadrunner.git $roadrunnerSource -RUN pwd -RUN cd $roadrunnerSource && git pull && git checkout cvodes-2 - -## build against python 3.7 -#RUN $conda init && . $bashrc && conda activate py37 && cd $roadrunnerSource \ -# && mkdir -p $roadrunnerBuild37 && cd $roadrunnerBuild37 \ -# && cmake -DLLVM_INSTALL_PREFIX=/llvm-6.x/install-llvm-6.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$roadrunnerInstall37 -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=/Miniconda3/envs/py37 -DSWIG_EXECUTABLE=$swigExec .. -#RUN cd $roadrunnerBuild37 \ -# && cmake --build . --target install --config Release -j 1 - - - -#RUN $conda init && . $bashrc && cd $roadrunnerBuild37 \ -# && ctest --verbose --extra-verbose -# -## build against python 3.8 -#RUN $conda init && . $bashrc && conda activate py38 && cd $roadrunnerSource \ -# && mkdir -p $roadrunnerBuild38 && cd $roadrunnerBuild38 \ -# && cmake -DLLVM_INSTALL_PREFIX=/llvm-project/llvm/install-llvm-6.x-rel -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$roadrunnerInstall38 -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=/Miniconda3/envs/py38 .. -#RUN cd $roadrunnerBuild38 \ -# && cmake --build . --target install --config Release -j 12 -#RUN $conda init && . $bashrc && cd $roadrunnerBuild38 \ -# && ctest --verbose --extra-verbose -# -# -## build against python 3.9 -#RUN $conda init && . $bashrc && conda activate py39 && cd $roadrunnerSource \ -# && mkdir -p $roadrunnerBuild39 && cd $roadrunnerBuild39 \ -# && cmake -DLLVM_INSTALL_PREFIX=/llvm-project/llvm/install-llvm-6.x-rel -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$roadrunnerInstall39 -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=/Miniconda3/envs/py39 .. -#RUN cd $roadrunnerBuild39 \ -# && cmake --build . --target install --config Release -j 12 -#RUN $conda init && . $bashrc && cd $roadrunnerBuild39 \ -# && ctest --verbose --extra-verbose -# -# -# CMake location : /usr/local/bin/cmake -# make location : /usr/bin/make -# roadrunner dependency pckage: /libroadrunner-deps -# C++ compiler: /opt/rh/devtoolset-9/root/usr/bin/g++ -# C compiler: /opt/rh/devtoolset-9/root/usr/bin/gcc -# -DCMAKE_INSTALL_PREFIX=../install-manylinux2014-rel -# -DLLVM_INSTALL_PREFIX=/llvm-6.x/install-llvm-6.x -# -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -# -DBUILD_PYTHON=ON -# -DBUILD_TESTS=ON -# -DSWIG_EXECUTABLE=/swig-4.0.2/swig -# -DPython_ROOT_DIR=/Miniconda3/envs/py39 -# -DBUILD_RR_PLUGINS=ON - -#RUN ssh-keygen -A -#RUN ( \ -# echo 'LogLevel DEBUG2'; \ -# echo 'PermitRootLogin yes'; \ -# echo 'PasswordAuthentication yes'; \ -# echo 'Subsystem sftp /usr/libexec/openssh/sftp-server'; \ -# ) > /etc/ssh/sshd_config_test_clion -# -#RUN useradd -m user \ -# && yes password | passwd user -#RUN pwd -# -#CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"] - - - - - - diff --git a/docker/roadrunner-manylinux2014/Dockerfile b/docker/roadrunner-manylinux2014/Dockerfile new file mode 100644 index 0000000000..2a71702ce0 --- /dev/null +++ b/docker/roadrunner-manylinux2014/Dockerfile @@ -0,0 +1,19 @@ +# This dockerfile contains commands for a base environment suitable for +# building manylinux pip wheels. +# The default gcc/g++ is 9.3 +# Conda is used to manage Python versions. +# +# This dockerfile installs roadrunner dependencies and llvm package +# But does not build roadrunner, which is the subject of another dockerfile + +FROM sysbiouw/roadrunner-manylinux2014-add-deps + +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /Miniconda3 + +RUN /Miniconda3/bin/conda create -y --name py38 python=3.8 pytest +RUN /Miniconda3/bin/conda create -y --name py39 python=3.9 pytest +RUN /Miniconda3/bin/conda create -y --name py310 python=3.10 pytest +RUN /Miniconda3/bin/conda create -y --name py311 python=3.11 pytest -c conda-forge + +RUN /Miniconda3/bin/conda init && bash ~/.bashrc && . ~/.bashrc From 5b145d66b80523797fcdb7f2719b60f82b2ab360 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Mon, 13 Feb 2023 15:59:52 -0800 Subject: [PATCH 11/15] Fix actual command, not just echo version! --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 70c796745b..c9daffb7e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,4 @@ -# Starter pipeline + Starter pipeline # Start with a minimal pipeline that you can customize to build and deploy your code. # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml @@ -1069,7 +1069,7 @@ stages: $(PipExecutable) install -r $(SOURCE_DIR)/test-requirements.txt echo "cmake command: cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .." - cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/libroadrunner-deps/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .. + cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .. cmake --build . --target install --config Release -j 12 displayName: Build With Python From 05ab8d70ce3c8582e5e79c4cd106cf3579a520aa Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Mon, 13 Feb 2023 16:01:18 -0800 Subject: [PATCH 12/15] Typo fix. --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c9daffb7e0..4e2400b76a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,4 @@ - Starter pipeline +# Starter pipeline # Start with a minimal pipeline that you can customize to build and deploy your code. # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml @@ -1069,7 +1069,7 @@ stages: $(PipExecutable) install -r $(SOURCE_DIR)/test-requirements.txt echo "cmake command: cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .." - cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .. + cmake -DLLVM_INSTALL_PREFIX=/install-llvm-13.x -DRR_DEPENDENCIES_INSTALL_PREFIX=/install-libroadrunner-deps -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIRECTORY) -DBUILD_PYTHON=ON -DBUILD_RR_PLUGINS=ON -DBUILD_TESTS=ON -DPython_ROOT_DIR=$(PythonRoot) -DSWIG_EXECUTABLE=$(SwigExecutable) -DCMAKE_BUILD_TYPE=Release .. cmake --build . --target install --config Release -j 12 displayName: Build With Python From 2d7e6a3eefe393c97b13a97e290174f1715db449 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Mon, 13 Feb 2023 16:41:39 -0800 Subject: [PATCH 13/15] No more experimental-by-default wheels. They were causing more trouble than they were worth. --- wrappers/Python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrappers/Python/setup.py b/wrappers/Python/setup.py index b044235c7c..e9674b1589 100644 --- a/wrappers/Python/setup.py +++ b/wrappers/Python/setup.py @@ -21,7 +21,7 @@ def has_ext_modules(foo): # when true, the pip package will have the name libroadrunner[experimental] # and will be downloadable via pip from the experimental namespace: # pip install libroadrunner[experimental] -EXPERIMENTAL = True +EXPERIMENTAL = False setup( name='libroadrunner-experimental' if EXPERIMENTAL else "libroadrunner", From d004e5f1f83523c02ea03a217b67b3efa6653c65 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Wed, 15 Feb 2023 15:42:21 -0800 Subject: [PATCH 14/15] Use roadrunner.tests instead of roadrunner.testing --- .../multiprocessing/_brown2004_multiprocessing_pool.py | 2 +- .../multiprocessing/brown2004_multiprocessing_pool.py | 2 +- .../parallel/multiprocessing/gillespie_simulations_mpi4py.py | 2 +- .../gillespie_simulations_multiprocessing_pool.py | 2 +- .../multiprocessing/gillespie_simulations_ray_library.py | 2 +- .../parallel/multiprocessing/gillespie_simulations_serial.py | 2 +- .../multiprocessing/gillespie_simulations_threading.py | 2 +- docs/source/sensitivities/sensitivities.py | 2 +- docs/source/sensitivities/sensitivities_dq_method.py | 2 +- docs/source/sensitivities/sensitivities_method.py | 2 +- .../sensitivities/sensitivities_selective_parameters.py | 2 +- docs/source/sensitivities/sensitivities_selective_species.py | 2 +- docs/source/sensitivities/sensitivities_solver_type.py | 2 +- docs/source/sensitivities/timeseries_sensitivity_analysis.py | 2 +- docs/source/tutorial/loading_models.rst | 4 ++-- docs/source/tutorial/what_is_rr.rst | 4 ++-- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/source/parallel/multiprocessing/_brown2004_multiprocessing_pool.py b/docs/source/parallel/multiprocessing/_brown2004_multiprocessing_pool.py index c695ed80bd..1e2adee21a 100644 --- a/docs/source/parallel/multiprocessing/_brown2004_multiprocessing_pool.py +++ b/docs/source/parallel/multiprocessing/_brown2004_multiprocessing_pool.py @@ -6,7 +6,7 @@ ] from roadrunner import RoadRunner, Config import roadrunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from multiprocessing import Pool, cpu_count import time from platform import platform diff --git a/docs/source/parallel/multiprocessing/brown2004_multiprocessing_pool.py b/docs/source/parallel/multiprocessing/brown2004_multiprocessing_pool.py index 28129ee3fb..7e11bd85d8 100644 --- a/docs/source/parallel/multiprocessing/brown2004_multiprocessing_pool.py +++ b/docs/source/parallel/multiprocessing/brown2004_multiprocessing_pool.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from multiprocessing import Pool, cpu_count import time from platform import platform diff --git a/docs/source/parallel/multiprocessing/gillespie_simulations_mpi4py.py b/docs/source/parallel/multiprocessing/gillespie_simulations_mpi4py.py index 359520c651..027d58fec5 100644 --- a/docs/source/parallel/multiprocessing/gillespie_simulations_mpi4py.py +++ b/docs/source/parallel/multiprocessing/gillespie_simulations_mpi4py.py @@ -1,6 +1,6 @@ import numpy as np from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from threading import Thread from multiprocessing import Queue import time diff --git a/docs/source/parallel/multiprocessing/gillespie_simulations_multiprocessing_pool.py b/docs/source/parallel/multiprocessing/gillespie_simulations_multiprocessing_pool.py index 317f2cf446..ae90129c2b 100644 --- a/docs/source/parallel/multiprocessing/gillespie_simulations_multiprocessing_pool.py +++ b/docs/source/parallel/multiprocessing/gillespie_simulations_multiprocessing_pool.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from multiprocessing import Pool, cpu_count import time from platform import platform diff --git a/docs/source/parallel/multiprocessing/gillespie_simulations_ray_library.py b/docs/source/parallel/multiprocessing/gillespie_simulations_ray_library.py index bea6e36490..a41466eae3 100644 --- a/docs/source/parallel/multiprocessing/gillespie_simulations_ray_library.py +++ b/docs/source/parallel/multiprocessing/gillespie_simulations_ray_library.py @@ -1,7 +1,7 @@ import numpy as np from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from multiprocessing import cpu_count import ray import time diff --git a/docs/source/parallel/multiprocessing/gillespie_simulations_serial.py b/docs/source/parallel/multiprocessing/gillespie_simulations_serial.py index 42851bde33..d15f2f4278 100644 --- a/docs/source/parallel/multiprocessing/gillespie_simulations_serial.py +++ b/docs/source/parallel/multiprocessing/gillespie_simulations_serial.py @@ -8,7 +8,7 @@ assert "llvm6" in roadrunner.__file__, roadrunner.__file__ from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf import time import numpy as np from platform import platform diff --git a/docs/source/parallel/multiprocessing/gillespie_simulations_threading.py b/docs/source/parallel/multiprocessing/gillespie_simulations_threading.py index 2df3b47ffb..45f564082b 100644 --- a/docs/source/parallel/multiprocessing/gillespie_simulations_threading.py +++ b/docs/source/parallel/multiprocessing/gillespie_simulations_threading.py @@ -1,6 +1,6 @@ import numpy as np from roadrunner import RoadRunner -from roadrunner.testing import TestModelFactory as tmf +from roadrunner.tests import TestModelFactory as tmf from threading import Thread from multiprocessing import Queue import time diff --git a/docs/source/sensitivities/sensitivities.py b/docs/source/sensitivities/sensitivities.py index aebf4dc614..68893461b1 100644 --- a/docs/source/sensitivities/sensitivities.py +++ b/docs/source/sensitivities/sensitivities.py @@ -1,6 +1,6 @@ import roadrunner from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels from os.path import join, dirname # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/sensitivities_dq_method.py b/docs/source/sensitivities/sensitivities_dq_method.py index eef17d2094..eeacc72d10 100644 --- a/docs/source/sensitivities/sensitivities_dq_method.py +++ b/docs/source/sensitivities/sensitivities_dq_method.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/sensitivities_method.py b/docs/source/sensitivities/sensitivities_method.py index 75ef6e3453..ff97ebdb9d 100644 --- a/docs/source/sensitivities/sensitivities_method.py +++ b/docs/source/sensitivities/sensitivities_method.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/sensitivities_selective_parameters.py b/docs/source/sensitivities/sensitivities_selective_parameters.py index c8b4294bb5..b345bc4ac2 100644 --- a/docs/source/sensitivities/sensitivities_selective_parameters.py +++ b/docs/source/sensitivities/sensitivities_selective_parameters.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/sensitivities_selective_species.py b/docs/source/sensitivities/sensitivities_selective_species.py index ca06562951..592d09655d 100644 --- a/docs/source/sensitivities/sensitivities_selective_species.py +++ b/docs/source/sensitivities/sensitivities_selective_species.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/sensitivities_solver_type.py b/docs/source/sensitivities/sensitivities_solver_type.py index e5c03db2f8..3f06cab6ab 100644 --- a/docs/source/sensitivities/sensitivities_solver_type.py +++ b/docs/source/sensitivities/sensitivities_solver_type.py @@ -1,5 +1,5 @@ from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # note: use getAvailableTestModels() to see options for test models. diff --git a/docs/source/sensitivities/timeseries_sensitivity_analysis.py b/docs/source/sensitivities/timeseries_sensitivity_analysis.py index 1f18b77627..9adf86cf78 100644 --- a/docs/source/sensitivities/timeseries_sensitivity_analysis.py +++ b/docs/source/sensitivities/timeseries_sensitivity_analysis.py @@ -12,7 +12,7 @@ import roadrunner from roadrunner import RoadRunner -from roadrunner.testing.TestModelFactory import TestModelFactory, getAvailableTestModels +from roadrunner.tests.TestModelFactory import TestModelFactory, getAvailableTestModels # For this demonstration we use a toy sbml model prepackaged with roadrunner diff --git a/docs/source/tutorial/loading_models.rst b/docs/source/tutorial/loading_models.rst index d4ba747b86..ba5b4abc29 100644 --- a/docs/source/tutorial/loading_models.rst +++ b/docs/source/tutorial/loading_models.rst @@ -35,9 +35,9 @@ This is useful when one wishes to create a new roadrunner instance from an exist rrnew = roadrunner.RoadRunner (sbmlStr) Additionally, there are a couple models **included with libRoadRunner**. The models ``feedback.xml`` -and ``Test_1.xml`` are available in the ``roadrunner.testing`` module. To access these use:: +and ``Test_1.xml`` are available in the ``roadrunner.tests`` module. To access these use:: - import roadrunner.testing as test + import roadrunner.tests as test rr = test.getRoadRunner('feedback.xml') There are a few additional models in the ``models/`` directory of the distribution, where you installed libRoadRunner. diff --git a/docs/source/tutorial/what_is_rr.rst b/docs/source/tutorial/what_is_rr.rst index 1b761b6344..d0218e59bf 100644 --- a/docs/source/tutorial/what_is_rr.rst +++ b/docs/source/tutorial/what_is_rr.rst @@ -50,14 +50,14 @@ Transcript from an Python session to demonstrate libRoadRunner use on this inter **Import** roardrunner and numpy:: import roadrunner - import roadrunner.testing + import roadrunner.tests import numpy as n import numpy.linalg as lin **Load** an SBML model:: >>> rr = roadrunner.RoadRunner() - >>> rr.load(roadrunner.testing.get_data('Test_1.xml')) + >>> rr.load(roadrunner.tests.get_data('Test_1.xml')) True Get the **model**, the model object has all the accessors sbml elements, names, values:: From d7d8e1d704eb24049f33930e67583035578ac212 Mon Sep 17 00:00:00 2001 From: Lucian Smith Date: Tue, 21 Feb 2023 11:06:50 -0800 Subject: [PATCH 15/15] Update docs (in particular, roadrunner.testing -> roadrunner.tests) --- .../C++APIReference/CVODEIntegrator.html | 12 +- .../C++APIReference/Dictionary.html | 12 +- .../C++APIReference/EulerIntegrator.html | 16 +- .../ExecutableModelFactory.html | 14 +- .../C++APIReference/GillespieIntegrator.html | 12 +- .../C++APIReference/Integrator.html | 12 +- .../IntegratorRegistration.html | 12 +- .../C++APIReference/NLEQ1Solver.html | 12 +- .../C++APIReference/NLEQ2Solver.html | 12 +- .../C++APIReference/RK45Integrator.html | 12 +- .../C++APIReference/RK4Integrator.html | 14 +- .../C++APIReference/RoadRunnerMap.html | 34 ++-- .../C++APIReference/SBMLValidator.html | 12 +- docs/docs-build/C++APIReference/Solver.html | 16 +- .../C++APIReference/SolverRegistration.html | 12 +- .../C++APIReference/SteadyStateSolver.html | 12 +- docs/docs-build/C++APIReference/Variant.html | 12 +- docs/docs-build/C++APIReference/index.html | 20 +- .../C++APIReference/llvm/ASTNodeCodeGen.html | 16 +- .../C++APIReference/llvm/ASTNodeFactory.html | 18 +- .../llvm/AssignmentRuleEvaluator.html | 12 +- .../C++APIReference/llvm/CodeGen.html | 12 +- .../C++APIReference/llvm/CodeGenBase.html | 12 +- .../llvm/EvalConversionFactorCodeGen.html | 12 +- .../llvm/EvalInitialConditionsCodeGen.html | 12 +- .../llvm/EvalRateRuleRatesCodeGen.html | 12 +- .../llvm/EvalReactionRatesCodeGen.html | 12 +- .../llvm/EvalVolatileStoichCodeGen.html | 12 +- .../llvm/EventAssignCodeGen.html | 12 +- .../llvm/EventCodeGenBase.html | 12 +- .../C++APIReference/llvm/EventQueue.html | 14 +- .../llvm/EventTriggerCodeGen.html | 12 +- .../llvm/FunctionResolver.html | 14 +- .../llvm/KineticLawParameterResolver.html | 14 +- .../C++APIReference/llvm/LLVMCompiler.html | 14 +- .../C++APIReference/llvm/LLVMException.html | 12 +- .../llvm/LLVMExecutableModel.html | 52 +++--- .../C++APIReference/llvm/LLVMModelData.html | 12 +- .../llvm/LLVMModelDataSymbols.html | 28 +-- .../llvm/LLVMModelGenerator.html | 12 +- .../llvm/LLVMModelSymbols.html | 12 +- .../llvm/LoadSymbolResolverBase.html | 12 +- .../llvm/ModelDataIRBuilder.html | 18 +- .../llvm/ModelDataSymbolResolver.html | 12 +- .../llvm/ModelGeneratorContext.html | 14 +- .../llvm/ModelInitialValueSymbolResolver.html | 14 +- .../C++APIReference/llvm/ModelResources.html | 12 +- .../C++APIReference/llvm/Random.html | 12 +- .../llvm/SBMLInitialValueSymbolResolver.html | 14 +- .../llvm/SetInitialValueCodeGenBase.html | 12 +- .../llvm/SetInitialValuesCodeGen.html | 12 +- .../llvm/SetValueCodeGenBase.html | 12 +- .../llvm/SetValuesCodeGen.html | 12 +- .../C++APIReference/llvm/SymbolForest.html | 12 +- .../C++APIReference/llvm/index.html | 12 +- .../C++APIReference/rrCompiler.html | 14 +- docs/docs-build/C++APIReference/rrConfig.html | 12 +- .../C++APIReference/rrException.html | 12 +- .../C++APIReference/rrExecutableModel.html | 54 +++--- .../C++APIReference/rrFileName.html | 12 +- .../docs-build/C++APIReference/rrIniFile.html | 12 +- docs/docs-build/C++APIReference/rrIniKey.html | 12 +- .../C++APIReference/rrIniSection.html | 12 +- docs/docs-build/C++APIReference/rrLogger.html | 12 +- .../C++APIReference/rrNLEQ1Interface.html | 26 +-- .../C++APIReference/rrNLEQ2Interface.html | 26 +-- .../C++APIReference/rrRoadRunner.html | 100 +++++----- .../C++APIReference/rrRoadRunnerData.html | 12 +- .../C++APIReference/rrRoadRunnerOptions.html | 12 +- .../rrSBMLModelSimulation.html | 12 +- .../C++APIReference/rrSBMLReader.html | 12 +- .../C++APIReference/rrSelectionRecord.html | 12 +- docs/docs-build/C++APIReference/rrSparse.html | 12 +- .../C++APIReference/rrSteadyStateSolver.html | 12 +- .../docs-build/Installation/installation.html | 12 +- .../Installation/llvm_dependency.html | 12 +- .../troubleshooting_the_build.html | 12 +- .../Installation/windows_warning.html | 12 +- .../PythonAPIReference/api_reference.html | 12 +- .../PythonAPIReference/cls_Compiler.html | 22 ++- .../PythonAPIReference/cls_Config.html | 12 +- .../cls_ExecutableModel.html | 122 ++++++------ .../PythonAPIReference/cls_Integrator.html | 24 ++- .../cls_LoadSBMLOptions.html | 12 +- .../PythonAPIReference/cls_Logger.html | 30 +-- .../PythonAPIReference/cls_Misc.html | 20 +- .../cls_PyConservedMoietyConverter.html | 24 ++- .../PythonAPIReference/cls_RoadRunner.html | 176 +++++++++--------- .../cls_SelectionRecord.html | 12 +- .../PythonAPIReference/cls_Solver.html | 60 +++--- .../cls_SteadyStateSolver.html | 12 +- .../using_roadrunner_from_cxx.html | 12 +- .../_sources/tutorial/loading_models.rst.txt | 4 +- .../_sources/tutorial/what_is_rr.rst.txt | 4 +- docs/docs-build/_static/basic.css | 47 ++--- docs/docs-build/_static/css/theme.css | 2 +- docs/docs-build/accessing_model.html | 12 +- docs/docs-build/bifurcation.html | 12 +- .../build_with_python_debug.html | 12 +- .../building_documentation.html | 12 +- .../developers_docs/git_workflow.html | 12 +- docs/docs-build/developers_docs/index.html | 12 +- .../developers_docs/making_releases.html | 12 +- docs/docs-build/genindex.html | 10 +- docs/docs-build/index.html | 12 +- docs/docs-build/metabolic.html | 12 +- .../multiprocessing_index.html | 18 +- docs/docs-build/parallel/parallel_index.html | 12 +- .../roadrunner_map/roadrunner_map_index.html | 12 +- docs/docs-build/py-modindex.html | 10 +- docs/docs-build/read_write_functions.html | 12 +- docs/docs-build/search.html | 10 +- docs/docs-build/selecting_values.html | 12 +- .../sensitivities/sensitivities_index.html | 24 ++- .../simulation_and_integration.html | 12 +- docs/docs-build/stability.html | 12 +- docs/docs-build/steady_state.html | 12 +- docs/docs-build/stochastic.html | 12 +- docs/docs-build/stoichiometric.html | 12 +- .../tutorial/changing_initial_conditions.html | 12 +- .../tutorial/changing_parameters.html | 12 +- .../tutorial/import_roadrunner.html | 12 +- docs/docs-build/tutorial/jit_engines.html | 12 +- docs/docs-build/tutorial/loading_models.html | 16 +- docs/docs-build/tutorial/plotting_data.html | 12 +- .../tutorial/running_simulations.html | 16 +- .../docs-build/tutorial/selecting_output.html | 12 +- docs/docs-build/tutorial/solvers.html | 12 +- docs/docs-build/tutorial/tutorial.html | 12 +- docs/docs-build/tutorial/what_is_rr.html | 16 +- docs/docs-build/tutorial/what_is_sbml.html | 12 +- docs/docs-build/utility_functions.html | 12 +- 132 files changed, 1394 insertions(+), 893 deletions(-) diff --git a/docs/docs-build/C++APIReference/CVODEIntegrator.html b/docs/docs-build/C++APIReference/CVODEIntegrator.html index 538829bea2..ec4f3fc908 100644 --- a/docs/docs-build/C++APIReference/CVODEIntegrator.html +++ b/docs/docs-build/C++APIReference/CVODEIntegrator.html @@ -1,7 +1,7 @@ - + CVODEIntegrator — libRoadRunner 1.1.16 documentation @@ -30,11 +30,15 @@