-
Notifications
You must be signed in to change notification settings - Fork 202
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
do not hard-code the number of jobs to 1 when running ctest #578
do not hard-code the number of jobs to 1 when running ctest #578
Conversation
@mattyjams It's something we are internally looking into. We had random failures on some platforms / hardware configuration. Not ready to accept this PR at this point. We will make a switch when ready. |
@@ -285,8 +285,6 @@ def RunCMake(context, extraArgs=None, stages=None): | |||
def RunCTest(context, extraArgs=None): | |||
buildDir = context.buildDir | |||
variant = BuildVariant(context) | |||
#TODO we can't currently run tests in parallel, something to revisit. | |||
numJobs = 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.
We would like to preserve the default behavior of running tests in serial unless the number of jobs was explicitly passed to the build script. This would match what ctest
is doing where by default it runs with a single job, but you can enable parallel execution when using -j
flag. Once this is done, we should be able to merge this PR and start gradually adopt it platform by platform.
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.
Good point. I re-worked this change to only use multiple jobs for testing when you explicitly use --jobs
. Otherwise if --jobs
isn't given, the behavior should be the same as before where it uses the number of CPUs for building and only one for testing. Also rebased against dev.
See f2cb351.
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.
Thank you, Matt. I added @HamedSabri-adsk to the review since he may have some feedback for the actual implementation.
2b1238f
to
f2cb351
Compare
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.
Hi @mattyjams Your changes mostly looks great but there are couple of tiny things that I would like to change:
We always want to use all the available CPU cores for build jobs. We've never had a situation to not use all the cores when building the project. With your recent changes, numBuildJobs now depends on args.jobs which is something we don't want.
if (args.jobs is not None):
if args.jobs <= 0:
raise ValueError("Number of jobs must be greater than 0")
self.numBuildJobs = args.jobs
self.numTestJobs = args.jobs
else:
self.numBuildJobs = GetDefaultNumBuildJobs()
self.numTestJobs = GetDefaultNumTestJobs()
Here is something that we can do:
1- Have numBuildJobs
unconditionally always use GetDefaultNumBuildJobs()
2- Rename --jobs
to --ctest-jobs
.
3- Introduce a new argument --ctest-args
. By exposing this argument, people can also pass extra ctest arguments ( e.g -VV, -L, etc.... ).
@HamedSabri-adsk Are you saying that you want the build jobs to always unconditionally always use the number max number of CPUs? I think that is a good default, but we should provide a way to override that. Why not leave the existing --jobs flag as-is and add a new flag --test-jobs? |
Sure, I wasn't sure if we ever want to override it but perhaps one might need. In that case, could we have exciting |
@HamedSabri-adsk I do sometimes override the jobs flag (using a number less than my nb of cores) when I want to launch a job and do something else with my computer while its building. |
@HamedSabri-adsk: I don't think that's true. Previously, self.numJobs = args.jobs As others have identified, if you had passed a different value to the If people prefer that |
Hmm, not sure what part of my original comment is incorrect? If you print out self.numJobs as is right now, you can see it prints GetCPUCount(). That's what is it used as default value. I never had the need to set the jobs flags and therefore it takes the default value.
|
I'm saying that If you do not pass |
@mattyjams We discussed this internally and agree that renaming an already existing flag isn't ideal. For exactly this reason we feel we shouldn't cut corners now and provide only the ability to customize the number of jobs for tests. The end goal is to have the ability to append custom arguments to What we are proposing is to have a new Finally, the current build.py |
This allows running tests in parallel using the --ctest-args option with an invocation like this: build.py ... --stages test --ctest-args "--parallel 8" -- .
f2cb351
to
ce0fc54
Compare
In that case, how about the simplified change in ce0fc54 which simply removes the hard-coded With that change, I'm able to run tests in parallel with a command that looks something like this:
|
Ha, looks like we already had it set up this way 🤦♂️ and by default, it will run in serial. |
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.
This change looks good to me. The default behavior is the same, since ctest by default uses a single job. But this gives users the ability to override.
I'm not sure what previously required the tests to be run serially, but I don't seem to be having any issues running them in parallel on Linux.
Was there something else we needed to follow up on here before we switched multiprocessing back on?