Navigation Menu

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

[Kunlun]add collective ops for multi XPU cards training and add Kunlun multi XPU cards CI #32302

Merged
merged 16 commits into from Apr 21, 2021

Conversation

vslyu
Copy link
Contributor

@vslyu vslyu commented Apr 15, 2021

PR types

New features

PR changes

OPs

Describe

  • add collective ops for multi XPU cards training
    add allreduce_sum/prod/max/min and reduce_sum/prod/max/min ops for XPU.

example:
fleetrun --xpus 0,1 example.py

import numpy as np
import paddle
from paddle.distributed import init_parallel_env

paddle.set_device('xpu:%d'%paddle.distributed.ParallelEnv().dev_id)
init_parallel_env()
if paddle.distributed.ParallelEnv().local_rank == 0:
    np_data = np.array([[4, 5, 6], [4, 5, 6]]).astype(np.float32)
else:
    np_data = np.array([[1, 2, 3], [1, 2, 3]]).astype(np.float32)
data = paddle.to_tensor(np_data)
paddle.distributed.reduce(data, 0)
out = data.numpy()
# [[5, 7, 9], [5, 7, 9]]
  • add Kunlun multi XPU cards CI
    add dist xpu tests in python/paddle/fluid/tests/unittests/CMakeLists.txt.
    UT name must contain "_xpu" to be executed, redefined example as following:
# dist xpu tests: 
if (WITH_XPU_BKCL)
    py_test(test_collective_reduce_api_xpu SRCS "test_collective_reduce_api.py")
    py_test(test_collective_allreduce_api_xpu SRCS "test_collective_allreduce_api.py")
endif()

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@vslyu vslyu force-pushed the dev/add_xpu_colletive_ops1 branch from 09406ed to 26bfd67 Compare April 19, 2021 15:17
#include "paddle/fluid/platform/collective_helper.h"
#endif

#if (defined PADDLE_WITH_NCCL)
Copy link
Contributor

Choose a reason for hiding this comment

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

#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)

Copy link
Contributor Author

@vslyu vslyu Apr 20, 2021

Choose a reason for hiding this comment

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

done~

#include "paddle/fluid/platform/collective_helper.h"
#include "paddle/fluid/platform/nccl_helper.h"
#endif

#if defined(PADDLE_WITH_XPU_BKCL)
Copy link
Contributor

Choose a reason for hiding this comment

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

#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)

Copy link
Contributor Author

@vslyu vslyu Apr 20, 2021

Choose a reason for hiding this comment

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

done~

@vslyu vslyu changed the title [Kunlun]add collective ops for multi XPU cards training [Kunlun]add collective ops for multi XPU cards training and add kunlun multicards CI Apr 20, 2021
@vslyu vslyu changed the title [Kunlun]add collective ops for multi XPU cards training and add kunlun multicards CI [Kunlun]add collective ops for multi XPU cards training and add Kunlun multi XPU cards CI Apr 20, 2021
Copy link
Contributor

@QingshuChen QingshuChen left a comment

Choose a reason for hiding this comment

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

LGTM

@wangxicoding wangxicoding merged commit 2194ad1 into PaddlePaddle:develop Apr 21, 2021
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.

None yet

3 participants