Skip to content

Commit 80ee778

Browse files
add to all examples
1 parent 963f293 commit 80ee778

24 files changed

Lines changed: 93 additions & 24 deletions

examples/ablation-workshop.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,13 +1207,16 @@ def my_post_step(step, t, dt, state):
12071207
dest="restart_file", nargs="?", action="store",
12081208
help="simulation restart file")
12091209
parser.add_argument("--casename", help="casename to use for i/o")
1210+
parser.add_argument("--cupy", action="store_true",
1211+
help="use cupy-based eager actx.")
12101212
args = parser.parse_args()
12111213
from warnings import warn
12121214
warn("Automatically turning off DV logging. MIRGE-Com Issue(578)")
12131215

12141216
from mirgecom.array_context import get_reasonable_array_context_class
12151217
actx_class = get_reasonable_array_context_class(
1216-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
1218+
lazy=args.lazy, distributed=True, profiling=args.profiling,
1219+
numpy=args.numpy, cupy=args.cupy)
12171220

12181221
logging.basicConfig(format="%(message)s", level=logging.INFO)
12191222
if args.casename:

examples/advection_diffusion_reaction.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,16 @@ def my_rhs(t, u):
331331
help="use numpy-based eager actx.")
332332
parser.add_argument("--restart_file", help="root name of restart file")
333333
parser.add_argument("--casename", help="casename to use for i/o")
334+
parser.add_argument("--cupy", action="store_true",
335+
help="use cupy-based eager actx.")
334336
args = parser.parse_args()
335337
lazy = args.lazy
336338

337339
from mirgecom.array_context import get_reasonable_array_context_class
338340
actx_class = get_reasonable_array_context_class(lazy=args.lazy, distributed=True,
339341
profiling=args.profiling,
340-
numpy=args.numpy)
342+
numpy=args.numpy,
343+
cupy=args.cupy)
341344

342345
logging.basicConfig(format="%(message)s", level=logging.INFO)
343346
if args.casename:

examples/autoignition.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,8 @@ def my_rhs(t, state):
652652
help="use numpy-based eager actx.")
653653
parser.add_argument("--restart_file", help="root name of restart file")
654654
parser.add_argument("--casename", help="casename to use for i/o")
655+
parser.add_argument("--cupy", action="store_true",
656+
help="use cupy-based eager actx.")
655657
args = parser.parse_args()
656658
from warnings import warn
657659
warn("Automatically turning off DV logging. MIRGE-Com Issue(578)")
@@ -667,7 +669,8 @@ def my_rhs(t, state):
667669

668670
from mirgecom.array_context import get_reasonable_array_context_class
669671
actx_class = get_reasonable_array_context_class(
670-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
672+
lazy=args.lazy, distributed=True, profiling=args.profiling,
673+
numpy=args.numpy, cupy=args.cupy)
671674

672675
logging.basicConfig(format="%(message)s", level=logging.INFO)
673676
if args.casename:

examples/blasius.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ def my_post_step(step, t, dt, state):
516516
help="enable lazy evaluation [OFF]")
517517
parser.add_argument("--numpy", action="store_true",
518518
help="use numpy-based eager actx.")
519+
parser.add_argument("--cupy", action="store_true",
520+
help="use cupy-based eager actx.")
519521

520522
args = parser.parse_args()
521523

@@ -531,7 +533,8 @@ def my_post_step(step, t, dt, state):
531533

532534
from mirgecom.array_context import get_reasonable_array_context_class
533535
actx_class = get_reasonable_array_context_class(
534-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
536+
lazy=args.lazy, distributed=True, profiling=args.profiling,
537+
numpy=args.numpy, cupy=args.cupy)
535538

536539
logging.basicConfig(format="%(message)s", level=logging.INFO)
537540
if args.casename:

examples/combozzle.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,8 @@ def dummy_rhs(t, state):
12541254
parser.add_argument("--casename", help="casename to use for i/o")
12551255
parser.add_argument("--tpe", action="store_true",
12561256
help="Use tensor product elements (quads/hexes).")
1257+
parser.add_argument("--cupy", action="store_true",
1258+
help="use cupy-based eager actx.")
12571259
args = parser.parse_args()
12581260

12591261
from warnings import warn
@@ -1270,7 +1272,8 @@ def dummy_rhs(t, state):
12701272

12711273
from mirgecom.array_context import get_reasonable_array_context_class
12721274
actx_class = get_reasonable_array_context_class(
1273-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
1275+
lazy=args.lazy, distributed=True, profiling=args.profiling,
1276+
numpy=args.numpy, cupy=args.cupy)
12741277

