[gomp4] Extend libgomp's fortran test coverage of host_data
Cesar Philippidis
cesar@codesourcery.com
Thu Aug 11 22:39:00 GMT 2016
This patch ports libgomp.oacc-c-c++-common/host_data-1.c to fortran.
Fortunately, the existing fortran host_data infrastructure was already
in place, so I had to do was port over the calls to Nvidia's CUDA BLAS
library.
There are a couple of details that one needs to consider when using CUDA
BLAS in gfortran. First, if you want to use Nvidia's wrapper functions
written in C to set up the appropriate cuda device contexts, then use
the thunking variants of the functions described here
<http://docs.nvidia.com/cuda/cublas/#appendix-b-cublas-fortran-bindings>.
Otherwise, it's much easier to let gfortran's OpenACC runtime manage the
data mappings and use the host_data clause to pass those data pointers
to the CUDA BLAS library calls.
In terms of calling the actual CUDA BLAS functions, there's already good
documentation for that here
<https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-with-C.html>.
Basically, those library calls need a function interface with a special
C binding. The function I tested in host_data-2.f90 is cublasSaxpy.
Other function interfaces will need to be created as necessary.
I've applied this patch to gomp-4_0-branch.
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gomp4-fortran-host_data.diff
Type: text/x-patch
Size: 2781 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20160811/a05e19ac/attachment.bin>
More information about the Fortran
mailing list