STEllAR-GROUP / phylanx

An Asynchronous Distributed C++ Array Processing Toolkit
Boost Software License 1.0
75 stars 76 forks source link

Unexpected result in the test of dist_constant_4_loc #1137

Closed NanmiaoWu closed 4 years ago

NanmiaoWu commented 4 years ago

The results of each test have some problems. For example, in test_constant_4loc_1d_0(),

There are 2 problems:

  1. the first locality should have an array like [42, 42, 42, 42], and the later 3 localities have the arrat [42, 42, 42]. But the printed output is : the first locality has an array [42, 42, 42]; the second locality has an array [42, 42, 42, 42]; the later two localities have arrays[42, 42, 42]

  2. the first locality should from columns [0, 4), and the list information is like list("tile", list("columns", 0, 4)))). IMAGE 2020-03-16 20:45:07 But the output is :list("meta_0", list("tile", list("columns", 140135490575152, 140135490575156)))

NanmiaoWu commented 4 years ago

After Bita's suggestion about updating Phylanx, some of the errors solved like, list("columns", 140135490575152, 140135490575156))). But some of the errors, like tiling issues and wrong rows and columns, still exist.

For example, in 4loc_1d_0:

The similar tiling issues also happen on 4loc_2d_0, 4loc_2d_1.

For example, in 4loc_2d_0:

The similar wrong row and column information issues also happen on 4loc_2d_1, 4loc_2d_2.

IMAGE 2020-03-16 22:10:14

hkaiser commented 4 years ago

This looks like something is going out of scope too early.

taless474 commented 4 years ago

@NanmiaoWu, thank you for investigating the issues in tests. Unfortunately, I haven't understood the problem, yet. If we look at 4loc_1d_0, in my opinion, the results make sense. In the first line of your picture, the result for the third locality is printed:

[42, 42, 42], annotation("localities", list("meta_0", list("tile", list("columns", 0, 4))), list("meta_1", list("tile", list("columns", 4, 7))), list("meta_2", list("tile", list("columns", 7, 10))), list("meta_3", list("tile", list("columns", 10, 13))), list("locality", 3, 4), list("name", "full_array_1/0"))

I think we cannot control which locality would give us the results first, but considering the locality ids, the result is as expected. Please let me know if I am missing something.

NanmiaoWu commented 4 years ago

OK. I thought the localities are given from idx_0 and then idx_1... Then, the "tiling issue" is not a problem, since they are given randomly.

taless474 commented 4 years ago

@NanmiaoWu, Thanks for your explanations. I realized that the second problem still persists. Let's go over test_constant_4loc_2d_0: In the generated annotations for 2d arrays, the "rows" and "columns" tags should be swapped. The resulted arrays are correct, but the generated annotations are not :D I think the tests should not pass. I made this example on one locality and it still passes:

phylanx::execution_tree::primitive_argument_type compile_and_run(
    std::string const& name, std::string const& codestr)
{
    phylanx::execution_tree::compiler::function_list snippets;
    phylanx::execution_tree::compiler::environment env =
        phylanx::execution_tree::compiler::default_environment();

    auto const& code =
        phylanx::execution_tree::compile(name, codestr, snippets, env);
    return code.run().arg_;
}
void test_annotation_equality_3()
{
    std::string annotation_0 = R"(
            annotate_d([[91, 91]], "test2d2d_3_1/1",
                list("tile", list("columns", 0, 2), list("rows", 0, 1)))
        )";
    std::string annotation_1 = R"(
            annotate_d([[91, 91]], "test2d2d_3_1/1",
                list("args",
                    list("locality", 0, 1),
                    list("tile", list("rows", 0, 2), list("columns", 0, 2))))
        )";

    HPX_TEST_EQ(compile_and_run("annotation_0", annotation_0),
        compile_and_run("annotation_1", annotation_1));
}
int main(int argc, char* argv[])
{
    test_annotation_equality_3();

    return hpx::util::report_errors();
}

@hkaiser, can you guide us about this and #1129?

NanmiaoWu commented 4 years ago

Problem solved. Thanks!