<div dir="ltr">Gaetan,<br><br>Thank you for this. With your help, I think I am getting close to getting this to work for my case. At the moment, I am hung up on the line of your makefile which reads "$(FF90) $(FF90_ALL_FLAGS) -I$(MAIN_DIR)/mod -c warpustruct-f2pywrappers2.f90". Am I correct that warpustruct-f2pywrappers2.f90 should be generated by f2py? If so, do you (or does anyone else) know the command for telling f2py to do so? At the moment I am using:<br><br>f2py run_analysis.f90 -m run_analysis -h run_analysis.pyf<br><br>to get the requisite .pyf and .c files, but no .f90 file. If I am wrong about the origin of this file, please do tell me!<br><br>Thank you,<br>Austin</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 27, 2017 at 5:13 PM, Gaetan Kenway <span dir="ltr"><<a href="mailto:gaetank@gmail.com" target="_blank">gaetank@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Austin<div><br></div><div>Here is the full makefile for a code we use. The variables defined externally in a separate config file are:</div><div>$(FF90)</div><div>$(FF90_FLAGS) </div><div>$(LIBDIR)</div><div>$(PETSC_LINKER_FLAGS)</div><div>$(LINKER_FLAGS)</div><div>$(CGNS_LINKER_FLAGS)</div><div><br></div><div>$(PYTHON) </div><div>$(PYTHON-CONIFG)</div><div>$(F2PY) </div><div>(These are usually use python, python-config and f2py. You can overwrite as necessary)</div><div><br></div><div>$(CC)</div><div>$(CC_ALL_FLAGS)</div><div><br></div><div>This essentially just mimics what f2py does automatically but we found it easier to control exactly what is going on. Essentially you are just compiling exactly as you normally an executable, but instead make a .so (with the -shared option) and including the additional .o files generated by compiling the f2py-generated wrappers.</div><div><br></div><div>Hope this helps,</div><div>Gaetan</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 25, 2017 at 5:38 AM, Lisandro Dalcin <span dir="ltr"><<a href="mailto:dalcinl@gmail.com" target="_blank">dalcinl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On 22 March 2017 at 20:29, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Lisandro,<br>
<br>
We've had a couple questions similar to this with f2py; is there a way we could add to the PETSc/SLEPc makefile rules something to allow people to trivially use f2py without having to make their own (often incorrect) manual command lines?<br>
<br>
Thanks<br>
<span class="m_-1715386386467366153m_5568433048286632261HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div></span><div>Barry, it is quite hard and hacky to get f2py working in the general case. I think the email from Gaetan in this thread proves my point.</div><div><br></div><div>IMHO, it is easier to write a small Fortran source exposing the API to call using ISO_C_BINDINGS, then wrap that code with the more traditional C-based "static" tools (SWIG, Cython) or even "dynamically" with ctypes or cffi (which use dlopen'ing).</div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="m_-1715386386467366153m_5568433048286632261gmail_signature" data-smartmail="gmail_signature">Lisandro Dalcin<br>============<br>Research Scientist<br>Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br><br>4700 King Abdullah University of Science and Technology<br>al-Khawarizmi Bldg (Bldg 1), Office # 0109<br>Thuwal 23955-6900, Kingdom of Saudi Arabia<br><a href="http://www.kaust.edu.sa" target="_blank">http://www.kaust.edu.sa</a><br><br>Office Phone: <a href="tel:+966%2012%20808%200459" value="+966128080459" target="_blank">+966 12 808-0459</a></div>
</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><b style="font-size:12.8px"><font color="#666666">Austin Herrema</font></b><br></div><div dir="ltr" style="color:rgb(136,136,136);font-size:12.8px"><div><font color="#999999">PhD Student | Graduate Research Assistant | Iowa State University</font></div><div><font color="#999999">Wind Energy Science, Engineering, and Policy | Mechanical Engineering</font></div></div></div></div>
</div>