Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This add a Fortran interface for OCCA and respective tests and examples.
The implementation utilises the Fortran 2003
ISO_C_BINDING
module. Thus a Fortran 2003 compliant compiler is required. The interface relies on OCCA's C interface and is sthus limited to the functionality exposed via the C interface. The Fortran implementation is in most cases a simpleinterface
to the C functions, thus simply providing a standardised way for the compiler to call the C functions from a Fortran program.The Fortran interface is compiled into a shared library
libocca_fortran.so
, which can be simply linked to an application intending to use OCCA. Alternatively, the Fortran modules can be directly included in a statically compiled program, as demonstrated inexamples/fortran/03_static_compilation
.This resolves issue #104.
Future work
While this initial implementation is fully functional, a subsequent revision could include additional wrapper/convenience functions to make the interface more "Fortran-like".
The following lists a few examples in this regard:
interface
in order to hide theF_C_str
function in:device = occaCreateDeviceFromString(F_C_str(info))
C_loc
incould be hidden in a convenience function/wrapper analog to the proposed shim layer in 1.