def test_indirection_dofmap(): '''Test that the KernelInterface class indirection_dofmap method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.indirection_dofmap(None)
def test_fs_intergrid(): '''Test that the KernelInterface class fs_intergrid method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.fs_intergrid(None)
def test_cma_operator(): '''Test that the KernelInterface class cma_operator method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.cma_operator(None)
def test_operator_bcs_kernel(): '''Test that the KernelInterface class operator_bcs_kernel method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.operator_bcs_kernel(None)
def test_stencil(): '''Test that the KernelInterface class stencil method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.stencil(None)
def test_cell_map(): '''Test that the KernelInterface class cell_map method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.cell_map()
def test_mesh_ncell2d(): '''Test that the KernelInterface class mesh_ncell2d method adds the expected symbols to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.mesh_ncell2d()
def test_diff_basis(): '''Test that the KernelInterface class basis method adds the expected classes to the symbol table and the _arglist list. We use xyoz quadrature for this test, but other quadrature could equally have been used. ''' _, invoke_info = parse(os.path.join(BASE_PATH, "1.1.0_single_invoke_xyoz_qr.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] # "w2" requires a diff basis function and is the second entry in the # unique function spaces list w2_fs = kernel.arguments.unique_fss[1] fs_name = w2_fs.orig_name kernel_interface = KernelInterface(kernel) kernel_interface.diff_basis(w2_fs) # ndf declared ndf_symbol = kernel_interface._symbol_table.lookup( "ndf_{0}".format(fs_name)) assert isinstance(ndf_symbol, lfric_psyir.NumberOfDofsDataSymbol) assert isinstance(ndf_symbol.interface, ArgumentInterface) assert ( ndf_symbol.interface.access == kernel_interface._read_access.access) # nqp_xy declared nqph_symbol = kernel_interface._symbol_table.lookup("nqp_xy") assert isinstance(nqph_symbol, lfric_psyir.NumberOfQrPointsInXyDataSymbol) assert isinstance(nqph_symbol.interface, ArgumentInterface) assert ( nqph_symbol.interface.access == kernel_interface._read_access.access) # nqp_z declared nqpv_symbol = kernel_interface._symbol_table.lookup("nqp_z") assert isinstance(nqpv_symbol, lfric_psyir.NumberOfQrPointsInZDataSymbol) assert isinstance(nqpv_symbol.interface, ArgumentInterface) assert ( nqpv_symbol.interface.access == kernel_interface._read_access.access) # diff basis declared and added to argument list diff_basis_symbol = kernel_interface._symbol_table.lookup( "diff_basis_w2_qr_xyoz") assert isinstance(diff_basis_symbol, lfric_psyir.DiffBasisFunctionQrXyozDataSymbol) assert isinstance(diff_basis_symbol.interface, ArgumentInterface) assert (diff_basis_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is diff_basis_symbol assert len(diff_basis_symbol.shape) == 4 assert isinstance(diff_basis_symbol.shape[0], Literal) assert diff_basis_symbol.shape[0].value == "1" assert isinstance(diff_basis_symbol.shape[1], Reference) assert diff_basis_symbol.shape[1].symbol is ndf_symbol assert isinstance(diff_basis_symbol.shape[2], Reference) assert diff_basis_symbol.shape[2].symbol is nqph_symbol assert isinstance(diff_basis_symbol.shape[3], Reference) assert diff_basis_symbol.shape[3].symbol is nqpv_symbol
def test_basis_face(): '''Test that the KernelInterface class basis method adds the expected classes to the symbol table and the _arglist list for face quadrature. ''' _, invoke_info = parse(os.path.join(BASE_PATH, "1.1.6_face_qr.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] # "w1" requires a basis function and is the first entry in the # unique function spaces list w1_fs = kernel.arguments.unique_fss[0] fs_name = w1_fs.orig_name kernel_interface = KernelInterface(kernel) kernel_interface.basis(w1_fs) # ndf declared ndf_symbol = kernel_interface._symbol_table.lookup( "ndf_{0}".format(fs_name)) assert isinstance(ndf_symbol, lfric_psyir.NumberOfDofsDataSymbol) assert isinstance(ndf_symbol.interface, ArgumentInterface) assert ( ndf_symbol.interface.access == kernel_interface._read_access.access) # nfaces declared nfaces_symbol = kernel_interface._symbol_table.lookup("nfaces") assert isinstance(nfaces_symbol, lfric_psyir.NumberOfFacesDataSymbol) assert isinstance(nfaces_symbol.interface, ArgumentInterface) assert ( nfaces_symbol.interface.access == kernel_interface._read_access.access) # nqp declared nqp_symbol = kernel_interface._symbol_table.lookup("nqp_faces") assert isinstance(nqp_symbol, lfric_psyir.NumberOfQrPointsInFacesDataSymbol) assert isinstance(nqp_symbol.interface, ArgumentInterface) assert ( nqp_symbol.interface.access == kernel_interface._read_access.access) # basis declared and added to argument list basis_symbol = kernel_interface._symbol_table.lookup("basis_w1_qr_face") assert isinstance(basis_symbol, lfric_psyir.BasisFunctionQrFaceDataSymbol) assert isinstance(basis_symbol.interface, ArgumentInterface) assert ( basis_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is basis_symbol assert len(basis_symbol.shape) == 4 assert isinstance(basis_symbol.shape[0], Literal) assert basis_symbol.shape[0].value == "3" assert isinstance(basis_symbol.shape[1], Reference) assert basis_symbol.shape[1].symbol is ndf_symbol assert isinstance(basis_symbol.shape[2], Reference) assert basis_symbol.shape[2].symbol is nqp_symbol assert isinstance(basis_symbol.shape[3], Reference) assert basis_symbol.shape[3].symbol is nfaces_symbol
def test_mesh_height(): '''Test that the KernelInterface class mesh_height method adds the expected type of Symbol to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.mesh_height() symbol = kernel_interface._symbol_table.lookup("nlayers") assert isinstance(symbol, lfric_psyir.MeshHeightDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is symbol
def test_mesh_properties(): '''Test that the KernelInterface class mesh_properties method can be called successfully. This callback method does not contribute any kernel arguments so does nothing. As a basic test, we check that the number of symbols in the symbol table and the number of arguments in the argument list do not change. ''' kernel_interface = KernelInterface(None) kernel_interface.mesh_properties() assert len(kernel_interface._symbol_table.symbols) == 0 assert len(kernel_interface._arglist) == 0
def test_cell_position(): '''Test that the KernelInterface class cell_position method adds the expected type of Symbol to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) kernel_interface.cell_position() symbol = kernel_interface._symbol_table.lookup("cell") assert isinstance(symbol, lfric_psyir.CellPositionDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is symbol
def test_scalar(monkeypatch): '''Test that the KernelInterface class scalar method adds the expected class to the symbol table and the _arglist list. Also check that it raises the expected exception if the scalar type is not recognised. ''' kernel_interface = KernelInterface(None) _, invoke_info = parse(os.path.join( BASE_PATH, "1.6.1_single_invoke_1_int_scalar.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] scalar_arg = kernel.args[1] kernel_interface = KernelInterface(None) kernel_interface.scalar(scalar_arg) symbol = kernel_interface._symbol_table.lookup(scalar_arg.name) assert isinstance(symbol, lfric_psyir.LfricIntegerScalarDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == INTENT_MAPPING[scalar_arg.intent]) assert kernel_interface._arglist[-1] is symbol # Force an error monkeypatch.setattr(scalar_arg, "_intrinsic_type", "invalid") with pytest.raises(NotImplementedError) as info: kernel_interface.scalar(scalar_arg) assert ("scalar of type 'invalid' not implemented in KernelInterface " "class." in str(info.value))
def test_fs_common(): '''Test that the KernelInterface class fs_common method adds the expected type of Symbol to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) function_space = FunctionSpace("w3", None) kernel_interface.fs_common(function_space) fs_name = function_space.orig_name symbol = kernel_interface._symbol_table.lookup("ndf_{0}".format(fs_name)) assert isinstance(symbol, lfric_psyir.NumberOfDofsDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is symbol
def test_quad_rule_xyoz(): '''Test that the KernelInterface class quad_rule method adds the expected classes to the symbol table and the _arglist list for xyoz quadrature ''' _, invoke_info = parse(os.path.join(BASE_PATH, "1.1.0_single_invoke_xyoz_qr.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] kernel_interface = KernelInterface(kernel) kernel_interface.quad_rule() # nqp_xy declared and added to argument list nqph_symbol = kernel_interface._symbol_table.lookup("nqp_xy") assert isinstance(nqph_symbol, lfric_psyir.NumberOfQrPointsInXyDataSymbol) assert isinstance(nqph_symbol.interface, ArgumentInterface) assert ( nqph_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-4] is nqph_symbol # nqp_z declared and added to argument list nqpv_symbol = kernel_interface._symbol_table.lookup("nqp_z") assert isinstance(nqpv_symbol, lfric_psyir.NumberOfQrPointsInZDataSymbol) assert isinstance(nqpv_symbol.interface, ArgumentInterface) assert ( nqpv_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-3] is nqpv_symbol # weights_xy declared and added to argument list weightsh_symbol = kernel_interface._symbol_table.lookup("weights_xy") assert isinstance(weightsh_symbol, lfric_psyir.QrWeightsInXyDataSymbol) assert isinstance(weightsh_symbol.interface, ArgumentInterface) assert (weightsh_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-2] is weightsh_symbol assert len(weightsh_symbol.shape) == 1 assert isinstance(weightsh_symbol.shape[0], Reference) assert weightsh_symbol.shape[0].symbol is nqph_symbol # weights_z declared and added to argument list weightsz_symbol = kernel_interface._symbol_table.lookup("weights_z") assert isinstance(weightsz_symbol, lfric_psyir.QrWeightsInZDataSymbol) assert isinstance(weightsz_symbol.interface, ArgumentInterface) assert (weightsz_symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-1] is weightsz_symbol assert len(weightsz_symbol.shape) == 1 assert isinstance(weightsz_symbol.shape[0], Reference) assert weightsz_symbol.shape[0].symbol is nqpv_symbol
def test_quad_rule_error(monkeypatch): '''Test that the KernelInterface class quad_rule method raises the expected exception when an unsupported quadrature shape is provided. ''' _, invoke_info = parse(os.path.join(BASE_PATH, "6.1_eval_invoke.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] kernel_interface = KernelInterface(kernel) # Force an unsupported shape monkeypatch.setattr(kernel, "_qr_rules", ["invalid_shape"]) with pytest.raises(InternalError) as info: kernel_interface.quad_rule() assert ("Unsupported quadrature shape 'invalid_shape' found in " "kernel_interface." in str(info.value))
def test_init(): '''Test that we can create an instance of the KernelInterface class and that any defaults are set as expected ''' kernel_interface = KernelInterface(None) assert isinstance(kernel_interface._read_access, ArgumentInterface) assert ( kernel_interface._read_access.access == ArgumentInterface.Access.READ) assert isinstance(kernel_interface._symbol_table, SymbolTable) assert kernel_interface._arglist == []
def test_create_basis_errors(monkeypatch): '''Check that the appropriate exceptions are raised when a) an evaluator shape is provided, as they are not yet supported, and b) an unrecognised quadrature or evaluator shape is found. ''' _, invoke_info = parse(os.path.join(BASE_PATH, "6.1_eval_invoke.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] kernel_interface = KernelInterface(kernel) # "w1" requires a basis function and is the first entry in the # unique function spaces list w1_fs = kernel.arguments.unique_fss[0] # Evaluator shapes are not yet supported. with pytest.raises(NotImplementedError) as info: kernel_interface.basis(w1_fs) assert ("Evaluator shapes not implemented in kernel_interface class." in str(info.value)) # Force an unsupported shape monkeypatch.setattr(kernel, "_eval_shapes", ["invalid_shape"]) with pytest.raises(InternalError) as info: kernel_interface.basis(w1_fs) assert ( "Unrecognised quadrature or evaluator shape 'invalid_shape'. " "Expected one of: ['gh_quadrature_xyoz', 'gh_quadrature_face', " "'gh_quadrature_edge', 'gh_evaluator']." in str(info.value))
def test_fs_compulsory_field(): '''Test that the KernelInterface class fs_compulsory_field method adds the expected classes to the symbol table and the _arglist list. ''' kernel_interface = KernelInterface(None) function_space = FunctionSpace("w3", None) kernel_interface.fs_compulsory_field(function_space) fs_name = function_space.orig_name # undf declared and added to argument list symbol = kernel_interface._symbol_table.lookup("undf_{0}".format(fs_name)) assert isinstance(symbol, lfric_psyir.NumberOfUniqueDofsDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == kernel_interface._read_access.access) assert kernel_interface._arglist[-2] is symbol # ndf declared ndf_symbol = kernel_interface._symbol_table.lookup( "ndf_{0}".format(fs_name)) assert isinstance(ndf_symbol, lfric_psyir.NumberOfDofsDataSymbol) assert isinstance(ndf_symbol.interface, ArgumentInterface) assert ( ndf_symbol.interface.access == kernel_interface._read_access.access) # dofmap declared, added to argument list, correct function # space specified and dimensioned correctly tag = "dofmap_{0}".format(fs_name) symbol = kernel_interface._symbol_table.lookup(tag) assert isinstance(symbol, lfric_psyir.DofMapDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert symbol.interface.access == kernel_interface._read_access.access assert kernel_interface._arglist[-1] is symbol assert symbol.fs == fs_name assert len(symbol.shape) == 1 assert isinstance(symbol.shape[0], Reference) assert symbol.shape[0].symbol is ndf_symbol
def test_field_vector(monkeypatch): '''Test the KernelInterface class field_vector method. We want to check that the correct symbol is referenced for the dimension of the vector field symbols so the simplest solution is to use one of the Fortran test examples. Also check that the expected exception is raised if the type of the vector field is not supported. ''' kernel_interface = KernelInterface(None) _, invoke_info = parse(os.path.join(BASE_PATH, "8_vector_field.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] vector_arg = kernel.args[1] kernel_interface.field_vector(vector_arg) # undf symbol declared undf_tag = "undf_{0}".format(vector_arg.function_space.orig_name) undf_symbol = kernel_interface._symbol_table.lookup(undf_tag) assert isinstance(undf_symbol, lfric_psyir.NumberOfUniqueDofsDataSymbol) assert isinstance(undf_symbol.interface, ArgumentInterface) assert ( undf_symbol.interface.access == kernel_interface._read_access.access) # vector fields declared, added to argument list, correct function # space specified and dimensioned correctly for idx in range(vector_arg.vector_size): tag = "{0}_v{1}".format(vector_arg.name, idx) symbol = kernel_interface._symbol_table.lookup(tag) assert isinstance(symbol, lfric_psyir.RealVectorFieldDataDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == ArgumentInterface( INTENT_MAPPING[vector_arg.intent]).access) assert kernel_interface._arglist[idx - 3] is symbol assert symbol.fs == vector_arg.function_space.orig_name assert len(symbol.shape) == 1 assert isinstance(symbol.shape[0], Reference) assert symbol.shape[0].symbol is undf_symbol # Force an exception by setting the intrinsic type to an unsupported value monkeypatch.setattr(vector_arg, "_intrinsic_type", "unsupported") with pytest.raises(NotImplementedError) as info: kernel_interface.field_vector(vector_arg) assert ("kernel interface does not support a vector field of type " "'unsupported'." in str(info.value))
def test_operator(): '''Test the KernelInterface class operator method. We want to check that the correct symbol is referenced for the dimension of the operator symbol so the simplest solution is to use one of the Fortran test examples. ''' kernel_interface = KernelInterface(None) _, invoke_info = parse(os.path.join(BASE_PATH, "10_operator.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel = schedule[0].loop_body[0] operator_arg = kernel.args[0] kernel_interface.operator(operator_arg) # fs_from symbol declared fs_from_name = operator_arg.function_space_from.orig_name fs_from_tag = "ndf_{0}".format(fs_from_name) fs_from_symbol = kernel_interface._symbol_table.lookup(fs_from_tag) assert isinstance(fs_from_symbol, lfric_psyir.NumberOfDofsDataSymbol) assert fs_from_symbol.fs == fs_from_name assert isinstance(fs_from_symbol.interface, ArgumentInterface) assert (fs_from_symbol.interface.access == kernel_interface._read_access.access) # fs_to symbol declared fs_to_name = operator_arg.function_space_from.orig_name fs_to_tag = "ndf_{0}".format(fs_to_name) fs_to_symbol = kernel_interface._symbol_table.lookup(fs_to_tag) assert isinstance(fs_to_symbol, lfric_psyir.NumberOfDofsDataSymbol) assert fs_to_symbol.fs == fs_to_name assert isinstance(fs_to_symbol.interface, ArgumentInterface) assert ( fs_to_symbol.interface.access == kernel_interface._read_access.access) # ncells symbol declared ncells_symbol = kernel_interface._symbol_table.lookup("ncell_3d") assert isinstance(ncells_symbol, lfric_psyir.NumberOfCellsDataSymbol) assert isinstance(ncells_symbol.interface, ArgumentInterface) assert ( ncells_symbol.interface.access == kernel_interface._read_access.access) # operator declared, added to argument list, correct function # spaces specified and dimensioned correctly tag = operator_arg.name symbol = kernel_interface._symbol_table.lookup(tag) assert isinstance(symbol, lfric_psyir.OperatorDataSymbol) assert isinstance(symbol.interface, ArgumentInterface) assert (symbol.interface.access == ArgumentInterface( INTENT_MAPPING[operator_arg.intent]).access) assert kernel_interface._arglist[-1] is symbol assert symbol.fs_from == operator_arg.function_space_from.orig_name assert symbol.fs_to == operator_arg.function_space_to.orig_name assert len(symbol.shape) == 3 assert isinstance(symbol.shape[0], Reference) assert symbol.shape[0].symbol is fs_from_symbol assert isinstance(symbol.shape[1], Reference) assert symbol.shape[1].symbol is fs_to_symbol assert isinstance(symbol.shape[2], Reference) assert symbol.shape[2].symbol is ncells_symbol
def test_generate(var_accesses): '''Test that the KernelInterface class generate method creates the expected symbols and adds them to the symbol table and its argument list (in the required order). ''' # Test 14.10 is chosen as it only has two fields in a kernel # which reduces the number of arguments to check. _, invoke_info = parse(os.path.join( BASE_PATH, "14.10_halo_continuous_cell_w_to_r.f90"), api="dynamo0.3") psy = PSyFactory("dynamo0.3", distributed_memory=False).create(invoke_info) schedule = psy.invokes.invoke_list[0].schedule kernel0 = schedule[0].loop_body[0] kernel_interface = KernelInterface(kernel0) kernel_interface.generate(var_accesses=var_accesses) # Check symbols nlayers_symbol = kernel_interface._symbol_table.lookup("nlayers") assert isinstance(nlayers_symbol, lfric_psyir.MeshHeightDataSymbol) undf_w0_symbol = kernel_interface._symbol_table.lookup("undf_w0") assert isinstance(undf_w0_symbol, lfric_psyir.NumberOfUniqueDofsDataSymbol) f1_field_symbol = kernel_interface._symbol_table.lookup("f1") assert isinstance(f1_field_symbol, lfric_psyir.RealFieldDataDataSymbol) f2_field_symbol = kernel_interface._symbol_table.lookup("f2") assert isinstance(f2_field_symbol, lfric_psyir.RealFieldDataDataSymbol) ndf_w0_symbol = kernel_interface._symbol_table.lookup("ndf_w0") assert isinstance(ndf_w0_symbol, lfric_psyir.NumberOfDofsDataSymbol) dofmap_w0_symbol = kernel_interface._symbol_table.lookup("dofmap_w0") assert isinstance(dofmap_w0_symbol, lfric_psyir.DofMapDataSymbol) # Check function spaces assert undf_w0_symbol.fs == "w0" assert f1_field_symbol.fs == "w0" assert f2_field_symbol.fs == "w0" assert ndf_w0_symbol.fs == "w0" assert dofmap_w0_symbol.fs == "w0" # Check array dimensions assert len(f1_field_symbol.shape) == 1 assert isinstance(f1_field_symbol.shape[0], Reference) assert f1_field_symbol.shape[0].symbol is undf_w0_symbol assert len(f2_field_symbol.shape) == 1 assert isinstance(f2_field_symbol.shape[0], Reference) assert f2_field_symbol.shape[0].symbol is undf_w0_symbol assert len(dofmap_w0_symbol.shape) == 1 assert isinstance(dofmap_w0_symbol.shape[0], Reference) assert dofmap_w0_symbol.shape[0].symbol is ndf_w0_symbol # Check argument list arg_list = kernel_interface._symbol_table.argument_datasymbols assert len(arg_list) == 6 assert arg_list[0] is nlayers_symbol assert arg_list[1] is undf_w0_symbol assert arg_list[2] is f1_field_symbol assert arg_list[3] is f2_field_symbol assert arg_list[4] is ndf_w0_symbol assert arg_list[5] is dofmap_w0_symbol if var_accesses: # Check that the names of variables and their intent has been # captured by the data dependence analysis accesses = var_accesses.all_accesses assert len(accesses) == 6 assert accesses[0].access_type == "nlayers" assert accesses[0].location == AccessType.READ assert accesses[1].access_type == "undf_w0" assert accesses[1].location == AccessType.READ assert accesses[2].access_type == "f1" assert accesses[2].location == AccessType.READWRITE assert accesses[3].access_type == "f2" assert accesses[3].location == AccessType.READ assert accesses[4].access_type == "ndf_w0" assert accesses[4].location == AccessType.READ assert accesses[5].access_type == "dofmap_w0" assert accesses[5].location == AccessType.READ