Skip to content
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

Develop j #23

Closed
wants to merge 6 commits into from
Closed

Develop j #23

wants to merge 6 commits into from

Conversation

jguterl
Copy link
Contributor

@jguterl jguterl commented Oct 5, 2020

This is a pull request for the addition of openmp features to Forthon. This add-on provides methods to PyWrap to create threadprivate variables and associate, copy and nullify those threadprivate variables in each thread.

… v files.Example 'var(1:N-1) /5*0/' -> 'var(1:N-1) /(N-1)*0/
…wrappergenerator with a subclass, additional Forthon option to handle omp settings.
@dpgrote
Copy link
Owner

dpgrote commented Oct 13, 2020

Hi @jguterl - Is this replacing the previous pull request, #21? This does look better.

I did have the question about the ompvarlistfile - can this be handled by adding a variable attribute (threadprivate maybe) to the variables in the variable description files?

@jguterl
Copy link
Contributor Author

jguterl commented Oct 13, 2020 via email

@@ -106,6 +110,8 @@
else: forthonargs.append('--no2underscores')
if not writemodules: forthonargs.append('--nowritemodules')
if timeroutines: forthonargs.append('--timeroutines')
forthonargs.append('--omppkg {}'.format(omppkg))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this so that the omp arguments are only added to forthonargs when they are specified (i.e. not None)?

@@ -129,7 +129,8 @@ def __init__(self, machine=None, debug=0, fcompname=None, fcompexec=None, implic
self.popt = '-g'
self.extra_link_args += ['-g']
self.extra_compile_args += ['-g', '-O0']

if omp:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command line flag "-fopenmp" is gnu specific. Can you move this into the *_gfortran routines? On intel, the flag is "-qopenmp".

@jguterl
Copy link
Contributor Author

jguterl commented Oct 13, 2020 via email

@jguterl
Copy link
Contributor Author

jguterl commented Oct 13, 2020 via email

@@ -308,6 +308,9 @@ def processfile(packname, filename, othermacros=[], timeroutines=0):
elif text[i] == "'": i = re.search("'", text[2:]).start() + 2
i = re.search('/', text[i:]).start() + i
data = text[0:i+1]
if data.count('(')==1 and data.count(')')==1:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about what this is doing? I'm not sure how it works since it is doing an eval on the string between the parenthesis, but that variable is not know at this time.

@jguterl
Copy link
Contributor Author

jguterl commented Oct 13, 2020 via email

@dpgrote
Copy link
Owner

dpgrote commented Oct 13, 2020

If you know the cray openmp option then go ahead and add it.

@@ -101,6 +101,11 @@
parser.add_option('--writemodules', action='store_true', default=True, dest='writemodules')
parser.add_option('--nowritemodules', action='store_false', default=True, dest='writemodules', help="Don't write out the module definitions. Useful if the modules have been written already. Note that if variables of derived type are used, the original code will need to be modified. See example2. Also note that if this option is used, no checks are made to ensure the consistency between the interface file description and the actual module.")

# OMP related options
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the options listed in alphabetical order. Can you move these to between '--macro' and '--pkgbase'?

@dpgrote
Copy link
Owner

dpgrote commented Oct 19, 2020

Thanks for making the changes! This all looks good, though I have another request. I prefer the code to use some of the pep8 stylistic standards. This keeps the code looking unified and I believe easier to read. The standards I use are having spaces around equals signs, "x = y", a space after commas, "f(a, b)", and no spaces at the ends of lines. Can you make these changes? Then this PR can be merged. Thanks!

@jguterl
Copy link
Contributor Author

jguterl commented Oct 19, 2020 via email

@jguterl jguterl closed this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants