pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/simdutf/simdutf/pull/694

f="https://github.githubassets.com/assets/actions-109fb3a41bacb1c2.css" /> tests: enable multi-threading by WojciechMula · Pull Request #694 · simdutf/simdutf · GitHub
Skip to content

tests: enable multi-threading#694

Open
WojciechMula wants to merge 1 commit intosimdutf:masterfrom
WojciechMula:parallel-tests
Open

tests: enable multi-threading#694
WojciechMula wants to merge 1 commit intosimdutf:masterfrom
WojciechMula:parallel-tests

Conversation

@WojciechMula
Copy link
Collaborator

@WojciechMula WojciechMula commented Feb 28, 2025

single test program may run multiple tests. This change modifies test programs to handle GTests command line options required by CMake/CTest to discover tests[1]. Thanks to that we may use CTest facilites, especially parallel running.

[1] https://cmake.org/cmake/help/git-master/module/GoogleTest.html#command:gtest_discover_tests.

On my machine ctest -j on master takes 31 second, while on this branch only 22 seconds.

@lemire
Copy link
Member

lemire commented Mar 1, 2025

If threading is added, I think we need something like this in CMake:

option(SIMDUTF_ENABLE_THREADS "thread support" ON)
if(SIMDUTF_ENABLE_THREADS)
  find_package(Threads REQUIRED)
  target_add_library(something_that_requires_threads PRIVATE Threads::Threads)
  target_compile_definitions(something_that_requires_threads PRIVATE SIMDUTF_THREADS_ENABLED=1)
endif()

Right?

If we now require multithreading support for building simdutf, this requires changes to...

https://github.com/simdutf/simdutf/blob/master/cmake/simdutf-config.cmake.in

E.g., we should add...

include(CMakeFindDependencyMacro)
if("@ SIMDUTF_ENABLE_THREADS@")
  find_dependency(Threads)
endif()

Otherwise, this will break some builds.

@lemire
Copy link
Member

lemire commented Mar 1, 2025

I guess it's quite promising, especially for our CI, which runs multitude of tests on so many platforms and compilers.

We can parallelize the builds with an additional flag... cmake --build build ▶️ cmake --build build -j (we could do even more so by configuring with Ninja).

@WojciechMula
Copy link
Collaborator Author

Alternatively, we may think about running single test from executable, similarly to https://cmake.org/cmake/help/git-master/module/GoogleTest.html#command:gtest_discover_tests.

I tested this approach. We provide the same set of command line arguments as GTest and can use gtest_discover_tests. I think it's way better solution, as we can freely use all ctest facilities and do not clutter our code with threads and related stuff.

A single test program may run multiple tests. This change
modifies test programs to handle GTests command line options
required by CMake/CTest to discover tests[1]. Thanks to
that we may use CTest facilites, especially parallel running.

[1] https://cmake.org/cmake/help/git-master/module/GoogleTest.html#command:gtest_discover_tests.
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

Successfully merging this pull request may close these issues.

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy