Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spit add_example_executable and use add_example_test #248

Open
qianfengz opened this issue May 22, 2022 · 4 comments
Open

Spit add_example_executable and use add_example_test #248

qianfengz opened this issue May 22, 2022 · 4 comments
Assignees

Comments

@qianfengz
Copy link
Contributor

Have add_example_test() separated from add_example_executable() enables more testing command-lines being added for each single example. And having the add_example_test() enables the developer to use one example .cpp and executable to support multiple testing cases from the example, which saves compiling time and makes development easier.

The CMakeLists.txt will be like the following:

add_example_executable(example_exe  example_source.cpp)
add_example_test(example_test_case_1 example_exe arg1, arg2, ...)
add_example_test(example_test_case_2 example_exe arg2, arg2, ...)
@rosenrodt
Copy link
Contributor

rosenrodt commented May 26, 2022

I think CMake does the equivalent thing under the hood. It resolves target dependency and reuses build cache where possible, so it doesn't rebuild the same binary more than once. Can you find a counter-example?

@qianfengz
Copy link
Contributor Author

How I add a different testing case using the same executable under the current framework ?

@rosenrodt
Copy link
Contributor

I think I get what you mean now. Doing so does produce 2 executables and doubles compilation time. I was using ccache so I got the wrong impression that CMake will avoid compiling twice.

add_example_executable(example_gemm_xdl_fp16_test1 gemm_xdl_fp16.cpp)
add_example_executable(example_gemm_xdl_fp16_test2 gemm_xdl_fp16.cpp 0 1 10 7680 8192 8192 8192 8192 8192)

So yeah I agree this is lacking. But I lean more toward that add_example_executable by default will be run by CTest. And we add extra helper function to add extra test params for the example code.

@ppanchad-amd
Copy link

@qianfengz Is this ticket still relevant? If not, please close the ticket. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants