diff --git a/src/gt4py/backend/pyext_builder.py b/src/gt4py/backend/pyext_builder.py index 5e61df3d67..79988a2195 100644 --- a/src/gt4py/backend/pyext_builder.py +++ b/src/gt4py/backend/pyext_builder.py @@ -72,12 +72,7 @@ def get_gt_pyext_build_opts( else: cuda_arch = "" - if gt_version == 1: - gt_include_path = gt_config.build_settings["gt_include_path"] - elif gt_version == 2: - gt_include_path = gt_config.build_settings["gt2_include_path"] - else: - raise RuntimeError(f"GridTools version {gt_version}.x is not supported") + gt_include_path = gt_config.build_settings["gt_include_path"] import os diff --git a/src/gt4py/config.py b/src/gt4py/config.py index d7ab368620..dc9567bcfa 100644 --- a/src/gt4py/config.py +++ b/src/gt4py/config.py @@ -37,11 +37,6 @@ os.path.join(os.path.dirname(__file__), "_external_src", GT_REPO_DIRNAME, "include") ) -GT2_REPO_DIRNAME: str = "gridtools2" -GT2_INCLUDE_PATH: str = os.path.abspath( - os.path.join(os.path.dirname(__file__), "_external_src", GT2_REPO_DIRNAME, "include") -) - GT_CPP_TEMPLATE_DEPTH: int = 1024 # Settings dict @@ -52,7 +47,6 @@ "cuda_library_path": os.path.join(CUDA_ROOT, "lib64"), "cuda_arch": os.environ.get("CUDA_ARCH", None), "gt_include_path": os.environ.get("GT_INCLUDE_PATH", GT_INCLUDE_PATH), - "gt2_include_path": os.environ.get("GT2_INCLUDE_PATH", GT2_INCLUDE_PATH), "openmp_cppflags": os.environ.get("OPENMP_CPPFLAGS", "-fopenmp").split(), "openmp_ldflags": os.environ.get("OPENMP_LDFLAGS", "-fopenmp").split(), "extra_compile_args": { diff --git a/src/gt4py/gt_src_manager.py b/src/gt4py/gt_src_manager.py index 052086170f..3a1e98cab7 100644 --- a/src/gt4py/gt_src_manager.py +++ b/src/gt4py/gt_src_manager.py @@ -21,41 +21,28 @@ import gt4py.config as gt_config -_DEFAULT_GRIDTOOLS_VERSION = 2 - -_GRIDTOOLS_GIT_REPO = { - 1: "https://github.com/GridTools/gridtools.git", - 2: "https://github.com/GridTools/gridtools.git", -} -_GRIDTOOLS_GIT_BRANCHES = { - 1: "v1.1.4", - 2: "v2.2.0", -} -_GRIDTOOLS_INCLUDE_PATHS = { - 1: gt_config.build_settings["gt_include_path"], - 2: gt_config.build_settings["gt2_include_path"], -} -_GRIDTOOLS_REPO_DIRNAMES = {1: gt_config.GT_REPO_DIRNAME, 2: gt_config.GT2_REPO_DIRNAME} - - -def install_gt_sources(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> bool: - assert major_version in _GRIDTOOLS_GIT_BRANCHES - - is_ok = has_gt_sources(major_version) +_GRIDTOOLS_GIT_REPO = "https://github.com/GridTools/gridtools.git" +_GRIDTOOLS_GIT_BRANCH = "v2.2.0" +_GRIDTOOLS_INCLUDE_PATHS = gt_config.build_settings["gt_include_path"] +_GRIDTOOLS_REPO_DIRNAMES = gt_config.GT_REPO_DIRNAME + + +def install_gt_sources() -> bool: + is_ok = has_gt_sources() if not is_ok: - GIT_BRANCH = _GRIDTOOLS_GIT_BRANCHES[major_version] - GIT_REPO = _GRIDTOOLS_GIT_REPO[major_version] + GIT_BRANCH = _GRIDTOOLS_GIT_BRANCH + GIT_REPO = _GRIDTOOLS_GIT_REPO install_path = os.path.dirname(__file__) target_path = os.path.abspath( - os.path.join(install_path, "_external_src", _GRIDTOOLS_REPO_DIRNAMES[major_version]) + os.path.join(install_path, "_external_src", _GRIDTOOLS_REPO_DIRNAMES) ) if not os.path.exists(target_path): git_cmd = f"git clone --depth 1 -b {GIT_BRANCH} {GIT_REPO} {target_path}" print(f"Getting GridTools C++ sources...\n$ {git_cmd}") subprocess.check_call(git_cmd.split(), stderr=subprocess.STDOUT) - is_ok = has_gt_sources(major_version) + is_ok = has_gt_sources() if is_ok: print("Success!!") else: @@ -68,12 +55,10 @@ def install_gt_sources(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> bool: return is_ok -def remove_gt_sources(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> bool: - assert major_version in _GRIDTOOLS_REPO_DIRNAMES - +def remove_gt_sources() -> bool: install_path = os.path.dirname(__file__) target_path = os.path.abspath( - os.path.join(install_path, "_external_src", _GRIDTOOLS_REPO_DIRNAMES[major_version]) + os.path.join(install_path, "_external_src", _GRIDTOOLS_REPO_DIRNAMES) ) is_ok = not os.path.exists(target_path) @@ -95,15 +80,12 @@ def remove_gt_sources(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> bool: return is_ok -def has_gt_sources(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> bool: - assert major_version in _GRIDTOOLS_INCLUDE_PATHS - return os.path.isfile( - os.path.join(_GRIDTOOLS_INCLUDE_PATHS[major_version], "gridtools", "common", "defs.hpp") - ) +def has_gt_sources() -> bool: + return os.path.isfile(os.path.join(_GRIDTOOLS_INCLUDE_PATHS, "gridtools", "common", "defs.hpp")) -def _print_status(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> None: - if has_gt_sources(major_version): +def _print_status() -> None: + if has_gt_sources(): print("\nGridTools sources are installed\n") else: print("\nGridTools are missing (GT compiled backends will not work)\n") @@ -112,21 +94,13 @@ def _print_status(major_version: int = _DEFAULT_GRIDTOOLS_VERSION) -> None: if __name__ == "__main__": parser = argparse.ArgumentParser(description="Manage GridTools C++ code sources") parser.add_argument("command", choices=["install", "remove", "status"]) - parser.add_argument( - "-m", - "--major-version", - choices=list(_GRIDTOOLS_GIT_BRANCHES.keys()), - type=int, - default=_DEFAULT_GRIDTOOLS_VERSION, - help=f"major GridTools version for the installation (default: {_DEFAULT_GRIDTOOLS_VERSION})", - ) args = parser.parse_args() if args.command == "install": - install_gt_sources(args.major_version) - _print_status(args.major_version) + install_gt_sources() + _print_status() elif args.command == "remove": - remove_gt_sources(args.major_version) - _print_status(args.major_version) + remove_gt_sources() + _print_status() elif args.command == "status": - _print_status(args.major_version) + _print_status() diff --git a/tests/reference_cpp_regression/build.py b/tests/reference_cpp_regression/build.py index 99d6ce02e2..c6fe1eab1c 100644 --- a/tests/reference_cpp_regression/build.py +++ b/tests/reference_cpp_regression/build.py @@ -33,9 +33,9 @@ def compile_reference(): current_dir = os.path.dirname(__file__) build_opts = pyext_builder.get_gt_pyext_build_opts().copy() - gt2_include_path = gt_config.build_settings["gt2_include_path"] + gt_include_path = gt_config.build_settings["gt_include_path"] build_opts["include_dirs"].extend( - [gt2_include_path, os.path.join(gt2_include_path, "..", "tests")] + [gt_include_path, os.path.join(gt_include_path, "..", "tests")] ) build_opts.setdefault("extra_compile_args", []) diff --git a/tests/test_unittest/test_gtc/test_cuir_compilation.py b/tests/test_unittest/test_gtc/test_cuir_compilation.py index 6a4cd3c47a..1a5ec1c9da 100644 --- a/tests/test_unittest/test_gtc/test_cuir_compilation.py +++ b/tests/test_unittest/test_gtc/test_cuir_compilation.py @@ -39,7 +39,7 @@ def build_gridtools_test(tmp_path: Path, code: str): opts = pyext_builder.get_gt_pyext_build_opts(uses_cuda=True) assert isinstance(opts["include_dirs"], list) - opts["include_dirs"].append(config.GT2_INCLUDE_PATH) + opts["include_dirs"].append(config.GT_INCLUDE_PATH) ext_module = setuptools.Extension( "test", [str(tmp_src.absolute())], diff --git a/tests/test_unittest/test_gtc/test_gtcpp_compilation.py b/tests/test_unittest/test_gtc/test_gtcpp_compilation.py index 15b259ddca..1a8ebfaecc 100644 --- a/tests/test_unittest/test_gtc/test_gtcpp_compilation.py +++ b/tests/test_unittest/test_gtc/test_gtcpp_compilation.py @@ -51,7 +51,7 @@ def build_gridtools_test(tmp_path: Path, code: str): ext_module = setuptools.Extension( "test", [str(tmp_src.absolute())], - include_dirs=[config.GT2_INCLUDE_PATH, config.build_settings["boost_include_path"]], + include_dirs=[config.GT_INCLUDE_PATH, config.build_settings["boost_include_path"]], language="c++", extra_compile_args=extra_compile_args, ) diff --git a/tox.ini b/tox.ini index c51f2e0115..73e120f3b0 100644 --- a/tox.ini +++ b/tox.ini @@ -9,8 +9,7 @@ envlist = deps = -r {toxinidir}/requirements-dev.txt install_command = python -m pip install --no-cache-dir {opts} {packages} commands_pre = - python -m gt4py.gt_src_manager install -m 1 - python -m gt4py.gt_src_manager install -m 2 + python -m gt4py.gt_src_manager install python -m gt4py.gt_cache_manager clean passenv = BOOST_ROOT BOOST_HOME CUDA_HOME CUDA_PATH CXX CC OPENMP_CPPFLAGS OPENMP_LDFLAGS PIP_USER PYTHONUSERBASE whitelist_externals = @@ -24,14 +23,14 @@ extras = format all: dace cuda: cuda - cuda90: cuda90 - cuda91: cuda91 - cuda92: cuda92 - cuda100: cuda100 - cuda101: cuda101 cuda110: cuda110 cuda111: cuda111 cuda112: cuda112 + cuda113: cuda113 + cuda114: cuda114 + cuda115: cuda115 + cuda116: cuda116 + cuda117: cuda117 [testenv:py{38,39}-internal-cpu] commands =