Skip to content

Conversation

@ykkk2333
Copy link
Contributor

@ykkk2333 ykkk2333 commented Mar 1, 2022

add use xpu option in config, *test=kunlun

train.py Outdated
)
parser.add_argument(
'--use_xpu',
dest='use_xpu',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use --device argument, support gpu/cpu/xpu.

place = 'gpu' if env_info['Paddle compiled with cuda'] and env_info[
'GPUs used'] else 'cpu'
if args.use_xpu and paddle.is_compiled_with_xpu():
place = 'xpu'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace with the the following code.

If args.device == 'gpu' and env_info['Paddle compiled with cuda'] and and env_info['GPUs used']:
    place = 'gpu'
elif args.device == 'xpu' and paddle.is_compiled_with_xpu():
    place = 'xpu'
else:
    place = 'cpu'

@ykkk2333 ykkk2333 force-pushed the dev branch 2 times, most recently from b46821c to 2a443fe Compare March 1, 2022 06:52
train.py Outdated
'--device',
dest='device',
help='Device place, which can be GPU, XPU, CPU',
default=False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default='gpu' and type=str

train.py Outdated

place = 'gpu' if env_info['Paddle compiled with cuda'] and env_info[
'GPUs used'] else 'cpu'
if args.device == 'gpu' and env_info['Paddle compiled with cuda'] and and env_info['GPUs used']:
Copy link
Collaborator

@juncaipeng juncaipeng Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First run pip install pre-commit and then git commit xx .
The length of the above line is too long.

Copy link
Collaborator

@juncaipeng juncaipeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaelowenliu michaelowenliu changed the title add use xpu option, *test=kunlun [Enhancement] Add xpu option, *test=kunlun Mar 1, 2022
@juncaipeng juncaipeng closed this Mar 2, 2022
@juncaipeng juncaipeng reopened this Mar 2, 2022
@michaelowenliu michaelowenliu merged commit 4cad8e7 into PaddlePaddle:develop Mar 2, 2022
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.

3 participants