Skip to content
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

[Enhancement] Add xpu option, *test=kunlun #1815

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

ykkk2333
Copy link
Contributor

@ykkk2333 ykkk2333 commented Mar 1, 2022

add use xpu option in config, *test=kunlun

train.py Outdated
@@ -120,6 +120,12 @@ def parse_args():
help='The option of train profiler. If profiler_options is not None, the train ' \
'profiler is enabled. Refer to the paddleseg/utils/train_profiler.py for details.'
)
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.

train.py Outdated
@@ -139,6 +145,8 @@ def main(args):

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
@@ -137,8 +143,12 @@ def main(args):
['-' * 48])
logger.info(info)

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