Comments (15)
I have been able to avoid this problem by separating my program and module definitions into different files. I am able to run f90wrap (after defining a kind map) but I run into the the following error when I try to run f2py
...
Line #10712 in f90wrap_libfida.f90:" intent(hide), depend(nlaunch) :: n3 = shape(nlaunch,0)"
analyzeline: cannot handle multiple attributes without type specification. Ignoring ' depend(nlaunch)'.
Line #10714 in f90wrap_libfida.f90:" intent(hide), depend(nlaunch) :: n4 = shape(nlaunch,1)"
analyzeline: cannot handle multiple attributes without type specification. Ignoring ' depend(nlaunch)'.
Line #10716 in f90wrap_libfida.f90:" intent(hide), depend(nlaunch) :: n5 = shape(nlaunch,2)"
analyzeline: cannot handle multiple attributes without type specification. Ignoring ' depend(nlaunch)'.
Line #10929 in f90wrap_libfida.f90:" use libfida, only: assignment(=), profiles"
analyzeline: Not local=>use pattern found in 'assignment(=)'
Traceback (most recent call last):
File "/home/lstagner/anaconda3/bin/f2py", line 28, in <module>
main()
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/f2py2e.py", line 648, in main
run_compile()
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/f2py2e.py", line 633, in run_compile
setup(ext_modules=[ext])
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/home/lstagner/anaconda3/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/lstagner/anaconda3/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/home/lstagner/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/command/build.py", line 47, in run
old_build.run(self)
File "/home/lstagner/anaconda3/lib/python3.5/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/lstagner/anaconda3/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/lstagner/anaconda3/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/command/build_src.py", line 147, in run
self.build_sources()
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/command/build_src.py", line 164, in build_sources
self.build_extension_sources(ext)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/command/build_src.py", line 326, in build_extension_sources
sources = self.f2py_sources(sources, ext)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/distutils/command/build_src.py", line 563, in f2py_sources
['-m', ext_name]+f_sources)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/f2py2e.py", line 408, in run_main
postlist = callcrackfortran(files, options)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/f2py2e.py", line 329, in callcrackfortran
postlist = crackfortran.crackfortran(files)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/crackfortran.py", line 3216, in crackfortran
readfortrancode(files, crackline)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/crackfortran.py", line 511, in readfortrancode
dowithline(finalline)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/crackfortran.py", line 782, in crackline
analyzeline(m, pat[1], line)
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/crackfortran.py", line 936, in analyzeline
for x in markoutercomma(args).split('@,@')])
File "/home/lstagner/anaconda3/lib/python3.5/site-packages/numpy/f2py/crackfortran.py", line 822, in markoutercomma
assert not f, repr((f, line, l, cc))
AssertionError: (1, '=@)@@(@p1=p1_ptr%p, p2=p2_ptr%p', '=@)@@(@p1=p1_ptr%p, p2=p2_ptr%p', ')')
Any assistance would be appreciated.
from f90wrap.
Thanks for reporting, I'll have a look ASAP.
from f90wrap.
The missing Program uses clause is now fixed. The second error was caused by the overloaded assignment(=)
interface, which should be converted to Fortran code along the lines of a = b
instead of call assignment(=)(a, b)
. I just pushed a fix for this as well, which allows me to wrap your fidasim.f90
module, but I haven't tested thoroughly so please report back before we close this issue. Also, would you be happy for me to add this fidasim
as an example/regression test?
from f90wrap.
Thanks for addressing this quickly. I/we will try out the changes shortly (@kgage).
What does making fidasim
a regression test involve?
from f90wrap.
I still having issues with creating the wrapper. The f90wrap
stage works now however when I get to the f2py stage I'm getting a bunch of the following errors
f90wrap_fidasim.f90:10941:4:
p1=p1_ptr%p = p2=p2_ptr%p
1
Error: Unclassifiable statement at (1)
The error occurs in the assignment operator wrappers.
Here is how I am envoking f90wrap/f2py
D3DEnergetic/FIDASIM@b65dcf4
from f90wrap.
Can you try using the modified version of f2py distributed with f90wrap, f2py-f90wrap
? This is working for me with your code.
By making it a regression test I mean including findasim.f90
in the examples/
directory and writing a short Python test script that runs some of the functions.
from f90wrap.
I tried using f2py-f90wrap
as you suggested and the same error persists. Additionally the error occurs on both python 2 and 3. Here is the generated f90wrap_fidasim.f90 file https://gist.github.com/lstagner/9a25148bfce36f546a118a9bc55ed44e
from f90wrap.
You are right, there is still a bug in the Fortran wrapper generation. Not sure how I missed that. Fix coming shortly.
from f90wrap.
Try now - last commit leads to f2py-generated C code that compiles, but I didn't try to link with your library or test the Python interface.
In any case, I'm not sure how best to expose assignment(=)
interfaces from Python. For now I simply renamed to assignment
to avoid syntax errors, but I don't think it is that useful.
from f90wrap.
Commit 65119c8 fixes one further issue: you have Fortran elements named class
which need to be renamed to avoid clashing with the Python reserved word.
from f90wrap.
I am having openmp issues (_libfida.cpython-35m-x86_64-linux-gnu.so: undefined symbol: GOMP_parallel
) with python 3 but I can get it to work with python 2.
I do have one other issue. The module variables defined here (https://github.com/D3DEnergetic/FIDASIM/blob/master/src/fidasim.f90#L959) are not in the python module.
from f90wrap.
Linking with -lgfortran -lgomp
may help with your OpenMP issues.
I'm not sure which module variables you mean are missing - are they public?
from f90wrap.
I was able to get the wrapper to work with python 3. The definitions of the module variables start here(they are public) Unlike the other module variables that were wrapped, these variables are instances of derived types. Are they not supported?
from f90wrap.
As can be seen in the f90wrap
log output, these instances are removed as derived type instances in modules can only be wrapped if they have the target
attribute - this is because we have to be able to attach pointers to them. If you are able to add target
attributes to your Fortran sources they will appear in Python. I appreciated this should be better documented, pull requests welcome...
from f90wrap.
Yes, that fixed the issue. Thanks for all your help with this. In regards to adding fidasim to the example directory I don't think it would be practical because of its dependencies. I would however be happy to list fidasim in the readme as a case study that uses f90wrap once I have made it ready for public consumption.
from f90wrap.
Related Issues (20)
- setjmpvalue undeclared error on Ubuntu HOT 3
- Windows missing dll error when building and running examples on Windows with Python 3.8> HOT 15
- IndentationError with python 3.9 HOT 5
- Extra (unnecessary) newline character in .py file for long variable names HOT 3
- more explanations on the provided examples HOT 2
- Handling reserved Python words in f90wrap HOT 6
- Help wrapping a project HOT 7
- Data type determined at run time
- Issues with Compiling MPI Program HOT 3
- Support for Intel oneAPI2022
- multidimensional arrays in derived types broken if compiled with long integers as default HOT 1
- Python 3.11 support HOT 8
- Pre-build f90wrap wheels for windows HOT 3
- Derived types containing allocatable character arrays
- `integer, value, intent(in)`/`integer, value` arguments converted to/wrapped as `real`
- Wrong module class name in a call to `f90wrap.runtime.FortranDerivedTypeArray` HOT 2
- numpy > 1.23 support HOT 2
- Switch to pyproject.toml based build system HOT 7
- duplicate symbol in formal argument list HOT 2
- Issues on Mac OS X - for f90wrap 0.2.12 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f90wrap.