FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

misc: Update advisor with oneAPI 2025 by georgebisbas · Pull Request #2533 · devitocodes/devito · GitHub

misc: Update advisor with oneAPI 2025 - #2533

Merged
FabioLuporini merged 11 commits into
masterfrom
advisor_refresh_II
Mar 7, 2025
Merged

misc: Update advisor with oneAPI 2025#2533
FabioLuporini merged 11 commits into
masterfrom
advisor_refresh_II

Conversation

Copy link
Copy Markdown
Contributor

Some more changes are needed, but finally works

Copy link
Copy Markdown

Check out this pull request on 

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Comment thread devito/arch/compiler.py Outdated
Comment thread devito/arch/compiler.py Outdated
# Locate the Intel Advisor installation and
# add the necessary flags to the compiler
from devito.operator.profiling import locate_intel_advisor
path = locate_intel_advisor()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why aren't all those set by the setvars.sh that's what it's supposed to be for

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Unfortunately, this was true with Intel studios, but now they are not by default. You have to link explicitly. At least, this is what I see.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

And this is actually why it stopped working at some point

codecov Bot commented Feb 10, 2025
edited
Loading

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 41.66667% with 28 lines in your changes missing coverage. Please review.

Project coverage is 87.55%. Comparing base (e1dcb86) to head (fd5df3f).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
devito/operator/profiling.py 31.57% 12 Missing and 1 partial ⚠️
devito/arch/archinfo.py 25.00% 9 Missing ⚠️
tests/test_benchmark.py 40.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2533      +/-   ##
==========================================
+ Coverage   87.52%   87.55%   +0.03%     
==========================================
  Files         238      238              
  Lines       47034    47032       -2     
  Branches     4144     4143       -1     
==========================================
+ Hits        41165    41178      +13     
+ Misses       5176     5161      -15     
  Partials      693      693              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


if not project:
err('Could not open project %s.' % project)
err(f'Could not open project {project}.')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What does open_project return if it fails to open the project? This error message might return something cryptic since project gets overwritten

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I was sure I had replied in this, not sure I cannot see my message. This is part of the advisor API, it should already be there

https://www.intel.com/content/www/us/en/developer/articles/training/how-to-use-the-intel-advisor-python-api.html

Comment thread benchmarks/user/advisor/roofline.py Outdated
"As you can see from this roofline graph, the main point is different from the single point of the previous graph. Moreover, each point is labelled with 'Time' and 'Incidence' indicators. These represent the total execution time of each loop's main body and their percentage incidence on the total execution time of the main time loop."
]
},
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

All this is redundant in my opinion to be treated as-a-worthy to mention API

Comment thread devito/operator/profiling.py Outdated
compiler.add_library_dirs(libdir)
compiler.add_ldflags('-Wl,-rpath,%s' % libdir)
super(AdvisorProfiler, self).__init__(name)
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no need

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

AFAICT, this is just yet another empty constructor? droppable?

Comment thread devito/arch/compiler.py Outdated
self.__init_intel_mpi__()
self.__init_intel_mpi_flags__()

if configuration['profiling'] == 'advisor':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

see comment below, but basically since "profiling" requires third-party tools (as opposed to MPI which is an actual API) I have a preference for this bit of logic to be kept in profiling

georgebisbas force-pushed the advisor_refresh_II branch 3 times, most recently from 4c1f058 to ed910e5 Compare February 14, 2025 07:48
Comment thread conftest.py Outdated
Comment thread devito/arch/archinfo.py Outdated
Comment thread devito/operator/profiling.py Outdated
Comment thread devito/operator/operator.py Outdated
# Required for the jit-compilation
op._compiler = kwargs['compiler']

# Add any metadata from the profiler

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nitpicking, I wouldn't call it "metadata"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

hope is better

Comment thread devito/arch/archinfo.py
Comment thread tests/test_benchmark.py Outdated
georgebisbas requested a review from EdCaunt February 14, 2025 08:36
Comment thread conftest.py Outdated
break
# Skip if icx or advisor are not available
if i not in 'only-advisor' or \
if i not in ('noadvisor') or \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no this is wrong as it's not a tuple

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

omg, forgot the comma

Comment thread devito/operator/profiling.py Outdated
libdir = path.joinpath('lib64').as_posix()
self._lib_dirs = [libdir]
else:
warning("Intel Advisor not found; reverting to `advanced`")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

is it really reverting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

good catch, indeed it is reverting, but there is another mini-bug. It was reverting to basic, now it is reverting to advanced, and dropped a double-emmited warning due to this

Comment on lines -517 to -518
warning("Couldn't set up `%s` profiler; reverting to `advanced`" % level)
profiler = profiler_registry['basic'](name)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Here, it was reverting to basic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ok but no need for that extra var imho (nitpicking)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

well this was only for a better fstring...but ok

