-
Notifications
You must be signed in to change notification settings - Fork 116
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
F frontend #1275
Merged
Merged
F frontend #1275
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4665509
initial try
5752115
initial commit with commented, formatted core of the fortran frontend
49e8dde
reverting incorrect extSDFG addition
58bc67c
adding tests for fortran frontend
1e263c9
Merge branch 'master' into f_frontend
acalotoiu 5c49dc9
fixing setup
ad4cf66
Merge branch 'f_frontend' of https://github.com/spcl/dace into f_fron…
e08f5bc
added test descriptions
9f7e181
resolving comments
a7f383a
Merge branch 'master' into f_frontend
alexnick83 226255d
fixing CI
4ece800
testing new options to get CI to work
3143c90
testing new options to get CI to work
1d34d5c
Merge branch 'master' into f_frontend
acalotoiu ee4e289
fixing is fpga call
13eb043
Merge branch 'f_frontend' of https://github.com/spcl/dace into f_fron…
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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,62 @@ | ||
# Copyright 2019-2023 ETH Zurich and the DaCe authors. All rights reserved. | ||
""" Simple Fortran SDFG command-line compiler. """ | ||
|
||
import dace | ||
import os | ||
import sys | ||
import argparse | ||
import shutil | ||
from dace.frontend.fortran import fortran_parser | ||
|
||
def main(): | ||
# Command line options parser | ||
parser = argparse.ArgumentParser(description='Fortran to SDFG command-line transpiler.') | ||
|
||
# Required argument for Fortran file path | ||
parser.add_argument('filepath', help='<PATH TO FORTRAN FILE>', type=str) | ||
|
||
# Optional argument for output location | ||
parser.add_argument('-o', | ||
'--out', | ||
type=str, | ||
help='If provided, saves library as the given file or in the specified path, ' | ||
'together with a header file.') | ||
|
||
parser.add_argument('-O', | ||
'--optimize', | ||
dest='optimize', | ||
action='store_true', | ||
help="If set, invokes the command-line optimization" | ||
" interface", | ||
default=False) | ||
|
||
args = parser.parse_args() | ||
|
||
filepath = args.filepath | ||
if not os.path.isfile(filepath): | ||
print('Fortran file', filepath, 'not found') | ||
exit(1) | ||
|
||
outpath = args.out | ||
|
||
# Load SDFG | ||
sdfg = fortran_parser.create_sdfg_from_fortran_file(filepath) | ||
|
||
if args.optimize: | ||
sdfg.optimize() | ||
|
||
# Compile SDFG | ||
sdfg.compile(outpath) | ||
|
||
# Copying header file to optional path | ||
if outpath is not None: | ||
source = os.path.join(sdfg.build_folder, 'include', sdfg.name + '.h') | ||
if os.path.isdir(outpath): | ||
outpath = os.path.join(outpath, sdfg.name + '.h') | ||
else: | ||
outpath = os.path.join(os.path.dirname(outpath), sdfg.name + '.h') | ||
shutil.copyfile(source, outpath) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit sad that
fcdc
has to live separate fromsdfgcc
, since they seem functionally and programatically identical in all but one (or two, if you count the import) line.What do you think about just using
sdfgcc
and detecting whether something is an SDFG or Fortran file? The namesdfgcc
may be sub-optimal in that case, maybe it makes sense to have adace-cc
that autodetects (or is told explicitly what it is with--source-lang
, and havesdfgcc
aliasdace-cc --source-lang=sdfg
andfcdc
aliasdace-cc --source-lang=fortran
.Not a crucial point, but the code duplication is a bit sad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - this was done by request of @tbennun . What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this. We can discuss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seconding the idea of
dace-cc
with autodetection and additional parameters.