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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many many errors when porting code to pyodide #2727
Comments
You seem to be hitting bugs in our scipy port. The current status of the scipy test suite is that... part of it passes. Last I checked the status of the test suite is as follows:
The good news is that most errors are fatal, usually it doesn't work but give the wrong answer. The bad news is there are still a lot of fatal errors. Usually these |
The root cause of the problem is that we don't have a working fortran compiler. See: scipy/scipy#15290 |
Thanks very much for this quick and detailled answer ! |
No, leave it open, it isn't fixed. |
See #2728 for an example of the kind of thing that can cause these failures... |
|
Sometimes I see: Traceback (most recent call last):
File "/lib/python3.10/site-packages/_pyodide/_base.py", line 431, in eval_code
.run(globals, locals)
File "/lib/python3.10/site-packages/_pyodide/_base.py", line 300, in run
coroutine = eval(self.code, globals, locals)
File "<exec>", line 217, in <module>
File "<exec>", line 49, in main
File "/lib/python3.10/site-packages/choreo/Choreo_funs.py", line 549, in Make2DChoreoSymManyLoops
the_lcm = m.lcm(*nbpl)
NameError: name 'm' is not defined is this a logic error in your code? |
The name m not being defined is very weird. The source code for this file is available at https://github.com/gabrielfougeron/Choreographies2/blob/main/choreo/Choreo_funs.py At line 13, I have I have no idea why an error is thrown. (It doesn't do this using python 3.10 in conda). More surprisingly, I've not yet seen this error in pyodide ... |
It must be due to early memory corruption destroying the Python vm's data structures. |
Yes, this sounds very plausible |
I think the main problem is that
The |
I think you hit the nail right on the head. Indeed if you change the option Solver => Optimizer => Krylov method from LGMRES to CGS, the error disappears. LGMRES calls |
Well I guess that gives a good short term fix. I will look into fixing |
I suspect the problem is in @@ -379,10 +393,15 @@ end function <prefix2c>dotc
function <prefix3>nrm2(n,x,offx,incx) result(n2)
- <ftypereal3> <prefix3>nrm2, n2
+ <ftypereal3> n2
+ double precision <prefix3>nrm2
- callstatement (*f2py_func)(&<prefix3>nrm2, &n,x+offx,&incx)
- callprotoargument <ctypereal3>*,F_INT*,<ctype3>*,F_INT*
+ callstatement <prefix3>nrm2_return_value=(*f2py_func)( &n,x+offx,&incx)
+ callprotoargument int*,<ctype3>*,int*
+
+ fortranname F_FUNC(<prefix3>nrm2,<S,SC>NRM2)
+ ! This following line is to avoid Fortran wrappers - fix for CLAPACK
+ intent(c) <prefix3>nrm2
<ftype3> dimension(*),intent(in) :: x
@@ -399,10 +418,14 @@ end function <prefix3>nrm2
function <prefix4>nrm2(n,x,offx,incx) result(n2)
- <ftypereal4> <prefix4>nrm2, n2
+ callstatement <prefix4>nrm2_return_value=(*f2py_func)(&n,x+offx,&incx)
+ callprotoargument int*,<ctype4>*,int*
- callstatement (*f2py_func)(&<prefix4>nrm2, &n,x+offx,&incx)
- callprotoargument <ctypereal4>*,F_INT*,<ctype4>*,F_INT*
+ double precision <prefix4>nrm2
+ <ftypereal4> n2
+ fortranname F_FUNC(<prefix4>nrm2,<S,D>NRM2)
+ ! This following line is to avoid Fortran wrappers - fix for CLAPACK
+ intent(c) <prefix4>nrm2 |
Thanks to Hood for fixing this issue in #2728 So it looks like this fix should improve scipy.sparse support significantly #2728 (comment) |
FYI it seems the |
Awesome, thanks @lesteve for the heads-up. I'll probably wait for 0.24 to try it out though. I'll keep you posted. |
馃悰 Bug
Thanks to the amazing help of @ryanking13 and @hoodmane , I was able to start using module sparseqr in a small project of mineusing pyodide.
Of course, I never expected that the transition to pyodide would be easy, but upon running my own code in pyodide, I was surpised to see many different errors pop up.
I had never seen most of those errors before, and they are not very reproducible (most likely because the execution of the core relies on a random number generator).
Here is a list of the main error that my code throws, none of which I had ever gotten using conda's python:
I must say those errors are so foreign to me I don't really know where to start. Moreover, they are not very reproducible (even considering the RNG), as the very same call might or might not throw an error.
Of course I'm not asking the Pyodide team to debug my code, but merely to give me a few pointers/ideas where to start.
To Reproduce
Go to https://gabrielfougeron.github.io//choreo/ and click "Choreo Execute!". Several print statements should appear in the console.
Expected behavior
No errors.
Environment
I built pyodide myself from pull request #2685
The text was updated successfully, but these errors were encountered: