Open NengLu opened 3 years ago
This is a stripy / underworld issue. Underworld 2.11 Stripy latest as of 8/11/2021
Here is the link that how to install them, using conda to install stripy and compile the underworld from source code in the env.
update: tried reinstalling stripy with 2 verisons.
update: tried reinstalling stripy from source code (version 2.05b2), still have the same issue
Hi Louis, Thanks for the reply. I tried several sets of parameters and it all get the same issue. and when using function stripy.Triangulation directly as in the example also has the issue. It will get the right result when importing stripy alone, and get the error when importing stripy after underworld:
sTRMESH - Fatal error!
The first 3 nodes are collinear.
Try reordering the data.
It's more likely the dynamic libraries issue like Romain mentioned.
Using python3.9 and trying:
pip install stripy
I get the following error:
Error: Rank mismatch in argument ‘lcc’ at (1) (rank-1 and scalar)
src/srfpack.f:7391:37:
7391 | CALL intrc1(xs(i),ys(i),ncc,lcc,n,x,y,zdata,lst,lptr,lend,
| 1
Error: Rank mismatch in argument ‘lcc’ at (1) (rank-1 and scalar)
Using gfortran 11.2.0.
This is a stripy issue. I'll look into updating it.
Using python3.9 and trying:
pip install stripy
I get the following error:Error: Rank mismatch in argument ‘lcc’ at (1) (rank-1 and scalar) src/srfpack.f:7391:37: 7391 | CALL intrc1(xs(i),ys(i),ncc,lcc,n,x,y,zdata,lst,lptr,lend, | 1 Error: Rank mismatch in argument ‘lcc’ at (1) (rank-1 and scalar)
Using gfortran 11.2.0.
This is a stripy issue. I'll look into updating it.
Sorry I saw that a bit late. I fixed it on master...
OK results of my investigations for today...
x.txt and y.txt are just dumps of Neng's code when using stripy only...
What does not work:
import underworld
from stripy._tripack import trmesh
import numpy as np
x = np.loadtxt("x.txt")
y = np.loadtxt("y.txt")
trmesh(x,y)
What works (from the directory where _tripack.*.so is located)
import underworld
from _tripack import trmesh
import numpy as np
x = np.loadtxt("x.txt")
y = np.loadtxt("y.txt")
trmesh(x,y)
The difference is that in case 1 we have some extra dynamic libraries loaded...
112a113,115
> /home/romain/PROJECTS/Project_underworld_quagmire_stripy/stripy/stripy/_srfpack.cpython-310-x86_64-linux-gnu.so
> /home/romain/PROJECTS/Project_underworld_quagmire_stripy/stripy/stripy/_tripack.cpython-310-x86_64-linux-gnu.so
> /home/romain/PROJECTS/Project_underworld_quagmire_stripy/stripy/stripy/_ssrfpack.cpython-310-x86_64-linux-gnu.so
122c125
< /home/romain/PROJECTS/Project_underworld_quagmire_stripy/stripy/stripy/_tripack.cpython-310-x86_64-linux-gnu.so
---
> /home/romain/PROJECTS/Project_underworld_quagmire_stripy/stripy/stripy/_stripack.cpython-310-x86_64-linux-gnu.so
Not very helpful
My first thought was to try passing the -fPIC options when building the libraries.... No luck...
Note that we can reduce the complexity by doing from underworld.lib import _StGermain
instead of the entire underworld module...
That's all for now...
Ideas? In the first case trmesh gets nothing... no values.. Might be worth looking at the memory address that get passed...
Romain
One thing that might confuse the loader is the fact that the routines have the same names in the different Fortran extensions...
Yep that is exactly what is happening... There is an ambiguity between the trmesh subroutine in stripack.f90 and tripack.f90...
That's a pity because one of the virtues of wrapping the code is that we don't have to touch the original fortran ... and hence we are never going to introduce new bugs. Is there a way to fix this via f2py that keeps the original code untouched, or do we need a super-grep intervention ?
I don't know yet. I will investigate. I agree we shouldn't have to touch the Fortran code
I'll keep documenting the debugging process...sorry if I'm spamming everyone...
So
What works (from the directory where _tripack.*.so is located)
import underworld
import _tripack
import numpy as np
x = np.loadtxt("x.txt")
y = np.loadtxt("y.txt")
_tripack.trmesh(x,y)
Also works:
import underworld
import _tripack
import _stripack
import numpy as np
x = np.loadtxt("x.txt")
y = np.loadtxt("y.txt")
_tripack.trmesh(x,y)
Does not work and throws an sTRMESH error (so the wrong routine gets called). I think its a fortran wrapping issue...: And the reason is that stripack and tripack both have a trmesh routine...
import underworld
import _stripack
import _tripack
import numpy as np
x = np.loadtxt("x.txt")
y = np.loadtxt("y.txt")
_tripack.trmesh(x,y)
I have tried to reproduce the issue with a package that is not Underworld but has Swig generated so files... No luck...Stripy is doing things properly. Changing the name of the routine does not help...
The issue only occur when importing Underworld before the stripy submodules...And it only appears when we load strimesh before trimesh... f2py generates C bindings for TRMESH (tri and strimesh) that have distinct signatures so I don't understand what is going on...
Somehow UW messes up the way the interpreter loads the f2py generated modules in stripy... It's really hard to isolate the pb.. because the UW swig modules reference each other etc... I have tried to create simple modules but can't reproduce the issue.
The fact that we had a very similar issue with an older version of Badlands makes me believe that the pb comes from UW...
Something to revisit I suppose. Running out of ideas....
Hi guys, I run into an import issue and that bother me a while, would you help me check with that? if import underworld and stripy together, it will somehow get the wrong tri.simplices:
The result is:
While import stripy alone, the tri.simplices are correct as:
Are there any function conflicts there in underworld and stripy or? Thanks in advance.