[Python] Former JIT compilation confuses latter
I have a new grid implementation where I'm currently adding Python bindings. Whereas I managed to register and compile my grid, later compilation failed, no matter what object.
The code at hand is:
reader = (readeriga.json, "../../iga/test/auxiliaryFiles/element.ibra")
gridView = igaGrid(reader, dimgrid=2,dimworld=2)
v = FieldVector((2,1)) # this line fails
The error is as follows:
Traceback (most recent call last):
File "/dune/dune-common/build-cmake/python/dune/common/__init__.py", line 86, in FieldVector
return globals()[fv](values)
KeyError: 'FieldVector_2'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/dune-iga/dune/python/test/readGrid.py", line 23, in <module>
v= FieldVector((2,1))
File "/dune/dune-common/build-cmake/python/dune/common/__init__.py", line 90, in FieldVector
cls = _loadVec(includes, typeName).FieldVector
File "/dune/dune-common/build-cmake/python/dune/common/__init__.py", line 74, in _loadVec
return generator.load(
File "/dune/dune-common/build-cmake/python/dune/generator/generator.py", line 172, in load
return self.post(moduleName, source, postscript, extraCMake)
File "/dune/dune-common/build-cmake/python/dune/generator/generator.py", line 124, in post
module = builder.load(moduleName, source, self.typeName[0], extraCMake)
File "/dune/dune-common/build-cmake/python/dune/generator/cmakebuilder.py", line 388, in load
module = importlib.import_module("dune.generated." + moduleName)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dune.generated.fieldvector_2371cd404c10f9fc2031e51d552c58df'
A similar error is created for every other object I try to compile afterward. Thus, I think there is no issue regarding the FieldVector.
I researched and debugged the issue and during first problem arises in cmakebuilder.py685.
This process fails with error code -11 (I don't know what that means, if it is important, or even if it is always reproducible).
After this the line fails, since the module as never generated.
Interestingly, if I do this by hand and mimic the make command as follows:
/dune/dune-common/build-cmake/dune-env/.cache/dune-py/python/dune/generated# make -q -f CMakeFiles/fieldvector_2371cd404c10f9fc2031e51d552c58df.dir/fieldvector_2371cd404c10f9fc2031e51d552c58df.make fieldvector_2371cd404c10f9fc2031e51d552c58df.so
and
bash buildScript.sh fieldvector_2371cd404c10f9fc2031e51d552c58df
my Python script from above does not raise the exception and
DUNE-DEBUG: Module fieldvector_2371cd404c10f9fc2031e51d552c58df not loaded
DUNE-DEBUG: Loading fieldvector_2371cd404c10f9fc2031e51d552c58df
works as expected. How can this behavior be explained? I refactored my code several times but no difference.