[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multi-threaded optimal interpolation module for octave

From: Alexander Barth
Subject: Re: Multi-threaded optimal interpolation module for octave
Date: Tue, 11 Jul 2006 10:21:48 -0400
User-agent: Thunderbird (X11/20060501)

Joe Koski wrote:
on 7/10/06 7:46 AM, Alexander Barth at address@hidden wrote:

Hi all,

I wrote a Fortran 90 module performing a n-dimensional local optimal
interpolation. The optimal interpolation allows to interpolate
arbitrarily located observations to a regular grid using a background
field as first guess. It can be used as an alternative to griddata. The
optimal interpolated module can be called from Octave using a C++ wrapper.

I was able to create a working oct-file with gfortran, g95, Intel
Fortran Compiler (free as in beer) and PGI Compiler (commercial) .
Unfortunately, gfortran version 4.0 doesn't work but version 4.1 works fine.

It is also possible to use multiple CPUs during the optimal
interpolation in octave if the Fortran code is compiled with OpenMP
support enabled. This works with the Intel and PGI compilers. OpenMP
support for GCC is planned for version 4.2.

Instructions and the source code can be found at:

Suggestions are very welcome.



I downloaded your OI-0.1 package to give it a spin. My octave-2.1.73 and
octave-forge are both built with g95, so I thought I was ready for a
straight mkoctfile This was on my Mac G5 with OS X 10.3.9.
To be sure, I rebuilt octave and octave-forge with the most recent (7/10/06)
g95 for the Mac. (Andy Vaught recently modified his name mangling approach
for g95, so I thought it prudent to rebuild octave.)

When I run mkoctfile, I got the following:

Joe-Koskis-Computer:/Tools/OI-0.1 jakoski$ mkoctfile
ld: warning multiple definitions of symbol _xerbla_
/usr/local/lib/octave-2.1.73/liboctinterp.dylib(single module) definition of
/usr/local/lib/octave-2.1.73/libcruft.dylib(single module) definition of
.framework/Versions/A/libBLAS.dylib(single module) definition of _xerbla_
ld: Undefined symbols:

The multiple definitions of xerbla are normal, but why do I need
_optiminterp_f77_ with a Fortran 95 compiler? Are we having problems with .F
vs. .f as an extension? Macs are not as case sensitive as Linux, although I
tried renaming optimal_interpolation.F to optimal_interpolation.f90, and
optiminterp_f77.f to a dummy without success.

In my OI-0.1 directory I have (after running mkoctfile)

Joe-Koskis-Computer:/Tools/OI-0.1 jakoski$ ls
COPYING                         optiminterp.o
README.html                     optiminterp1.m
example_optiminterp.f           optiminterp2.m
example_optiminterp.m           optiminterp3.m
ndgrid.m                        optiminterp_f77.f_unused
optimal_interpolation.F         test_optiminterp.m

Any ideas?


Yes, you should be able to compile the package directly with mkoctfile, but you forgot to include the Fortran source code on the command line. Please try to compile with:
mkoctfile optimal_interpolation.F optiminterp_f77.f

The optimal interpolation code is a Fortran 90 module using assumed-shape arrays. I don't know if there is any (portable) way to call such code directrly from C++. Therefore I created a wrapper "optiminterp_f77.f". This wrapper is Fortran 90 code but it uses explicit shaped arrays (à la Fortran 77).

You will also need to undo the file renaming you did, since the file extensions (including case) are significant:

.f: Fortran (77 or 90) fixed format without preprocessor directives
.F: Fortran (77 or 90) fixed format with preprocessor directives
.f90: Fortran 90 free format without preprocessor directives
.F90: Fortran 90 free format with preprocessor directives

I wrote initially the Fortran code in free format (f90 extention). But mkoctfile doesn't recognize the f90 extension. While it is not difficult to change mkoctfile, I converted the code in fixed format so that the unmodified mkoctfile tool can be used.

I hope this helps. Thanks for trying the code on Mac OS X. Let me know if it works.


  Alexander Barth

  Ocean Circulation Group
  University of South Florida
  College of Marine Science
  140 Seventh Avenue South 
  St. Petersburg, Florida  33701

  Phone: +1-727-553-3508     FAX:   +1-727-553-1189


reply via email to

[Prev in Thread] Current Thread [Next in Thread]