99from devito import (
1010 CustomDimension , DefaultDimension , Dimension , Eq , Function , Grid , Inc , Operator ,
1111 PrecomputedSparseTimeFunction , ReduceMax , ReduceMin , ReduceMinMax , SpaceDimension ,
12- SparseTimeFunction , SubDimension , TimeFunction , configuration , cos , dimensions , info
12+ SparseTimeFunction , SubDimension , TimeFunction , configuration , cos , dimensions , info ,
13+ switchconfig
1314)
1415from devito .arch .compiler import IntelCompiler , OneapiCompiler
1516from devito .exceptions import InvalidArgument
@@ -1238,7 +1239,6 @@ def test_parallel_prec_inject(self):
12381239
12391240class TestNestedParallelism :
12401241
1241- @skipif ('nointel' )
12421242 def test_basic (self ):
12431243 grid = Grid (shape = (3 , 3 , 3 ))
12441244
@@ -1251,7 +1251,6 @@ def test_basic(self):
12511251 'par-dynamic-work' : 0 }))
12521252
12531253 # Does it compile? Honoring the OpenMP specification isn't trivial
1254- print (op )
12551254 assert op .cfunction
12561255
12571256 # Does it produce the right result
@@ -1271,7 +1270,6 @@ def test_basic(self):
12711270 assert iterations [2 ].pragmas [0 ].ccode .value == \
12721271 'omp parallel for schedule(dynamic,1) num_threads(nthreads_nested)'
12731272
1274- @skipif ('nointel' )
12751273 def test_collapsing (self ):
12761274 grid = Grid (shape = (3 , 3 , 3 ))
12771275
@@ -1280,7 +1278,6 @@ def test_collapsing(self):
12801278
12811279 op = Operator (Eq (u .forward , u + f + 1 ),
12821280 opt = ('blocking' , 'openmp' , {'par-nested' : 0 ,
1283- 'cire-rotate' : True ,
12841281 'par-collapse-ncores' : 1 ,
12851282 'par-collapse-work' : 0 ,
12861283 'par-dynamic-work' : 0 }))
@@ -1302,7 +1299,7 @@ def test_collapsing(self):
13021299 ('omp parallel for collapse(2) schedule(dynamic,1) '
13031300 'num_threads(nthreads_nested)' )
13041301
1305- @skipif ( 'nointel ' )
1302+ @switchconfig ( compiler = 'icc ' )
13061303 def test_multiple_subnests_v0 (self ):
13071304 grid = Grid (shape = (3 , 3 , 3 ))
13081305 x , y , z = grid .dimensions
@@ -1335,7 +1332,7 @@ def test_multiple_subnests_v0(self):
13351332 ('omp parallel for collapse(2) schedule(dynamic,1) '
13361333 'num_threads(nthreads_nested)' )
13371334
1338- @skipif ( 'nointel ' )
1335+ @switchconfig ( compiler = 'icc ' )
13391336 def test_multiple_subnests_v1 (self ):
13401337 """
13411338 Unlike ``test_multiple_subnestes_v0``, now we use the ``cire-rotate=True``
@@ -1374,7 +1371,6 @@ def test_multiple_subnests_v1(self):
13741371 assert trees [- 1 ][3 ].pragmas [0 ].ccode .value == \
13751372 'omp parallel for schedule(dynamic,1) num_threads(nthreads_nested)'
13761373
1377- @skipif ('nointel' )
13781374 @pytest .mark .parametrize ('blocklevels' , [1 , 2 ])
13791375 def test_nested_cache_blocking_structure_subdims (self , blocklevels ):
13801376 """
@@ -1438,7 +1434,6 @@ def test_nested_cache_blocking_structure_subdims(self, blocklevels):
14381434 ('omp parallel for collapse(2) schedule(dynamic,1) '
14391435 'num_threads(nthreads_nested)' )
14401436
1441- @skipif ('nointel' )
14421437 @pytest .mark .parametrize ('exprs,collapsed,scheduling' , [
14431438 (['Eq(u.forward, u.dx)' ], '2' , 'static' ),
14441439 (['Eq(u.forward, u.dy)' ], '2' , 'static' ),
@@ -1471,7 +1466,6 @@ def test_collapsing_w_wo_halo(self, exprs, collapsed, scheduling):
14711466 assert iterations [1 ].pragmas [0 ].ccode .value == \
14721467 "" .join ([ompfor_string , scheduling_string ])
14731468
1474- @skipif ('device' )
14751469 def test_nested_parallelism_support (self ):
14761470 grid = Grid (shape = (10 , 10 , 10 ))
14771471
@@ -1484,7 +1478,9 @@ def test_nested_parallelism_support(self):
14841478 v1 .data_with_halo [:] = 1.
14851479
14861480 eqn = Eq (v .forward , (v .dx * (1 + 2 * f ) * f ).dx )
1487- op = Operator (eqn , opt = ('advanced' , {'openmp' : True , 'par-nested' : 0 }))
1481+ op = Operator (eqn , opt = ('advanced' , {'openmp' : True ,
1482+ 'par-collapse-ncores' : 1 ,
1483+ 'par-nested' : 0 }))
14881484
14891485 bns , _ = assert_blocking (op , {'x0_blk0' })
14901486 trees = retrieve_iteration_tree (bns ['x0_blk0' ])
@@ -1493,13 +1489,15 @@ def test_nested_parallelism_support(self):
14931489 # Check omp pargams
14941490 assert trees [0 ][0 ].pragmas [0 ].ccode .value == \
14951491 'omp for collapse(2) schedule(dynamic,1)'
1496- if isinstance (configuration ['compiler' ], (IntelCompiler , OneapiCompiler )):
1492+ if isinstance (configuration ['compiler' ], IntelCompiler ) and \
1493+ not isinstance (configuration ['compiler' ], OneapiCompiler ):
14971494 # Supports nested parallelism
14981495 assert trees [0 ][2 ].pragmas [0 ].ccode .value == \
1499- '#pragma omp parallel for collapse(2) schedule(dynamic,1)' \
1496+ 'omp parallel for collapse(2) schedule(dynamic,1)' \
15001497 ' num_threads(nthreads_nested)'
15011498 assert trees [1 ][2 ].pragmas [0 ].ccode .value == \
1502- trees [0 ][2 ].pragmas [0 ].ccode .value
1499+ 'omp parallel for collapse(2) schedule(static,1)' \
1500+ ' num_threads(nthreads_nested)'
15031501 else :
15041502 # Most compiler don't support nested parallelism
15051503 assert not trees [0 ][2 ].pragmas
0 commit comments