F95 vectorization support
Dennis Wassel
dennis.wassel@googlemail.com
Wed Jun 18 08:39:00 GMT 2008
2008/6/18 Asif Lakhany <asif.lakhany@gmail.com>:
>
> Dennis,
>
> Thanks for the link I will check that out. On Sun Solaris the mixing
> of code is a piece of cake.
Careful there!
I assume you mean the "convert names to lowercase, append an
underscore, [C++ only: use extern 'C'] and pass everything as pointer"
type of cake. This is indeed pretty simple as long as you only use
numeric datatypes as scalars or vectors, and use a certain compiler
that adheres to this convention (Intel and gcc do that, on Linux and
*nix).
However, if you use non-numeric types (LOGICAL/_Bool or strings), or
n-D arrays with n > 1, you'll find yourself adapting things according
to your chosen compiler + architecture. Don't expect this code to be
portable! If there is a slight chance that you might want to use
another compiler or port your code to a different architecture, my
advice is to use ISO_C_BINDING to keep things nicely portable. Also,
the abovementioned cake is quickly turning stale if you start wrapping
things up in modules, which drastically changes name mangling, and
does so in different ways with different compilers.
As an example, take a subroutine foo, defined in a module bar. The
generated symbols are called
gcc on Linux: __bar_MOD_foo
Intel Fortran on Linux: bar_mp_foo
Intel Fortran on Win: (too lazy to try, but something like *FOO*)
Take care,
Dennis
> I have successfully done it. You are right about the clarity of the code
> in F95. It is also very concise.
>
> Regards!
>
More information about the Fortran
mailing list