From 18ded81764da7dc019c7ad69938e43017674e762 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 11:06:30 +0100 Subject: [PATCH 1/9] CI: Install zoidberg and new versions --- requirements.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index bc3d31de2b..52d3076d58 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,9 @@ -Jinja2~=3.1.4 -numpy~=2.0.0 -scipy>=1.11.0 -netcdf4~=1.7.1 +Jinja2>=3.1.4 +numpy>=2.0.0 +scipy>=1.14.1 +netcdf4>=1.7.1 matplotlib>=3.7.0 -Cython~=3.0.0 -boututils~=0.2.1 -boutdata~=0.2.1 +Cython>=3.0.0 +boututils>=0.2.1 +boutdata>=0.2.1 +zoidberg>=0.2.2 From ceb51f57aef9006691355d894163b9787dd68155 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 13:13:15 +0100 Subject: [PATCH 2/9] DEBUG: monkey patch zoidberg --- tests/MMS/spatial/fci/runtest | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/MMS/spatial/fci/runtest b/tests/MMS/spatial/fci/runtest index 204a9cc271..c64a596f9a 100755 --- a/tests/MMS/spatial/fci/runtest +++ b/tests/MMS/spatial/fci/runtest @@ -74,6 +74,16 @@ for nslice in nslices: # Create the grid grid = zb.grid.Grid(poloidal_grid, ycoords, ylength, yperiodic=yperiodic) # Make and write maps + from scipy.interpolate import RectBivariateSpline as RBS + + def myRBS(a, b, c): + mx, my = c.shape + kx = max(mx - 1, 1) + kx = min(kx, 3) + print(c.shape, kx) + return RBS(a, b, c, kx=kx) + + zb.poloidal_grid.RectBivariateSpline = myRBS maps = zb.make_maps(grid, field, nslice=nslice, quiet=True) zb.write_maps( grid, field, maps, new_names=False, metric2d=conf.isMetric2D(), quiet=True From 5050fd0797154cc292554446d9449c360805ff45 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 11:53:04 +0100 Subject: [PATCH 3/9] Remove x-boundary --- tests/integrated/test-fci-boundary/runtest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integrated/test-fci-boundary/runtest b/tests/integrated/test-fci-boundary/runtest index 16cb4ee443..b4be95cb24 100755 --- a/tests/integrated/test-fci-boundary/runtest +++ b/tests/integrated/test-fci-boundary/runtest @@ -29,8 +29,8 @@ mthread = 2 directory = "data" with DataFile("grid.fci.nc") as grid: - xfwd = grid.read("forward_xt_prime")[1:-1] - xbwd = grid.read("backward_xt_prime")[1:-1] + xfwd = grid.read("forward_xt_prime")[2:-2] + xbwd = grid.read("backward_xt_prime")[2:-2] nx = xfwd.shape[0] From c9c4a5a169b6368f5ab738da39692a9d54d3afef Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 13:58:17 +0100 Subject: [PATCH 4/9] Specify MXG=1 --- tests/MMS/spatial/fci/runtest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/MMS/spatial/fci/runtest b/tests/MMS/spatial/fci/runtest index c64a596f9a..91ba0c987d 100755 --- a/tests/MMS/spatial/fci/runtest +++ b/tests/MMS/spatial/fci/runtest @@ -61,7 +61,7 @@ for nslice in nslices: # Note that the Bz and Bzprime parameters here must be the same as in mms.py field = zb.field.Slab(Bz=0.05, Bzprime=0.1) # Create rectangular poloidal grids - poloidal_grid = zb.poloidal_grid.RectangularPoloidalGrid(nx, n, 0.1, 1.0) + poloidal_grid = zb.poloidal_grid.RectangularPoloidalGrid(nx, n, 0.1, 1.0, MXG=1) # Set the ylength and y locations ylength = 10.0 @@ -84,7 +84,7 @@ for nslice in nslices: return RBS(a, b, c, kx=kx) zb.poloidal_grid.RectBivariateSpline = myRBS - maps = zb.make_maps(grid, field, nslice=nslice, quiet=True) + maps = zb.make_maps(grid, field, nslice=nslice, quiet=True, MXG=1) zb.write_maps( grid, field, maps, new_names=False, metric2d=conf.isMetric2D(), quiet=True ) From bc052cc5c0fb855c6eae0b47007b1e502d3684ac Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 14:26:42 +0100 Subject: [PATCH 5/9] use MXG from grid file --- tests/integrated/test-fci-boundary/runtest | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/integrated/test-fci-boundary/runtest b/tests/integrated/test-fci-boundary/runtest index b4be95cb24..8cd2b9caa5 100755 --- a/tests/integrated/test-fci-boundary/runtest +++ b/tests/integrated/test-fci-boundary/runtest @@ -29,16 +29,20 @@ mthread = 2 directory = "data" with DataFile("grid.fci.nc") as grid: - xfwd = grid.read("forward_xt_prime")[2:-2] - xbwd = grid.read("backward_xt_prime")[2:-2] + try: + MXG = grid.read("MXG") + except: + MXG = 1 + xfwd = grid.read("forward_xt_prime")[MXG:-MXG] + xbwd = grid.read("backward_xt_prime")[MXG:-MXG] nx = xfwd.shape[0] regions = { - "xin_fwd": xfwd < 1, - "xout_fwd": xfwd > nx, - "xin_bwd": xbwd < 1, - "xout_bwd": xbwd > nx, + "xin_fwd": xfwd < MXG, + "xout_fwd": xfwd > nx + MXG - 1, + "xin_bwd": xbwd < MXG, + "xout_bwd": xbwd > nx + MXG - 1, } regions = {k: v.astype(int) for k, v in regions.items()} From 21ea39fdde123488a166342c7ddfe5b624f13622 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 17:05:02 +0100 Subject: [PATCH 6/9] Remove debug statement --- tests/MMS/spatial/fci/runtest | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/MMS/spatial/fci/runtest b/tests/MMS/spatial/fci/runtest index 91ba0c987d..e1873a7283 100755 --- a/tests/MMS/spatial/fci/runtest +++ b/tests/MMS/spatial/fci/runtest @@ -80,7 +80,6 @@ for nslice in nslices: mx, my = c.shape kx = max(mx - 1, 1) kx = min(kx, 3) - print(c.shape, kx) return RBS(a, b, c, kx=kx) zb.poloidal_grid.RectBivariateSpline = myRBS From 67f1da3d271c91daee49721c4b04500475a41109 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 17:05:11 +0100 Subject: [PATCH 7/9] Remove python2 compat --- tests/MMS/spatial/fci/runtest | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/MMS/spatial/fci/runtest b/tests/MMS/spatial/fci/runtest index e1873a7283..a93f4d3aff 100755 --- a/tests/MMS/spatial/fci/runtest +++ b/tests/MMS/spatial/fci/runtest @@ -6,9 +6,6 @@ # Cores: 2 # requires: zoidberg -from __future__ import division -from __future__ import print_function - from boututils.run_wrapper import build_and_log, launch_safe from boutdata.collect import collect import boutconfig as conf From dc9047dbad717a176e915d5a03c589a4a943cf5e Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 7 Jan 2025 17:12:01 +0100 Subject: [PATCH 8/9] Prefer get with default value --- tests/integrated/test-fci-boundary/runtest | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/integrated/test-fci-boundary/runtest b/tests/integrated/test-fci-boundary/runtest index 8cd2b9caa5..1b1460da53 100755 --- a/tests/integrated/test-fci-boundary/runtest +++ b/tests/integrated/test-fci-boundary/runtest @@ -29,10 +29,7 @@ mthread = 2 directory = "data" with DataFile("grid.fci.nc") as grid: - try: - MXG = grid.read("MXG") - except: - MXG = 1 + MXG = grid.get("MXG", default=1) xfwd = grid.read("forward_xt_prime")[MXG:-MXG] xbwd = grid.read("backward_xt_prime")[MXG:-MXG] From 48f0a361f2bb2e3b6a85430bf640b40eefaba2f7 Mon Sep 17 00:00:00 2001 From: David Bold Date: Wed, 8 Jan 2025 09:26:26 +0100 Subject: [PATCH 9/9] CI: Try limiting multithreading --- .ci_fedora.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.ci_fedora.sh b/.ci_fedora.sh index 974a23a362..77e7f45055 100755 --- a/.ci_fedora.sh +++ b/.ci_fedora.sh @@ -59,7 +59,11 @@ else export OMPI_MCA_rmaps_base_oversubscribe=yes export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe export TRAVIS=true + # Try limiting openmp threads export FLEXIBLAS=NETLIB + export MKL_NUM_THREADS=1 + export NUMEXPR_NUM_THREADS=1 + export OMP_NUM_THREADS=1 cd cd BOUT-dev echo "starting configure"