Skip to content
Snippets Groups Projects
Commit 7de3cd0b authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Merge branch 'fix_headerinclude' into 'master'

Headerfile.parse removes strips " from strings

See merge request !7
parents 94fbd0a9 8a15ea20
Branches
No related tags found
1 merge request!7Headerfile.parse removes strips " from strings
Pipeline #71510 failed
from pystencils import Target, CreateKernelConfig, create_kernel, no_jit from pystencils import Target, CreateKernelConfig, no_jit
from lbmpy import create_lb_update_rule, LBMOptimisation from lbmpy import create_lb_update_rule, LBMOptimisation
from pystencilssfg import SourceFileGenerator, SfgConfiguration from pystencilssfg import SourceFileGenerator, SfgConfig
from pystencilssfg.lang.cpp import mdspan_ref
sfg_config = SfgConfiguration( sfg_config = SfgConfig()
output_directory="out/test_cuda", sfg_config.extensions.impl = "cu"
outer_namespace="gen_code", sfg_config.output_directory = "out/test_cuda"
impl_extension="cu" sfg_config.outer_namespace = "gen_code"
)
with SourceFileGenerator(sfg_config) as sfg: with SourceFileGenerator(sfg_config) as sfg:
gen_config = CreateKernelConfig(target=Target.CUDA, jit=no_jit) gen_config = CreateKernelConfig(target=Target.CUDA, jit=no_jit)
...@@ -15,6 +13,4 @@ with SourceFileGenerator(sfg_config) as sfg: ...@@ -15,6 +13,4 @@ with SourceFileGenerator(sfg_config) as sfg:
update = create_lb_update_rule() update = create_lb_update_rule()
kernel = sfg.kernels.create(update, "lbm_update", gen_config) kernel = sfg.kernels.create(update, "lbm_update", gen_config)
sfg.function("lb_update")( sfg.function("lb_update")(sfg.call(kernel))
sfg.call(kernel)
)
...@@ -24,6 +24,9 @@ class HeaderFile: ...@@ -24,6 +24,9 @@ class HeaderFile:
return header return header
system_header = False system_header = False
if header.startswith('"') and header.endswith('"'):
header = header[1:-1]
if header.startswith("<") and header.endswith(">"): if header.startswith("<") and header.endswith(">"):
header = header[1:-1] header = header[1:-1]
system_header = True system_header = True
......
from pystencilssfg.lang import HeaderFile
import pytest
def test_parse_system():
headerfile = HeaderFile.parse("<test>")
assert str(headerfile) == "<test>" and headerfile.system_header
@pytest.mark.parametrize("header_string", ["test.hpp", '"test.hpp"'])
def test_parse_private(header_string):
headerfile = HeaderFile.parse(header_string)
assert str(headerfile) == "test.hpp" and not headerfile.system_header
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment