Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Compiling API v8p0r2 and Python 3

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34001

Hello,

I am trying to compile the TELEMAC API for Python 3 (TELEMAC version v8p0r2, Ubuntu 16.04.6 LTS). Although I followed the installation guide as well as multiple forum posts, I am not able to fix my error.

I compiled TELEMAC using the attached script. The compilation finishes without errors. However, I don't have the api.so file in my wrap_api/lib folder. Instead I have api.pyf. When I try to run my case I get the following error

Traceback (most recent call last):
  File "/home/ws/telemac-mascaret/v8p0r2/scripts/python3/telapy/api/api_module.py", line 131, in __init__
    import _api
ImportError: /home/ws/telemac-mascaret/v8p0r2/builds/ubuntumpi/wrap_api/lib/libpartel.so: undefined symbol: METIS_PartMeshDual

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "runTelemac.py", line 9, in <module>
    t2d = Telemac2d("T2D_steering_MQ.cas")
  File "/home/ws/telemac-mascaret/v8p0r2/scripts/python3/telapy/api/t2d.py", line 58, in __init__
    comm, recompile)
  File "/home/ws/telemac-mascaret/v8p0r2/scripts/python3/telapy/api/api_module.py", line 148, in __init__
    + '\n'+str(execpt))
utils.exceptions.TelemacException: Error: unable to load the dynamic library _api.so
You can check the environment variable: PYTHONPATH
/home/ws/telemac-mascaret/v8p0r2/builds/ubuntumpi/wrap_api/lib/libpartel.so: undefined symbol: METIS_PartMeshDual

I would greatly appreciate any hints.

Cheers,
Sebastian
Attachments:
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34007

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
You need to add options: api in yout systel.cfg file to compile the api.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34014

Thank you for your reply. I have the option 'options: api' set in line 56. It looks like it compiles through. I attached two screenshots of my compiled libraries. Is something missing?

However, it seems python can't load the API for some reason.

Cheers, Sebastian
Attachments:
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34017

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
My bad i missed it.

The api file is there it is the one called _api.cython....

I think the issue is that the f2py3 is not the f2py that your python is using.

You need to check which f2py is the one associated to the python running the Python api script.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34029

This is a little bit strange. I have two python versions on this PC, 2.7 and 3.5. Those are called with $python and $python3 respectively. Everything regarding API I did with the 3.5 version.

So I checked if I am using the correct f2py version. In my user /usr/bin folder I have f2py3 and f2py3.5. So what I did seems correct. Furthermore, if I try for example f2py it does not even compile the API. However, if I want to use f2py in my python script I have to import it like "import numpy.f2py" (so without the 3). Is this normal or am I missing something?
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34030

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Is your mpif90 using the default gfortran on your machine ?
You can type mpif90 -show to see what it is using.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34035

The output of mpif90 -show is:

gfortran -I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib -Wl,-rpath -Wl,/usr/lib/openmpi/lib -Wl,--enable-new-dtags -L/usr/lib/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

However, if everything is successfully compiled I would assume I have some python problem. :unsure:
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34036

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Yes but the thing is that when the api is loaded in Python is is search for the _api that match the python version and the compiler version so the issue can be in both.

Can you run:
f2py3 -c --help-fcompiler

To see what compiler f2py is using.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34039

The output of f2py3 -c --help-fcompiler is:

Gnu95FCompiler instance properties:
  archiver        = ['/usr/bin/gfortran', '-cr']
  compile_switch  = '-c'
  compiler_f77    = ['/usr/bin/gfortran', '-Wall', '-g', '-ffixed-form', '-
                    fno-second-underscore', '-fPIC', '-O3', '-funroll-loops']
  compiler_f90    = ['/usr/bin/gfortran', '-Wall', '-g', '-fno-second-
                    underscore', '-fPIC', '-O3', '-funroll-loops']
  compiler_fix    = ['/usr/bin/gfortran', '-Wall', '-g', '-ffixed-form', '-
                    fno-second-underscore', '-Wall', '-g', '-fno-second-
                    underscore', '-fPIC', '-O3', '-funroll-loops']
  libraries       = ['gfortran']
  library_dirs    = []
  linker_exe      = ['/usr/bin/gfortran', '-Wall', '-Wall']
  linker_so       = ['/usr/bin/gfortran', '-Wall', '-g', '-Wall', '-g', '-
                    shared']
  object_switch   = '-o '
  ranlib          = ['/usr/bin/gfortran']
  version         = LooseVersion ('5.4.0')
  version_cmd     = ['/usr/bin/gfortran', '-dumpversion']
Fortran compilers found:
  --fcompiler=gnu95  GNU Fortran 95 compiler (5.4.0)
Compilers available for this platform, but not found:
  --fcompiler=absoft   Absoft Corp Fortran Compiler
  --fcompiler=compaq   Compaq Fortran Compiler
  --fcompiler=g95      G95 Fortran Compiler
  --fcompiler=gnu      GNU Fortran 77 compiler
  --fcompiler=intel    Intel Fortran Compiler for 32-bit apps
  --fcompiler=intele   Intel Fortran Compiler for Itanium apps
  --fcompiler=intelem  Intel Fortran Compiler for 64-bit apps
  --fcompiler=lahey    Lahey/Fujitsu Fortran 95 Compiler
  --fcompiler=nag      NAGWare Fortran 95 Compiler
  --fcompiler=pathf95  PathScale Fortran Compiler
  --fcompiler=pg       Portland Group Fortran Compiler
  --fcompiler=vast     Pacific-Sierra Research Fortran 90 Compiler
Compilers not available on this platform:
  --fcompiler=hpux      HP Fortran 90 Compiler
  --fcompiler=ibm       IBM XL Fortran Compiler
  --fcompiler=intelev   Intel Visual Fortran Compiler for Itanium apps
  --fcompiler=intelv    Intel Visual Fortran Compiler for 32-bit apps
  --fcompiler=intelvem  Intel Visual Fortran Compiler for 64-bit apps
  --fcompiler=mips      MIPSpro Fortran Compiler
  --fcompiler=none      Fake Fortran compiler
  --fcompiler=sun       Sun or Forte Fortran 95 Compiler
For compiler details, run 'config_fc --verbose' setup command.
Removing build directory /tmp/tmptyrltfx1
The administrator has disabled public write access.

Compiling API v8p0r2 and Python 3 5 years 4 months ago #34041

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
That looks good.
Can you try running ldd on the _api library.
Should be in builds/<your_config>/wrap_api/lib
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.