12751278
logging.basicConfig(format="%(message)s", level=logging.INFO)
12761279
if args.casename:

examples/doublemach.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ def my_rhs(t, state):
443443
help="use numpy-based eager actx.")
444444
parser.add_argument("--restart_file", help="root name of restart file")
445445
parser.add_argument("--casename", help="casename to use for i/o")
446+
parser.add_argument("--cupy", action="store_true",
447+
help="use cupy-based eager actx.")
446448
args = parser.parse_args()
447449

448450
from warnings import warn
@@ -455,7 +457,7 @@ def my_rhs(t, state):
455457
from mirgecom.array_context import get_reasonable_array_context_class
456458
actx_class = get_reasonable_array_context_class(lazy=args.lazy, distributed=True,
457459
profiling=args.profiling,
458-
numpy=args.numpy)
460+
numpy=args.numpy, cupy=args.cupy)
459461

460462
logging.basicConfig(format="%(message)s", level=logging.INFO)
461463
if args.casename:

examples/doublemach_physical_av.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ def _my_rhs_phys_visc_div_av(t, state):
716716
help="use numpy-based eager actx.")
717717
parser.add_argument("--restart_file", help="root name of restart file")
718718
parser.add_argument("--casename", help="casename to use for i/o")
719+
parser.add_argument("--cupy", action="store_true",
720+
help="use cupy-based eager actx.")
719721
args = parser.parse_args()
720722

721723
from warnings import warn
@@ -730,7 +732,7 @@ def _my_rhs_phys_visc_div_av(t, state):
730732
actx_class = get_reasonable_array_context_class(lazy=args.lazy,
731733
distributed=True,
732734
profiling=args.profiling,
733-
numpy=args.numpy)
735+
numpy=args.numpy, cupy=args.cupy)
734736

735737
logging.basicConfig(format="%(message)s", level=logging.INFO)
736738
if args.casename:

examples/heat-source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,14 @@ def my_post_step(step, t, dt, state):
242242
help="use numpy-based eager actx.")
243243
parser.add_argument("--restart_file", help="root name of restart file")
244244
parser.add_argument("--casename", help="casename to use for i/o")
245+
parser.add_argument("--cupy", action="store_true",
246+
help="use cupy-based eager actx.")
245247
args = parser.parse_args()
246248

247249
from mirgecom.array_context import get_reasonable_array_context_class
248250
actx_class = get_reasonable_array_context_class(
249-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
251+
lazy=args.lazy, distributed=True, profiling=args.profiling,
252+
numpy=args.numpy, cupy=args.cupy)
250253

251254
logging.basicConfig(format="%(message)s", level=logging.INFO)
252255
if args.casename:

examples/hotplate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ def my_rhs(t, state):
448448
help="use numpy-based eager actx.")
449449
parser.add_argument("--restart_file", help="root name of restart file")
450450
parser.add_argument("--casename", help="casename to use for i/o")
451+
parser.add_argument("--cupy", action="store_true",
452+
help="use cupy-based eager actx.")
451453
args = parser.parse_args()
452454

453455
from warnings import warn
@@ -460,7 +462,8 @@ def my_rhs(t, state):
460462

461463
from mirgecom.array_context import get_reasonable_array_context_class
462464
actx_class = get_reasonable_array_context_class(
463-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
465+
lazy=args.lazy, distributed=True, profiling=args.profiling,
466+
numpy=args.numpy, cupy=args.cupy)
464467

465468
logging.basicConfig(format="%(message)s", level=logging.INFO)
466469
if args.casename:

examples/lump.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ def my_rhs(t, state):
383383
help="use numpy-based eager actx.")
384384
parser.add_argument("--restart_file", help="root name of restart file")
385385
parser.add_argument("--casename", help="casename to use for i/o")
386+
parser.add_argument("--cupy", action="store_true",
387+
help="use cupy-based eager actx.")
386388
args = parser.parse_args()
387389

388390
from warnings import warn
@@ -395,7 +397,8 @@ def my_rhs(t, state):
395397

396398
from mirgecom.array_context import get_reasonable_array_context_class
397399
actx_class = get_reasonable_array_context_class(
398-
lazy=args.lazy, distributed=True, profiling=args.profiling, numpy=args.numpy)
400+
lazy=args.lazy, distributed=True, profiling=args.profiling,
401+
numpy=args.numpy, cupy=args.cupy)
399402

400403
logging.basicConfig(format="%(message)s", level=logging.INFO)
401404
if args.casename:

0 commit comments

Comments
 (0)