-
Notifications
You must be signed in to change notification settings - Fork 161
Create Fortran bindings module #2807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joewallwork
wants to merge
5
commits into
main
Choose a base branch
from
2805_fortran-mod
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−0
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8052bde
Add enzyme_mod containing activity descriptor bindings
joewallwork 47c59bd
Hook Fortran bindings up in build system
joewallwork 27b7edc
Rename enzyme_mod->enzyme
joewallwork 0479c37
Use enable_language in Fortran subdir
joewallwork 827e439
Add ENZYME_FORTRAN option for building bindings
joewallwork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| enable_language(Fortran) | ||
| include(FortranCInterface) | ||
| FortranCInterface_VERIFY(QUIET) | ||
|
|
||
| add_library(EnzymeFortran enzyme.f90) | ||
|
|
||
| # Install library, create target file | ||
| install( | ||
| TARGETS EnzymeFortran | ||
| EXPORT EnzymeFortranTargets | ||
| LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
| PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| INCLUDES | ||
| DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/EnzymeFortran) | ||
|
|
||
| # Install Fortran module file | ||
| if(NOT DEFINED CMAKE_INSTALL_MODULEDIR) | ||
| set( | ||
| CMAKE_INSTALL_MODULEDIR | ||
| "${CMAKE_INSTALL_INCLUDEDIR}/EnzymeFortran" | ||
| CACHE STRING "Directory in prefix to install generated module files" | ||
| ) | ||
| endif() | ||
| install(FILES "${CMAKE_Fortran_MODULE_DIRECTORY}/enzyme.mod" | ||
| DESTINATION "${CMAKE_INSTALL_MODULEDIR}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ! ===- enzyme.f90 - Fortran bindings for Enzyme ---------------------------=== ! | ||
| ! | ||
| ! Enzyme Project | ||
| ! | ||
| ! Part of the Enzyme Project, under the Apache License v2.0 with LLVM | ||
| ! Exceptions. See https://llvm.org/LICENSE.txt for license information. | ||
| ! SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| ! | ||
| ! If using this code in an academic setting, please cite the following: | ||
| ! @misc{enzymeGithub, | ||
| ! author = {William S. Moses and Valentin Churavy}, | ||
| ! title = {Enzyme: High Performance Automatic Differentiation of LLVM}, | ||
| ! year = {2020}, | ||
| ! howpublished = {\url{https://github.com/wsmoses/Enzyme}}, | ||
| ! note = {commit xxxxxxx} | ||
| ! } | ||
| ! | ||
| ! ===----------------------------------------------------------------------=== ! | ||
| ! | ||
| ! This file provides Fortran bindings for Enzyme. | ||
| ! | ||
| ! ===----------------------------------------------------------------------=== ! | ||
| module enzyme | ||
| use iso_c_binding, only: c_int | ||
| implicit none | ||
| private | ||
|
|
||
| ! Bindings for activity descriptors | ||
| integer(c_int), public, bind(C, name="enzyme_const") :: enzyme_const | ||
| integer(c_int), public, bind(C, name="enzyme_dup") :: enzyme_dup | ||
| integer(c_int), public, bind(C, name="enzyme_dupnoneed") :: enzyme_dupnoneed | ||
| integer(c_int), public, bind(C, name="enzyme_out") :: enzyme_out | ||
| integer(c_int), public, bind(C, name="enzyme_scalar") :: enzyme_scalar | ||
| integer(c_int), public, bind(C, name="enzyme_width") :: enzyme_width | ||
| integer(c_int), public, bind(C, name="enzyme_vector") :: enzyme_vector | ||
| end module enzyme | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.