Example #1
0
def build_gridtools_test(tmp_path: Path, code: str):
    tmp_src = tmp_path / "test.cu"
    tmp_src.write_text(code)

    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)
    ext_module = setuptools.Extension(
        "test",
        [str(tmp_src.absolute())],
        language="c++",
        **opts,
    )
    args = [
        "build_ext",
        "--build-temp=" + str(tmp_src.parent),
        "--build-lib=" + str(tmp_src.parent),
        "--force",
    ]
    setuptools.setup(
        name="test",
        ext_modules=[
            ext_module,
        ],
        script_args=args,
        cmdclass={"build_ext": pyext_builder.CUDABuildExtension},
    )
Example #2
0
def compile_reference():
    current_dir = os.path.dirname(__file__)
    build_opts = pyext_builder.get_gt_pyext_build_opts()
    build_opts["include_dirs"].append(EXTERNAL_SRC_PATH)

    reference_names = pyext_builder.build_pybind_ext(
        "reference_cpp_regression",
        [os.path.join(current_dir, "reference.cpp")],
        os.path.join(current_dir, "build"),
        current_dir,
        verbose=False,
        clean=False,
        **build_opts,
    )
    return gt_utils.make_module_from_file(*reference_names)
Example #3
0
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"]
    build_opts["include_dirs"].extend(
        [gt2_include_path,
         os.path.join(gt2_include_path, "..", "tests")])

    build_opts.setdefault("extra_compile_args", [])
    build_opts["extra_compile_args"].append("-Wno-sign-compare")
    reference_names = pyext_builder.build_pybind_ext(
        "reference_cpp_regression",
        [os.path.join(current_dir, "reference.cpp")],
        os.path.join(current_dir, "build"),
        current_dir,
        verbose=False,
        clean=False,
        **build_opts,
    )
    return gt_utils.make_module_from_file(*reference_names)