1+ import click
12import datetime
23import logging
34import os
5+ import sys
6+
47from pathlib import Path
58from subprocess import check_output , PIPE , Popen
6- import sys
79from tempfile import gettempdir , mkdtemp
810
9- import click
10-
11-
12- from benchmarks .user .advisor .advisor_logging import (check , log , progress ,
13- log_process )
11+ from advisor_logging import (check , log , progress , log_process )
1412
1513
1614@click .command ()
@@ -49,21 +47,21 @@ def run_with_advisor(path, output, name, exec_args):
4947 output = Path (output ).joinpath (name )
5048 output .mkdir (parents = True , exist_ok = True )
5149
52- # Intel Advisor and Intel compilers must be available through either Intel Parallel
53- # Studio or Intel oneAPI (currently tested versions include IPS 2020 Update 2 and
54- # oneAPI 2021 beta08)
50+ # Intel Advisor and Intel compilers must be available through either
51+ # Intel oneAPI (tested with Intel oneAPI 2025.1)
5552 try :
5653 ret = check_output (['advixe-cl' , '--version' ]).decode ("utf-8" )
5754 except FileNotFoundError :
5855 check (False , "Error: Couldn't detect `advixe-cl` to run Intel Advisor." )
5956
6057 try :
61- ret = check_output (['icc' , '--version' ]).decode ("utf-8" )
58+ ret = check_output (['icx' , '--version' ]).decode ("utf-8" )
59+ log ("Found icx version: %s" % ret .strip ())
6260 except FileNotFoundError :
63- check (False , "Error: Couldn't detect Intel Compiler (icc )." )
61+ check (False , "Error: Couldn't detect Intel Compiler (icx )." )
6462
6563 # All good, Intel compiler and advisor are available
66- os .environ ['DEVITO_ARCH' ] = 'intel '
64+ os .environ ['DEVITO_ARCH' ] = 'icx '
6765
6866 # Tell Devito to instrument the generated code for Advisor
6967 os .environ ['DEVITO_PROFILING' ] = 'advisor'
@@ -73,7 +71,7 @@ def run_with_advisor(path, output, name, exec_args):
7371 if devito_logging is None :
7472 os .environ ['DEVITO_LOGGING' ] = 'WARNING'
7573
76- with progress ('Setting up multi-threading environment' ):
74+ with progress ('Setting up multi-threading environment with OpenMP ' ):
7775 # Roofline analyses are recommended with threading enabled
7876 os .environ ['DEVITO_LANGUAGE' ] = 'openmp'
7977
@@ -90,14 +88,14 @@ def run_with_advisor(path, output, name, exec_args):
9088
9189 # Prevent NumPy from using threads, which otherwise leads to a deadlock when
9290 # used in combination with Advisor. This issue has been described at:
93- # `software.intel.com/en-us/forums/intel-advisor-xe/topic/780506`
91+ # `software.intel.com/en-us/forums/intel-advisor-xe/topic/780506`
9492 # Note: we should rather sniff the BLAS library used by NumPy, and set the
9593 # appropriate env var only
9694 os .environ ['OPENBLAS_NUM_THREADS' ] = '1'
9795 os .environ ['MKL_NUM_THREADS' ] = '1'
9896 # Note: `Numaexpr`, used by NumPy, also employs threading, so we shall disable
9997 # it too via the corresponding env var. See:
100- # `stackoverflow.com/questions/17053671/python-how-do-you-stop-numpy-from-multithreading` # noqa
98+ # `stackoverflow.com/questions/17053671/python-how-do-you-stop-numpy-from-multithreading` # noqa
10199 os .environ ['NUMEXPR_NUM_THREADS' ] = '1'
102100
103101 # To build a roofline with Advisor, we need to run two analyses back to
@@ -130,8 +128,8 @@ def run_with_advisor(path, output, name, exec_args):
130128 ]
131129 py_cmd = [sys .executable , str (path )] + exec_args .split ()
132130
133- # Before collecting the `survey` and `tripcounts` a "pure" python run to warmup the
134- # jit cache is preceded
131+ # Before collecting the `survey` and `tripcounts` a "pure" python run
132+ # to warmup the jit cache is preceded
135133
136134 log ('Starting Intel Advisor\' s `roofline` analysis for `%s`' % name )
137135 dt = datetime .datetime .now ()
@@ -147,6 +145,9 @@ def run_with_advisor(path, output, name, exec_args):
147145 advixe_handler .setFormatter (advixe_formatter )
148146 advixe_logger .addHandler (advixe_handler )
149147
148+ log ("Project folder: %s" % str (output ))
149+ log ("Logging progress in: `%s`" % str (advixe_handler ))
150+
150151 with progress ('Performing `cache warm-up` run' ):
151152 try :
152153 p_warm_up = Popen (py_cmd , stdout = PIPE , stderr = PIPE )
@@ -175,6 +176,8 @@ def run_with_advisor(path, output, name, exec_args):
175176 log ('python3 roofline.py --name %s --project %s --scale %f'
176177 % (name , str (output ), n_sockets ))
177178
179+ log ('\n To open the roofline using advixe-gui: ' )
180+ log ('advixe-gui %s' % str (output ))
178181
179182if __name__ == '__main__' :
180183 run_with_advisor ()
0 commit comments