Exemple #1
0
def test_lfric_stub_args():
    '''Check that correct stub code is produced when there are multiple
    stencils.

    '''
    ast = get_ast("dynamo0.3", "testkern_stencil_multi_mod.f90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    var_info = str(var_accesses)
    assert "field_1_w1: READ+WRITE" in var_info
    assert "field_2_stencil_dofmap: READ" in var_info
    assert "field_2_stencil_size: READ" in var_info
    assert "field_2_w2: READ" in var_info
    assert "field_3_direction: READ" in var_info
    assert "field_3_stencil_dofmap: READ" in var_info
    assert "field_3_stencil_size: READ" in var_info
    assert "field_3_w2: READ" in var_info
    assert "field_4_stencil_dofmap: READ" in var_info
    assert "field_4_stencil_size: READ" in var_info
    assert "field_4_w3: READ" in var_info
    assert "map_w1: READ" in var_info
    assert "map_w2: READ" in var_info
    assert "map_w3: READ" in var_info
    assert "ndf_w1: READ" in var_info
    assert "ndf_w2: READ" in var_info
    assert "ndf_w3: READ" in var_info
    assert "nlayers: READ" in var_info
    assert "undf_w1: READ" in var_info
    assert "undf_w2: READ" in var_info
    assert "undf_w3: READ" in var_info
Exemple #2
0
def test_lfric_stub_boundary_dofs():
    '''Check variable usage detection for boundary dofs.

    '''
    ast = get_ast("dynamo0.3", "enforce_bc_kernel_mod.f90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    assert "boundary_dofs_field_1: READ" in str(var_accesses)
Exemple #3
0
def test_lfric_stub_args3():
    '''Check variable usage detection for cell position, operator

    '''
    ast = get_ast("dynamo0.3", "testkern_any_discontinuous_space_op_1_mod.f90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    var_info = str(var_accesses)
    assert "cell: READ" in var_info
    assert "op_3: READ" in var_info
    assert "op_3_ncell_3d: READ" in var_info
    assert "op_4: READ" in var_info
    assert "op_4_ncell_3d: READ" in var_info
Exemple #4
0
def test_lfric_stub_basis():
    '''Check variable usage detection of basis, diff-basis.

    '''
    ast = get_ast("dynamo0.3", "testkern_qr_eval_mod.F90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    var_info = str(var_accesses)
    assert "basis_w1_on_w1: READ" in var_info
    assert "diff_basis_w2_qr_face: READ" in var_info
    assert "diff_basis_w2_on_w1: READ" in var_info
    assert "basis_w3_on_w1: READ" in var_info
    assert "diff_basis_w3_qr_face: READ" in var_info
    assert "diff_basis_w3_on_w1: READ" in var_info
Exemple #5
0
def test_lfric_stub_args2():
    '''Check variable usage detection for scalars, basis_name, quad rule
    and mesh properties.

    '''
    ast = get_ast("dynamo0.3", "testkern_mesh_prop_face_qr_mod.F90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    var_info = str(var_accesses)
    assert "rscalar_1: READ" in var_info
    assert "basis_w1_qr_face: READ" in var_info
    assert "nfaces_qr_face: READ" in var_info
    assert "np_xyz_qr_face: READ" in var_info
    assert "weights_xyz_qr_face: READ" in var_info
Exemple #6
0
def test_lfric_stub_field_vector():
    '''Check variable usage detection field vectors.

    '''
    ast = get_ast("dynamo0.3", "testkern_stencil_vector_mod.f90")
    metadata = DynKernMetadata(ast)
    kernel = DynKern()
    kernel.load_meta(metadata)
    var_accesses = VariablesAccessInfo()
    create_arg_list = KernStubArgList(kernel)
    create_arg_list.generate(var_accesses=var_accesses)
    var_info = str(var_accesses)
    assert "field_1_w0_v1: READ" in var_info
    assert "field_1_w0_v2: READ" in var_info
    assert "field_1_w0_v3: READ" in var_info
    assert "field_2_w3_v1: READ" in var_info
    assert "field_2_w3_v2: READ" in var_info
    assert "field_2_w3_v3: READ" in var_info
    assert "field_2_w3_v4: READ" in var_info