Comment thread devito/operator/profiling.py Outdated
if path:
self._include_dirs = [path.joinpath('include').as_posix()]
libdir = path.joinpath('lib64').as_posix()
self._lib_dirs = [libdir]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no, instances shouldn't change class attributes like that....

and btw why is it even a class attribute ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What should it have been?

Comment on lines -517 to -518
warning("Couldn't set up `%s` profiler; reverting to `advanced`" % level)
profiler = profiler_registry['basic'](name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ok but no need for that extra var imho (nitpicking)

FabioLuporini changed the title advisor: Update advisor with oneAPI 2025 misc: Update advisor with oneAPI 2025 Feb 17, 2025
Comment thread devito/operator/profiling.py Outdated

path = get_advisor_path()
if path:
self.add_include_dir(path.joinpath('include').as_posix())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

as explained above, this should just be self._include_dirs.append(...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yes

georgebisbas force-pushed the advisor_refresh_II branch 2 times, most recently from c6e780d to c700ca2 Compare February 26, 2025 12:53
Comment thread conftest.py Outdated
break
# Skip if icx or advisor are not available
if i == 'noadvisor' and \
not isinstance(configuration['compiler'], IntelCompiler) or \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this is wrong again, I think, because of and/or operator precedence...

The fact we got this wrong multiple times and nothing breaks on CI suggests it's not very useful maybe

if path:
self._include_dirs.append(path.joinpath('include').as_posix())
self._lib_dirs.append(path.joinpath('lib64').as_posix())
self._attempted_init = True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

maybe for another day, but these three lines

     self._attempted_init = True
else:
     self._attempted_init = False

could become a single line

self._attempted_init = bool(path)

but anyway, nitpicking... maybe you can do it in another PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

but why append then if path is None? If the compiler reverts to advanced in the case of advisor's absence, the paths will be linked right?

"output_type": "stream",
"text": [
"\u001b[1;37;32mOpening project...\u001b[0m\n",
"\u001b[1;37;32mOpening project /home/gb4018/workspace/devitocodes/devito/examples/performance/profilings/JupyterProfiling...\u001b[0m\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is not OK, I don't like personal dirs in logs (ie gb4018)

"output_type": "stream",
"text": [
"\u001b[1;37;32mOpening project...\u001b[0m\n",
"\u001b[1;37;32mOpening project /home/gb4018/workspace/devitocodes/devito/examples/performance/profilings/JupyterProfiling...\u001b[0m\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

same here

# Required for the jit-compilation
op._compiler = kwargs['compiler']

# Required for compilation by the profiler

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why aren't those part of the profller init?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It was before, and this was the reason it was not working, as a different compiler was build after doing the profiler init. Related discussion here: https://devitocodes.slack.com/archives/C7JMLMSG0/p1739458707616429?thread_ts=1739458681.588539&cid=C7JMLMSG0

JDBetteridge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nitpicks. But otherwise LGTM

Comment thread benchmarks/user/advisor/roofline.py Outdated
# saving the chart in PNG format
plt.savefig('%s.png' % name, bbox_extra_artists=(legend,), bbox_inches='tight')
# saving the chart in PDF format
plt.savefig('%s.pdf' % name, bbox_extra_artists=(legend,), bbox_inches='tight')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
plt.savefig('%s.pdf' % name, bbox_extra_artists=(legend,), bbox_inches='tight')
plt.savefig(f'{name}.pdf', bbox_extra_artists=(legend,), bbox_inches='tight')

Comment thread benchmarks/user/advisor/README.md Outdated
generate a roofline. Both are run by `run_advisor.py`.
* Requires python3, untested in earlier versions of python and conda environments
* Currently requires download of repository and running `pip3 install .`, the scripts
* Requires Python3, untested in conda environments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
* Requires Python3, untested in conda environments
* Requires Python 3.9 or later, untested in conda environments

Let's not use unsupported Python versions!

Comment thread benchmarks/user/advisor/roofline.py Outdated
plt.savefig('%s.pdf' % name, bbox_extra_artists=(legend,), bbox_inches='tight')
figpath = os.path.realpath(__file__).split(os.path.basename(__file__))[0]
log('Figure saved in %s%s.png.' % (figpath, name))
log('\nFigure saved in %s%s.pdf.' % (figpath, name))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
log('\nFigure saved in %s%s.pdf.' % (figpath, name))
log(f'\nFigure saved in {figpath}{name}.pdf.')

Comment thread benchmarks/user/advisor/roofline.py Outdated
f.write(json.dumps(roofline_data))

log('JSON file saved as %s.json.' % name)
log('\nJSON file saved as %s.json.' % name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
log('\nJSON file saved as %s.json.' % name)
log(f'\nJSON file saved as {name}.json.')

FabioLuporini merged commit b22dd66 into master Mar 7, 2025
FabioLuporini deleted the advisor_refresh_II branch March 7, 2025 08:26

Copy link
Copy Markdown
Contributor

Merged, thanks

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL