-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytests out of date in release 3.1.2 #7
Comments
Hi @omsai , thanks for reaching out. I am actually about to push UQTk v 3.1.3 to github, so your request is very timely. Can you tell me which platform you are running on so I can test it there. Also, to clarify, I am not familiar with spack, but it looks like you are running the PyUQTk tests before compiling UQTk? A lot of the modules you are trying to load will not be available until you compile UQTk, and then run ctest from the build folder. Either way, I will double check our Python tests. Thanks again! |
Platform: an old Intel Westmere machine running Ubuntu 18.04. Indeed, I already compiled and loaded UQTk. The pytests directory is not included in the release tarball. I think it would be nice if it was, because these are standalone tests that don't need to be run at build time and are therefore useful in an installation just like the programs in I probably falsely assumed that |
Ok, let me know what you find when you run ctest in the build folder. The PyTests are actually not standalone tests. They rely on the compiled UQTk binaries. thanks! |
Right, I understand that you have to load the UQTk binaries, and I am doing that. I'm having some issues running spack is a project out of LLNL since about 2015 and is a package manager for HPC systems. This is what the recipe for uqtk looks like: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/uqtk/package.py Below are the folks who've contributed to the spack package so far: maybe they're all from the community: $ spack blame uqtk
LAST_COMMIT LINES % AUTHOR EMAIL
just now 60 58.8 Not Committed Yet <not.committed.yet>
9 months ago 1 1.0 Tom Scogland <[email protected]>
a year ago 21 20.6 Paul Adamson <[email protected]>
2 years ago 10 9.8 Tomoki, Karatsu <[email protected]>
2 years ago 10 9.8 sknigh <[email protected]>
just now 102 100.0 I've been making changes to get it running with pymc because the spack package still depends on the 2 versions old pymc3: diff --git a/var/spack/repos/builtin/packages/uqtk/package.py b/var/spack/repos/builtin/packages/uqtk/package.py
index ca23b6dc73..a3a8e15203 100644
--- a/var/spack/repos/builtin/packages/uqtk/package.py
+++ b/var/spack/repos/builtin/packages/uqtk/package.py
@@ -15,6 +15,7 @@ class Uqtk(CMakePackage):
git = "https://github.com/sandialabs/UQTk.git"
version("master", branch="master")
+ version("3.1.2", sha256="57ce0cea709777cbefb46f3bd86a0996a0ed5f50fc54cc297599df6e4bb9ab83")
version("3.1.0", sha256="56ecd3d13bdd908d568e9560dc52cc0f66d7bdcdbe64ab2dd0147a7cf1734f97")
version("3.0.4", sha256="0a72856438134bb571fd328d1d30ce3d0d7aead32eda9b7fb6e436a27d546d2e")
@@ -23,7 +24,7 @@ class Uqtk(CMakePackage):
)
depends_on("expat")
- depends_on("sundials", when="@3.1.0:")
+ depends_on("sundials@:5", when="@3.1.0:")
depends_on("blas", when="@3.1.0:")
depends_on("lapack", when="@3.1.0:")
@@ -31,15 +32,68 @@ class Uqtk(CMakePackage):
depends_on("py-numpy", when="+pyuqtk")
depends_on("py-scipy", when="+pyuqtk")
depends_on("py-matplotlib", when="+pyuqtk")
- depends_on("py-pymc3", when="+pyuqtk")
+ depends_on("py-pymc", when="+pyuqtk")
depends_on("swig", when="+pyuqtk")
- # Modify the process of directly specifying blas/lapack
- # as the library name.
- patch("remove_unique_libname.patch", when="@3.1.0:")
+ # The two patches for 3.1.0 fail with 3.1.2, therefore convert the patches
+ # to more versatile and reliable sed-like filter_file substitutions.
+ def patch(self):
+ cmakelists = find(".", "CMakeLists.txt")
- # Do not link the gfortran library when using the Fujitsu compiler.
- patch("not_link_gfortran.patch", when="@3.1.0:%fj")
+ # Modify the process of directly specifying blas/lapack as the library
+ # name.
+ if "@3.1.0:" in self.spec:
+ # Replace duplicate entries.
+ filter_file(
+ (
+ r"(.*[tT][aA][rR][gG][eE][tT]_[lL][iI][nN][kK]_"
+ r"[lL][iI][bB][rR][aA][rR][iI][eE][sS].+)"
+ r"lapack (\${LAPACK_LIBRARIES}.+)"
+ ),
+ r"\1 \2",
+ *cmakelists,
+ )
+ filter_file(
+ (
+ r"(.*[tT][aA][rR][gG][eE][tT]_[lL][iI][nN][kK]_"
+ r"[lL][iI][bB][rR][aA][rR][iI][eE][sS].+)"
+ r"blas (\${BLAS_LIBRARIES}.+)"
+ ),
+ r"\1 \2",
+ *cmakelists,
+ )
+
+ # Replace with the variable.
+ filter_file(
+ (
+ r"(.*[tT][aA][rR][gG][eE][tT]_[lL][iI][nN][kK]_"
+ r"[lL][iI][bB][rR][aA][rR][iI][eE][sS].+)"
+ r"lapack(.+)"
+ ),
+ r"\1${LAPACK_LIBRARIES}\2",
+ *cmakelists,
+ )
+ filter_file(
+ (
+ r"(.*[tT][aA][rR][gG][eE][tT]_[lL][iI][nN][kK]_"
+ r"[lL][iI][bB][rR][aA][rR][iI][eE][sS].+)"
+ r"blas(.+)"
+ ),
+ r"\1${BLAS_LIBRARIES}\2",
+ *cmakelists,
+ )
+
+ # Do not link the gfortran library when using the Fujitsu compiler.
+ if "@3.1.0:%fj" in self.spec:
+ filter_file(
+ (
+ r"(.*[tT][aA][rR][gG][eE][tT]_[lL][iI][nN][kK]_"
+ r"[lL][iI][bB][rR][aA][rR][iI][eE][sS].+)"
+ r" gfortran(.+stdc[+][+].+)"
+ ),
+ r"\1\2",
+ *cmakelists,
+ )
@when("@3.1.0:")
def cmake_args(self):
@@ -50,6 +104,7 @@ def cmake_args(self):
blas_libs = spec["blas"].libs.joined(";")
args = [
+ self.define("CMAKE_CXX_STANDARD", 14),
self.define("CMAKE_SUNDIALS_DIR", spec["sundials"].prefix),
self.define("LAPACK_LIBRARIES", lapack_libs),
self.define("BLAS_LIBRARIES", blas_libs), (I probably need to remove the c++14 standard - that was an artifact of using SUNDIALS version 6 instead of version 5). |
Hi @omsai , thanks for clarifying. I looked over the spack package for UQTk and it looks like it is using a version of UQTk that is quite old. We have actually moved away from swig to pybind. Also, version 3.1.3 will pull in Sundials version 6, so you will need the C++14 standard. I am very interested in helping you set up spack for UQTk. However, I would propose you hold off a day or so till I push UQTk 3.1.3 onto github. I expect to do so this evening or tomorrow. Kind Regards, |
Hi @omsai I just pushed UQTk version 3.1.3 to github. I look forward to hearing about your experiences with this new release. I would be happy to work with you to build a spack for UQTk. thanks! |
Hi @omsai , do you have an update on how the PyTests are behaving with UQTk 3.1.3? If not, can I go ahead and close this issue? Regards, |
@bjdebus Thank you! I haven't had a look yet and will try your new version and retest tomorrow. Was buried in writing these past couple of days. Actually I was wondering if you may be familiar with UQTk's pymc dependency? The spack package declares a dependency on version 3 of it but my suspicion is that the version was used because spack's pymc dependency is out of date and because I was updating pymc from version 3 to the current 5 I also got interested in UQTk it's currently that's the only spack package that depends on pymc3. I see that pymc is being used in PyUQTk/inference/postproc.py#L43L-53L as well as some mentions in some of the example python notebooks. Usually I can rely on
That's fantastic! I'll add you along with myself to the list of maintainers so that you get notified on any activity with the py-uqtk spack package. When I'm done updating pymc to version 5 I'll create an issue / PR with the updates to the spack UQTk package with you mentioned. |
Sounds good. To my knowledge, PyMC is only used for some convergence tests in the MCMC postprocessing tools (inference/postproc.py). Also, these tests are not critical. If PyMC is not detected, then those tests are simple disabled. |
With 3.1.3 I now only get 6 test failures instead of 8, though some of the errors are a little different: $ for file in *.py; do echo "=== $file ==="; python3 $file 1>/dev/null; done
=== PyArrayTest.py ===
=== PyArrayTest2.py ===
=== PyBADPTest.py ===
=== PyBCSTest.py ===
Traceback (most recent call last):
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyBCSTest.py", line 108, in <module>
regmodel = bcs.bcsreg(ndim=2,pcorder=pcorder,pctype="LU")
AttributeError: module 'bcs' has no attribute 'bcsreg'
=== PyBCSTest1D.py ===
=== PyBCSTest2D.py ===
=== PyGalerkinTest.py ===
=== PyHMCMCTest.py ===
Traceback (most recent call last):
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyHMCMCTest.py", line 139, in <module>
qz = exp(-U(array(zip(qx.flatten(),qy.flatten()))))
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyHMCMCTest.py", line 78, in U
return b*(q[:,1] - q[:,0]**2)**2 + (a - q[:,0])**2
IndexError: index 1 is out of bounds for axis 1 with size 1
=== PyMCMC2dTest.py ===
Traceback (most recent call last):
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyMCMC2dTest.py", line 62, in <module>
class pyLikelihood(uqtkmcmc.LikelihoodBase):
NameError: name 'uqtkmcmc' is not defined
=== PyMCMCTest.py ===
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyMCMCTest.py", line 42
try:
^
IndentationError: expected an indented block after 'except' statement on line 41
=== PyModTest.py ===
=== PyPCE1dTest.py ===
Traceback (most recent call last):
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyPCE1dTest.py", line 57, in <module>
x = uqtkarray.dblArray2D()
NameError: name 'uqtkarray' is not defined. Did you mean: 'bytearray'?
=== PyPCE2dTest.py ===
Traceback (most recent call last):
File "/Users/pnanda/src/spack/opt/spack/darwin-ventura-skylake/gcc-12.2.0/uqtk-3.1.3-c7av5vwp3xy4o2ve6ca62piba27ur7hv/PyUQTk/pytests/PyPCE2dTest.py", line 58, in <module>
x = uqtkarray.dblArray2D()
NameError: name 'uqtkarray' is not defined. Did you mean: 'bytearray'?
=== PyQuadTest.py ===
=== PyRegressionTest.py === I need to cleanup several other spack files and upload a patch set for you to fully reproduce the issue. This is how I ran the tests my yet as uncommitted uqtk: $ pwd
~/src
$ git clone https://github.com/sandialabs/UQTk.git -b v3.1.3
...
$ spack load [email protected]
$ spack cd -i [email protected]
$ cd PyUQTk/
$ # pytests directory is not installed, so copy it over from the git branch:
$ cp -av ~/src/UQTk/PyUQTk/pytests .
$ cp -av ~/src/UQTk/PyUQTk/pytests .
/Users/pnanda/src/UQTk/PyUQTk/pytests -> ./pytests
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyModTest.py -> ./pytests/PyModTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyPCE2dTest.py -> ./pytests/PyPCE2dTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyMCMCTest.py -> ./pytests/PyMCMCTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyQuadTest.py -> ./pytests/PyQuadTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyHMCMCTest.py -> ./pytests/PyHMCMCTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/CMakeLists.txt -> ./pytests/CMakeLists.txt
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyArrayTest2.py -> ./pytests/PyArrayTest2.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyPCE1dTest.py -> ./pytests/PyPCE1dTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyBCSTest.py -> ./pytests/PyBCSTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyRegressionTest.py -> ./pytests/PyRegressionTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyBCSTest1D.py -> ./pytests/PyBCSTest1D.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyBCSTest2D.py -> ./pytests/PyBCSTest2D.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyGalerkinTest.py -> ./pytests/PyGalerkinTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyMCMC2dTest.py -> ./pytests/PyMCMC2dTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyArrayTest.py -> ./pytests/PyArrayTest.py
/Users/pnanda/src/UQTk/PyUQTk/pytests/PyBADPTest.py -> ./pytests/PyBADPTest.py
$ cd pytests/
$ for file in *.py; do echo "=== $file ==="; python3 $file 1>/dev/null; done
(Then one gets the test output above) |
Thanks for this update. Once you have updated the spack files, let me know and I will try to replicate these issues. I will need to read up a bit on spack to understand how the building and testing happens. Thanks, |
1. support version 3.1.3, which now depends on sundials@6 2. support version 3.1.2:, which broke the two patche files and therefore the two patch files have been replaced by more flexible filter_file() commands inside a patch() function. 3. rename variant for python extension from using the package name to the more standard "+python" 4. add maintainers @omsai and the upstream developer @bjdebus who offered to help with the spack packaging in sandialabs/UQTk#7 (comment)
1. support version 3.1.3, which now depends on sundials@6 2. support version 3.1.2:, which broke the two patche files and therefore the two patch files have been replaced by more flexible filter_file() commands inside a patch() function. 3. rename variant for python extension from using the package name to the more standard "+python" 4. add maintainers @omsai and the upstream developer @bjdebus who offered to help with the spack packaging in sandialabs/UQTk#7 (comment)
Looks like minor changes to the pytests are necessary like changing
import PyUQTk.array as uqtkarray
tofrom PyUQTk import uqtkarray
etc:The text was updated successfully, but these errors were encountered: