-
Notifications
You must be signed in to change notification settings - Fork 73
Add device context parameter #57
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
Add device context parameter #57
Conversation
/azp run |
/azp run |
/azp run |
No pipelines are associated with this pull request. |
/azp help |
Supported commands
See additional documentation. |
/azp list |
CI/CD Pipelines for this repository: |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
overall good, but need to check the performance of the cpu (so that your changes do not bring an overhead). come to me
bench.py
Outdated
@@ -175,7 +175,11 @@ def parse_args(parser, size=None, loop_types=(), | |||
help='Dataset name') | |||
parser.add_argument('--no-intel-optimized', default=False, action='store_true', | |||
help='Use no intel optimized version. ' | |||
'Now avalible for scikit-learn benchmarks'), | |||
'Now avalible for scikit-learn benchmarks') | |||
parser.add_argument('--device', default=None, type=str, |
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.
parser.add_argument('--device', default=None, type=str, | |
parser.add_argument('--device', default="host", type=str, |
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.
My understanding is that None
is used to run without context. Other values specify device type for a context
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.
ohh, then I think the host is not needed at all
configs/skl_with_context_config.json
Outdated
"data-format": ["pandas"], | ||
"data-order": ["F"], | ||
"dtype": ["float64"], | ||
"device": ["host", "cpu", "gpu"] |
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.
What happens if I run this config on a machine without a GPU driver?
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.
Exactly the same what happens if you try to run on a CPU wo DPC++ support - an exception. What is your suggession here?
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 shall point somewhere that using this config file requires DPC++ support and GPU device on board
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.
Ok, probably it's ok
sklearn_bench/dbscan.py
Outdated
min_samples=params.min_samples, metric='euclidean', | ||
algorithm='auto') | ||
|
||
# N.B. algorithm='auto' will select DAAL's brute force method when running |
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.
# N.B. algorithm='auto' will select DAAL's brute force method when running | |
# N.B. algorithm='auto' will select oneAPI Data Analytics Library (oneDAL) brute force method when running |
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.
@PetrovKP what about other files that @vlad-nazarov did not touch?
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 will correct if there are such places yet
bench.py
Outdated
@@ -175,7 +175,11 @@ def parse_args(parser, size=None, loop_types=(), | |||
help='Dataset name') | |||
parser.add_argument('--no-intel-optimized', default=False, action='store_true', | |||
help='Use no intel optimized version. ' | |||
'Now avalible for scikit-learn benchmarks'), | |||
'Now avalible for scikit-learn benchmarks') | |||
parser.add_argument('--device', default=None, type=str, |
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.
My understanding is that None
is used to run without context. Other values specify device type for a context
bench.py
Outdated
'Now avalible for scikit-learn benchmarks'), | ||
'Now avalible for scikit-learn benchmarks') | ||
parser.add_argument('--device', default=None, type=str, | ||
choices=("host", "cpu", "gpu"), |
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.
None
shall be also included?
bench.py
Outdated
@@ -197,6 +201,8 @@ def parse_args(parser, size=None, loop_types=(), | |||
except ImportError: | |||
print('Failed to import daal4py.sklearn.patch_sklearn.' | |||
'Use stock version scikit-learn', file=sys.stderr) | |||
else: | |||
params.device = None |
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 should check if the device parameter is passed by the user and print a warning that it is useless in that case - for clarity
configs/skl_with_context_config.json
Outdated
"data-format": ["pandas"], | ||
"data-order": ["F"], | ||
"dtype": ["float64"], | ||
"device": ["host", "cpu", "gpu"] |
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.
Exactly the same what happens if you try to run on a CPU wo DPC++ support - an exception. What is your suggession here?
configs/skl_with_context_config.json
Outdated
"data-format": ["pandas"], | ||
"data-order": ["F"], | ||
"dtype": ["float64"], | ||
"device": ["host", "cpu", "gpu"] |
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 shall point somewhere that using this config file requires DPC++ support and GPU device on board
runner.py
Outdated
@@ -70,6 +70,9 @@ def generate_cases(params): | |||
parser.add_argument('--report', default=False, action='store_true', | |||
help='Create an Excel report based on benchmarks results. ' | |||
'Need "openpyxl" library') | |||
parser.add_argument('--device', default=None, type=str, |
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.
Why the parameter is duplicated in bench.py
and runner.py
?
sklearn_bench/dbscan.py
Outdated
min_samples=params.min_samples, metric='euclidean', | ||
algorithm='auto') | ||
|
||
# N.B. algorithm='auto' will select DAAL's brute force method when running |
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.
@PetrovKP what about other files that @vlad-nazarov did not touch?
bench.py
Outdated
'Now avalible for scikit-learn benchmarks'), | ||
'Now avalible for scikit-learn benchmarks') | ||
parser.add_argument('--device', default='host', type=str, | ||
choices=('host', 'cpu', 'gpu'), |
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.
Why you changed the behavior? For me, using None
is better to depict we are not using contexts. host
, cpu
and gpu
are values supported to create daal4py.oneapi.sycl_context
- please do not introduce confusion here.
bench.py
Outdated
params.device = 'host' | ||
else: | ||
if params.device != 'host': | ||
print('Device context not supported without intel optimized version', |
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.
Device context is not supported for stock scikit-learn. Please use --no-intel-optimized=False
with f'--device={params.device}' parameter. Fallback to --device=None
.
@@ -0,0 +1,77 @@ | |||
{ | |||
"common": { | |||
"lib": ["sklearn"], |
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.
How stock or intel version of sk is specified for this config?
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.
Do we need to launch the stock sk in this config? Maybe just add flag no-intel-optimized
before config run? I think it's better to separate patched and unpatched sk launches
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.
Ok - probably its better to skip device != None
branches for stock sklearn
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.
Need to add support to skip these cases?
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.
merge after green CI
@@ -0,0 +1,77 @@ | |||
{ | |||
"common": { | |||
"lib": ["sklearn"], |
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.
Ok - probably its better to skip device != None
branches for stock sklearn
No description provided.