-
Notifications
You must be signed in to change notification settings - Fork 112
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
[UR][Tests] Add CTS options to set platforms and devices. #1085
Conversation
// Get the argument (test_devices_count) to limit test devices count. | ||
u_long count_set = 0; | ||
if (argc >= 3) { | ||
count_set = std::strtoul(argv[2], nullptr, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this always the second argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on cts_exe.py scripts. In this case, it will always be the second argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but the gtest binary may be executed manually, the script can change etc. You shouldn't be hard-coding such assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it. What about that?
test/conformance/README.md
Outdated
|
||
To limit how many devices you want to run the CTS on, | ||
use CMake option UR_TEST_DEVICES_COUNT. If you want to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we make it a runtime option instead of a CMAKE one? imagine the case where users have the binaries for the CTS, and have different types of systems (single CPU, 4xGPU, CPU + 2xGPU, etc). They would have to build the binaries for each configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could change it in the next step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @szadam . could you share why it couldn't be done as part of this PR? Main reason I'm asking is because I have already run into this problem, where I was running the tests in a multi-device system, and it took me a while to figure out the issue was that the tests were built only for 1 device, so I would expect more people to run into the same problem, so addressing sooner would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you run the tests directly through their binary, you can use the --test_devices_count 1
cli option that @szadam is adding. If you are using ctest, this patch will automatically reduce the number of devices it will run with to 1. You don't need to set the cmake option.
There's another patch that @szadam is working on, #992, that will solve the broader problem of devices/platforms having the same names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what @jandres742 is proposing is implemented for OpenCL patch (here: https://github.com/oneapi-src/unified-runtime/pull/993/files#diff-d1f50b1ed696f085259b2a9c7d274ae3414700a1cea60f9945677cdae39e25cfR186) and it looks neat as well. The CMake option, though, has, I think, the added value (as Piotr mentioned) that it sets the default value of 1 and still can be overridden with the CLI param.
BTW, Adam has a new version (still on a private branch; to be polished): szadam@ef74282#diff-d1f50b1ed696f085259b2a9c7d274ae3414700a1cea60f9945677cdae39e25cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @pbalcer and @lukaszstolarczuk for the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response. I am preparing a new solution/version as Lukas said. I will push it today.
c85bf47
to
1db5146
Compare
@@ -199,6 +201,22 @@ DevicesEnvironment::DevicesEnvironment(int argc, char **argv) | |||
error = "Could not find any devices associated with the platform"; | |||
return; | |||
} | |||
// Get the argument (test_devices_count) to limit test devices count. | |||
u_long count_set = 0; | |||
for (int i = 1; i < argc; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 1; i < argc; ++i) { | |
for (int i = 1; i < argc - 1; ++i) { |
and drop the && i + 1 < argc
in the if below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. It will work too.
1db5146
to
ad21ba8
Compare
+1 |
ad21ba8
to
eaed4fb
Compare
7874c1c
to
6a0f1d9
Compare
6a0f1d9
to
36d6fde
Compare
test/conformance/CMakeLists.txt
Outdated
@@ -4,6 +4,8 @@ | |||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |||
|
|||
set(UR_CONFORMANCE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | |||
option(UR_TEST_DEVICES_COUNT "Count of devices on which CTS will be run" 1) | |||
option(UR_TEST_PLATFORMS_COUNT "Count of platform on which CTS will be run" 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platforms
(plural)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/conformance/README.md
Outdated
all available devices/platforms, set 0. The default value is 1. | ||
If you run binaries for the tests, you can use the parameter | ||
`--platforms_count=COUNT/--devices_count=COUNT`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps split this code
into two, like:
...you can use the parameter --platforms...
or --devices...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/conformance/README.md
Outdated
`--platforms_count=COUNT/--devices_count=COUNT`. | ||
To set test device/platform name you want to run the CTS on, use | ||
parameter `--platform=NAME/--device=NAME`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here - split the code
block into two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/conformance/README.md
Outdated
`--platforms_count=COUNT/--devices_count=COUNT`. | ||
To set test device/platform name you want to run the CTS on, use | ||
parameter `--platform=NAME/--device=NAME`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed, what if two platforms have the same name...? (e.g. "CUDA BACKEND" as the name of the platform 😉 ). Perhaps it's not something we want to solve in this PR, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, the tests are not adapted to be run on multiple platforms. They would require major modifications, which are not part of this PR. In the case where we have two platforms or devices with the same name, we should simply set their counter to 1, just set their counter to 1 for the tests to pass without any problem.
test/conformance/cts_exe.py
Outdated
@@ -20,9 +20,13 @@ | |||
|
|||
parser = ArgumentParser() | |||
parser.add_argument("--test_command", help="Ctest test case") | |||
parser.add_argument("--test_devices_count", type=str, help="Number of devices on which tests will be run") | |||
parser.add_argument("--test_platforms_count", type=str, help="Number of devices on which tests will be run") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy-pasted description, pls adjust
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
36d6fde
to
b6d31fd
Compare
I have updated the target branch of this PR from the |
and test platforms count in CTS.
name and test platforms count or test platform name
b6d31fd
to
371bd3c
Compare
Add CTS options to set test platform name or test platforms count and test device name or test devices count.
Create CMake options for running CTS with limited devices count and platforms count.