libvhcall-fortran
3.0.1
|
VH call Fortran API is a mechanism to append functions or subroutines in shared libraries on Vector Host (VH) as system calls on Vector Engine (VE).
SX-Aurora TSUBASA provides VH call Fortran API for invoking functions or subroutines in shared libraries on VH from a VE program as system calls. VH call Fortran API enables to develop a Fortran program using both VE and VH computing resources. It would be useful for offloading I/O and procedures not well-vectorized.
To develop VE programs using VH call Fortran API, please install libvhcall-fortran-devel package, which has vhcall_fotran.mod file declaring VH call Fortran API functions.
For example, execute the following command as root. On ve1
On ve3
If you execute a program using VH call only, no extra packages are required.
A VE program using VH Call needs to declare "USE VHCALL_FORTRAN"
and specify -lvhcall_fortran with compiling by nfort. In the module, the following API functions or subroutines are declared.
fvhcall_install()
loads a VH shared library.fvhcall_find()
searches an address of a symbol a function in the VH library.fvhcall_args_alloc()
allocates FVHCall arguments object (vhcall_args).fvhcall_args_set()
sets an argument of string, scalar or 1-3 dimensional array.fvhcall_args_clear()
clears arguments set in FVHCall arguments object.fvhcall_args_free()
frees FVHCall arguments object.fvhcall_invoke_with_args()
invokes a function or subroutine on VH side with passing arguments.fvhcall_uninstall()
unloads a VH shared library.For VE side, sending data to VH is implemented as API of passing arguments which INTENT is IN or INOUT. Receiving data from VH is also implemented as return value or argument which INTENT is OUT or INOUT.
Please see VH Call Fortran for more detail.
User can define Fortran function or subroutine for VH as below:
Please see VH Call Fortran for more detail.
This is a simple program using VH Call Fortran API.
Program invokes VH Fortran library subroutine and function. Subroutine has two arguments, real 1-dimensional array and integer of array size. Function has no argument and is defined in module.
Steps of program are below.
fvhcall_install()
, which returns a FVHCall handle, an identifier to specify the VH library loaded.fvhcall_find()
with the name of a subroutine and a VH call handle.fvhcall_args_alloc()
and set value by fvhcall_args_set()
fvhcall_invoke_with_args()
.fvhcall_invoke_with_args()
.fvhcall_args_free()
.fvhcall_uninstall()
.Put all files of this sample in the same directory.
Confirm indented lines in Makefile start with a tab. If they start with spaces, replace them to tabs.
Build the programs.