Add new implementation of get_num_cpu #7568
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are a few points where the new implementation is slightly different from the old definition.
"
for strings, butresdata.rd_util.get_num_cpu
considers that a string./
to be escaped in a filename.dir\/my_file.txt
is a valid filename for the INCLUDE statement for eclipse, but forINCLUDE\n dir/file.txt /
the first/
ends the statement so it is equivalent toINCLUDE\n dir /
. OPM flow does not interpret the first/
as ending the statement so includes it sucessfully.'
like this'filename\'.txt'
, altoughresdata.rd_util.get_num_cpu
will in that case consider the second'
as not terminating the string which is inconsistent with what happens in eclipse and opm.resdata.rd_util.get_num_cpu
does not allow you to do double escapes, ie'filename.txt\\'
is considered a non-terminated string. In filenames, opm wil replace\
with/
on linux.PARALLEL'0' \
wouldutil_abort
due to non-terminated string literal.resdata.rd_util.get_num_cpu
looks for the wordsSLAVE
andPARALLEL
anywhere on the line, but according to the specification, the word must be the first word on the line. The new implementation is limited to this, and also just the first 8 characters of that word as that is another requirement of the file format.I ran the following with a version of
resdata.rd_util.get_num_cpu
where most failures return 1 instead ofutil_abort
:On this input, there are no differences.
The following bug in resdata was found while investigating what the impact would be from changing implementation:
When applicable